| Index: chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java
|
| index 00f5b30cea3198733b0a61c361d69393a7401795..a5f6d7c711fb600624eeb7f706bc17f8e7dfa598 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarPhone.java
|
| @@ -912,9 +912,7 @@ public class ToolbarPhone extends ToolbarLayout
|
| int locationBarTranslationY =
|
| Math.max(0, (mNtpSearchBoxBounds.top - mLocationBar.getTop()));
|
| mLocationBar.setTranslationY(locationBarTranslationY);
|
| - if (!mUrlFocusChangeInProgress) {
|
| - setButtonsTranslationY();
|
| - }
|
| + updateButtonsTranslationY();
|
|
|
| // Linearly interpolate between the bounds of the search box on the NTP and the omnibox
|
| // background bounds. |shrinkage| is the scaling factor for the offset -- if it's 1, we are
|
| @@ -958,11 +956,16 @@ public class ToolbarPhone extends ToolbarLayout
|
| }
|
| }
|
|
|
| - private void setButtonsTranslationY() {
|
| - int searchBoxTranslationY = Math.min(mNtpSearchBoxTranslation.y, 0);
|
| - mToolbarButtonsContainer.setTranslationY(searchBoxTranslationY);
|
| - mReturnButton.setTranslationY(searchBoxTranslationY);
|
| - mHomeButton.setTranslationY(searchBoxTranslationY);
|
| + /**
|
| + * Update the y translation of the buttons to make it appear as if they were scrolling with
|
| + * the new tab page.
|
| + */
|
| + private void updateButtonsTranslationY() {
|
| + int transY = mTabSwitcherState == STATIC_TAB ? Math.min(mNtpSearchBoxTranslation.y, 0) : 0;
|
| +
|
| + mToolbarButtonsContainer.setTranslationY(transY);
|
| + mReturnButton.setTranslationY(transY);
|
| + mHomeButton.setTranslationY(transY);
|
| }
|
|
|
| private void setAncestorsShouldClipChildren(boolean clip) {
|
| @@ -1519,6 +1522,7 @@ public class ToolbarPhone extends ToolbarLayout
|
| }
|
| }
|
|
|
| + updateButtonsTranslationY();
|
| mAnimateNormalToolbar = showToolbar;
|
| if (mTabSwitcherModeAnimation != null) mTabSwitcherModeAnimation.start();
|
|
|
| @@ -1755,16 +1759,6 @@ public class ToolbarPhone extends ToolbarLayout
|
| return;
|
| }
|
|
|
| - // https://crbug.com/623885: The mToolbarButtonsContainer has its translationY modified
|
| - // during scroll so when the user scrolls on the NTP, it appears to scroll too. However
|
| - // during the URL focus and defocus animations it should not be touched. Unfortunately
|
| - // updateNtpTransitionAnimation() is called a few times after the URL focus animation has
|
| - // been completed while mUrlFocusChangeInProgress is set to false, causing translationY to
|
| - // incorrect at the end.
|
| - // We reset the translationY here so the mToolbarButtonsContainer is on screen for the
|
| - // defocusing animation.
|
| - setButtonsTranslationY();
|
| -
|
| triggerUrlFocusAnimation(hasFocus);
|
|
|
| TransitionDrawable shadowDrawable = (TransitionDrawable) mToolbarShadow.getDrawable();
|
|
|