| Index: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
|
| index 243884de58259d7f0a608f68d3cc4114fc5395d6..2598e7c41019b04ac8ba30769c886f0f058048cf 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
|
| @@ -287,13 +287,16 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
|
| * @param height The new width in dp.
|
| * @param isToolbarShowing Whether the Toolbar is showing.
|
| */
|
| - public final void onSizeChanged(float width, float height, boolean isToolbarShowing) {
|
| + public void onSizeChanged(float width, float height, boolean isToolbarShowing) {
|
| mLayoutWidth = width;
|
| mLayoutHeight = height;
|
| mIsToolbarShowing = isToolbarShowing;
|
|
|
| mMaximumWidth = calculateSearchPanelWidth();
|
| mMaximumHeight = getPanelHeightFromState(PanelState.MAXIMIZED);
|
| + setPanelHeight(getPanelHeightFromState(getPanelState()));
|
| + mOffsetX = calculateSearchPanelX();
|
| + mOffsetY = calculateSearchPanelY();
|
| }
|
|
|
| /**
|
| @@ -325,6 +328,21 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
|
| }
|
|
|
| /**
|
| + * @return The current X-position of the Contextual Search Panel.
|
| + */
|
| + protected float calculateSearchPanelX() {
|
| + return isFullscreenSizePanel() ? 0.f
|
| + : Math.round((getFullscreenWidth() - calculateSearchPanelWidth()) / 2.f);
|
| + }
|
| +
|
| + /**
|
| + * @return The current Y-position of the Contextual Search Panel.
|
| + */
|
| + protected float calculateSearchPanelY() {
|
| + return getFullscreenHeight() - mHeight;
|
| + }
|
| +
|
| + /**
|
| * @return The current width of the Contextual Search Panel.
|
| */
|
| protected float calculateSearchPanelWidth() {
|
| @@ -380,7 +398,7 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
|
| /**
|
| * @return The fullscreen height.
|
| */
|
| - private float getFullscreenHeight() {
|
| + public float getFullscreenHeight() {
|
| // 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());
|
| @@ -978,9 +996,8 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
|
| */
|
| private void updatePanelSize(float height, PanelState endState, float percentage) {
|
| mHeight = height;
|
| - mOffsetX = isFullscreenSizePanel() ? 0.f
|
| - : Math.round((getFullscreenWidth() - calculateSearchPanelWidth()) / 2.f);
|
| - mOffsetY = getFullscreenHeight() - mHeight;
|
| + mOffsetX = calculateSearchPanelX();
|
| + mOffsetY = calculateSearchPanelY();
|
| mIsMaximized = height == getPanelHeightFromState(PanelState.MAXIMIZED);
|
| }
|
|
|
|
|