| 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..6a0bf5a5598d363ba6ce9d0b0c8b375ecd3baf54 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;
|
| @@ -191,18 +187,23 @@ abstract class OverlayPanelBase {
|
| private boolean mOverrideIsFullWidthSizePanelForTesting;
|
|
|
| /**
|
| - * Called when the size of the view has changed.
|
| + * Called when the layout has changed.
|
| *
|
| * @param width The new width in dp.
|
| - * @param height The new width in dp.
|
| + * @param height The new height 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 onLayoutChanged(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;
|
| }
|
|
|
| /**
|
| @@ -1099,15 +1090,10 @@ abstract class OverlayPanelBase {
|
| // always return zero to ensure the Base Page remains in the same position.
|
| if (!isFullWidthSizePanel()) return 0.f;
|
|
|
| - // Start with the desired offset.
|
| - float offset = calculateBasePageDesiredOffset();
|
| + // Start with the desired offset taking viewport offset into consideration and make sure
|
| + // the result is <= 0 so the page moves up and not down.
|
| + float offset = Math.min(calculateBasePageDesiredOffset() - mLayoutYOffset, 0.0f);
|
|
|
| - // 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());
|
| // 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());
|
|
|