Commit 665f9dec authored by Michael Thiessen's avatar Michael Thiessen Committed by Commit Bot

Account for dip scale mismatch in VR for control height.

In VR, we change the dip scale of the WebContents, but cannot properly
change the dip scale of Java UI because doing so would require
reinflating said java UI.

This leads to problems when determining the offset applied by the
top/bottom controls. RenderWidgetHostViewAndroid previously converted
the shown ratio of the controls to pixel values using the dip scale
of the WebContents, while ChromeFullscreenManager converted the control
height to pixels using the Java UI dpr. It then treated a mismatch
between these two values as the control container being visible, even
if the shown ratio was 0.

This CL changes the FullscreenManager to always apply fully-hidden
control offsets while in VR since the controls will be hidden anyways.

Bug: 793430
Change-Id: If18aa601ed51ea91cef6b83060972d216a8cd6a9
Reviewed-on: https://chromium-review.googlesource.com/818116
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524430}
parent f8ebd2b9
......@@ -476,7 +476,6 @@ public class ChromeFullscreenManager
}
boolean controlsResizeView =
topContentOffset > 0 || bottomControlOffset < getBottomControlsHeight();
controlsResizeView &= !VrShellDelegate.isInVr();
mControlsResizeView = controlsResizeView;
Tab tab = getTab();
if (tab == null) return;
......@@ -641,6 +640,17 @@ public class ChromeFullscreenManager
@Override
public void setPositionsForTab(float topControlsOffset, float bottomControlsOffset,
float topContentOffset) {
if (VrShellDelegate.isInVr()) {
// The dip scale of java UI and WebContents are different while in VR, leading to a
// mismatch in size in pixels when converting from dips. Since we hide the controls in
// VR anyways, just set the offsets to what they're supposed to be with the controls
// hidden.
// TODO(mthiesse): Should we instead just set the top controls height to be 0 while in
// VR?
topControlsOffset = -getTopControlsHeight();
bottomControlsOffset = getBottomControlsHeight();
topContentOffset = 0;
}
float rendererTopControlOffset =
Math.round(Math.max(topControlsOffset, -getTopControlsHeight()));
float rendererBottomControlOffset =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment