Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelBase.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelBase.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelBase.java |
| index 396cba5343ec60762335d572e25a6e0b512d0e28..33435fe30b42450c1bb536e8495c87f59304f173 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelBase.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelBase.java |
| @@ -159,11 +159,6 @@ abstract class OverlayPanelBase { |
| protected abstract void onClosed(StateChangeReason reason); |
| /** |
| - * @return The absolute amount in DP that the top controls have shifted off screen. |
| - */ |
| - protected abstract float getTopControlsOffsetDp(); |
| - |
| - /** |
| * TODO(mdjones): This method should be removed from this class. |
| * @return The resource id that contains how large the top controls are. |
| */ |
| @@ -183,6 +178,7 @@ abstract class OverlayPanelBase { |
| private float mLayoutWidth; |
| private float mLayoutHeight; |
| + private float mLayoutYOffset; |
| private float mMaximumWidth; |
| private float mMaximumHeight; |
| @@ -195,14 +191,19 @@ abstract class OverlayPanelBase { |
| * |
| * @param width The new width in dp. |
| * @param height The new width in dp. |
| + * @param visibleViewportOffsetY The Y offset of the content in dp. |
| */ |
| - public void onSizeChanged(float width, float height) { |
| - if (width == mLayoutWidth && height == mLayoutHeight) return; |
| + public void onSizeChanged(float width, float height, float visibleViewportOffsetY) { |
| + if (width == mLayoutWidth && height == mLayoutHeight |
| + && visibleViewportOffsetY == mLayoutYOffset) { |
| + return; |
| + } |
| float previousLayoutWidth = mLayoutWidth; |
| mLayoutWidth = width; |
| mLayoutHeight = height; |
| + mLayoutYOffset = visibleViewportOffsetY; |
| mMaximumWidth = calculateOverlayPanelWidth(); |
| mMaximumHeight = getPanelHeightFromState(PanelState.MAXIMIZED); |
| @@ -258,14 +259,6 @@ abstract class OverlayPanelBase { |
| } |
| /** |
| - * @param y The y coordinate. |
| - * @return The Y coordinate relative the fullscreen height. |
| - */ |
| - public float getFullscreenY(float y) { |
| - return y + (mToolbarHeight - getTopControlsOffsetDp()) / mPxToDp; |
| - } |
| - |
| - /** |
| * @return Whether the Panel is showing. |
| */ |
| public boolean isShowing() { |
| @@ -291,9 +284,7 @@ abstract class OverlayPanelBase { |
| * @return The height of the tab the panel is displayed on top of. |
| */ |
| public float getTabHeight() { |
| - // NOTE(mdjones): This value will always be the same for a particular orientation; it is |
| - // the content height + visible toolbar height. |
| - return mLayoutHeight + (getToolbarHeight() - getTopControlsOffsetDp()); |
| + return mLayoutHeight; |
| } |
| /** |
| @@ -1105,9 +1096,8 @@ abstract class OverlayPanelBase { |
| // Make sure offset is negative to prevent Base Page from moving down, |
| // because there's nothing to render above the Page. |
| offset = Math.min(offset, 0.f); |
| - // If visible, the Toolbar will be hidden. Therefore, we need to adjust |
| - // the offset to account for this difference. |
| - offset -= (mToolbarHeight - getTopControlsOffsetDp()); |
| + // Adjust for viewport offset. |
| + offset -= mLayoutYOffset; |
|
Donn Denman
2016/06/23 23:47:00
Shouldn't this be moved up to before the Math.min?
mdjones
2016/06/24 01:30:26
Done, I also joined a few of these lines for brevi
|
| // Make sure the offset is not greater than the expanded height, because |
| // there's nothing to render below the Page. |
| offset = Math.max(offset, -getExpandedHeight()); |