Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java | 
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java | 
| index a4e1f4fa6697b98e31fda6a70947f4b0ef97f340..e64db2850951257c803fee607c4c30e91881352b 100644 | 
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java | 
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java | 
| @@ -107,31 +107,29 @@ public class NewTabPageLayout extends LinearLayout { | 
| super.onMeasure(widthMeasureSpec, heightMeasureSpec); | 
| if (getMeasuredHeight() > mParentViewportHeight) { | 
| - // This layout is bigger than its parent's viewport, so the user will need to scroll | 
| - // to see all of it. Extra spacing should be added at the bottom so the user can scroll | 
| - // until Most Visited is at the top. | 
| - | 
| - // The top, middle, and bottom spacers should have a measured height of 0 at this point | 
| - // since they use weights to set height, and there was no extra space. | 
| - assert mTopSpacer.getMeasuredHeight() == 0; | 
| - assert mMiddleSpacer.getMeasuredHeight() == 0; | 
| - assert mBottomSpacer.getMeasuredHeight() == 0; | 
| - | 
| - final int topOfMostVisited = calculateTopOfMostVisited(); | 
| - final int belowTheFoldHeight = getMeasuredHeight() - mParentViewportHeight; | 
| - if (belowTheFoldHeight < topOfMostVisited) { | 
| - mScrollCompensationSpacer.getLayoutParams().height = | 
| - topOfMostVisited - belowTheFoldHeight; | 
| - | 
| - if (mCardsUiEnabled) { | 
| - // If we have a peeking card, allow that to show at the bottom of the screen. | 
| - mScrollCompensationSpacer.getLayoutParams().height -= mPeekingCardHeight; | 
| + // No spacing needed when |mCardsUiEnabled| is enabled. | 
| 
 
Michael van Ouwerkerk
2016/07/15 15:05:28
How about: "No scroll spacing needed when using th
 
mcwilliams
2016/07/18 15:11:45
Done.
 
 | 
| + if (!mCardsUiEnabled) { | 
| + // This layout is bigger than its parent's viewport, so the user will need to scroll | 
| + // to see all of it. Extra spacing should be added at the bottom so the user can | 
| + // scroll until Most Visited is at the top. | 
| + | 
| + // The top, middle, and bottom spacers should have a measured height of 0 at this | 
| + // point since they use weights to set height, and there was no extra space. | 
| + assert mTopSpacer.getMeasuredHeight() == 0; | 
| + assert mMiddleSpacer.getMeasuredHeight() == 0; | 
| + assert mBottomSpacer.getMeasuredHeight() == 0; | 
| + | 
| + final int topOfMostVisited = calculateTopOfMostVisited(); | 
| + final int belowTheFoldHeight = getMeasuredHeight() - mParentViewportHeight; | 
| + if (belowTheFoldHeight < topOfMostVisited) { | 
| + // Include the scroll spacer in the layout and call super.onMeasure again so it | 
| + // is measured. | 
| + mScrollCompensationSpacer.getLayoutParams().height = | 
| + topOfMostVisited - belowTheFoldHeight; | 
| + | 
| + mScrollCompensationSpacer.setVisibility(View.INVISIBLE); | 
| + super.onMeasure(widthMeasureSpec, heightMeasureSpec); | 
| } | 
| - | 
| - // Include the scroll spacer in the layout and call super.onMeasure again so it is | 
| - // measured. | 
| - mScrollCompensationSpacer.setVisibility(View.INVISIBLE); | 
| - super.onMeasure(widthMeasureSpec, heightMeasureSpec); | 
| } | 
| } else { | 
| // This layout is smaller than or equal to its parent viewport. Redistribute any |