Commit 815680e0 authored by Matt Jones's avatar Matt Jones Committed by Commit Bot

Ensure bottom control offset is no larger than its height

This patch ensures the getter for the bottom controls offset is no
larger than the bottom controls height. This fixes an issue with the
bottom container (infobars, etc.) where the infobar would appear
partially or completely offscreen because of controls height being
0 without having updated offsets. We should be getting a signal from
the renderer for this, but that can be addressed in a followup.

Bug: 103602
Change-Id: Iedecc00364649c5be09c70e0f7db37773db57e67
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2033367Reviewed-by: default avatarSinan Sahin <sinansahin@google.com>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737421}
parent 3526c32c
...@@ -623,7 +623,10 @@ public class ChromeFullscreenManager extends FullscreenManager ...@@ -623,7 +623,10 @@ public class ChromeFullscreenManager extends FullscreenManager
@Override @Override
public int getBottomControlOffset() { public int getBottomControlOffset() {
return mRendererBottomControlOffset; // If the height is currently 0, the offset generated by the bottom controls should be too.
// TODO(crbug.com/103602): Send a offset update from the fullscreen manager when the height
// changes to ensure correct offsets (removing the need for min()).
return Math.min(mRendererBottomControlOffset, mBottomControlContainerHeight);
} }
@Override @Override
...@@ -903,6 +906,9 @@ public class ChromeFullscreenManager extends FullscreenManager ...@@ -903,6 +906,9 @@ public class ChromeFullscreenManager extends FullscreenManager
public void setPositionsForTab(int topControlsOffset, int bottomControlsOffset, public void setPositionsForTab(int topControlsOffset, int bottomControlsOffset,
int topContentOffset, int topControlsMinHeightOffset, int topContentOffset, int topControlsMinHeightOffset,
int bottomControlsMinHeightOffset) { int bottomControlsMinHeightOffset) {
// This min/max logic is here to handle changes in the browser controls height. For example,
// if we change either height to 0, the offsets of the controls should also be 0. This works
// assuming we get an event from the renderer after the browser control heights change.
int rendererTopControlOffset = Math.max(topControlsOffset, -getTopControlsHeight()); int rendererTopControlOffset = Math.max(topControlsOffset, -getTopControlsHeight());
int rendererBottomControlOffset = Math.min(bottomControlsOffset, getBottomControlsHeight()); int rendererBottomControlOffset = Math.min(bottomControlsOffset, getBottomControlsHeight());
......
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