Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
index 1354e88b752a9865910f9568f09f73d57ab0fa83..0f72088a20350cef7eed40ac6dc76294129d9825 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
@@ -418,7 +418,8 @@ public class ContentViewCore |
private int mViewportHeightPix; |
private int mPhysicalBackingWidthPix; |
private int mPhysicalBackingHeightPix; |
- private int mTopControlsLayoutHeightPix; |
+ private int mTopControlsHeightPix; |
+ private boolean mTopControlsShrinkBlinkSize; |
// Cached copy of all positions and scales as reported by the renderer. |
private final RenderCoordinates mRenderCoordinates; |
@@ -564,21 +565,27 @@ public class ContentViewCore |
return mWebContents; |
} |
- /* TODO(aelias): Remove this after downstream callers switch to setTopControlsLayoutHeight. */ |
+ /* TODO(aelias): Remove this after downstream callers switch to setTopControlsHeight. */ |
public void setViewportSizeOffset(int offsetXPix, int offsetYPix) { |
- setTopControlsLayoutHeight(offsetYPix); |
+ setTopControlsHeight(mTopControlsHeightPix, offsetYPix != 0); |
} |
/** |
- * Specifies how much smaller the Blink layout size should be relative to the size of this |
- * view. |
- * @param topControlsLayoutHeightPix The Y amount in pixels to shrink the viewport by. |
- */ |
- public void setTopControlsLayoutHeight(int topControlsLayoutHeightPix) { |
- if (topControlsLayoutHeightPix != mTopControlsLayoutHeightPix) { |
- mTopControlsLayoutHeightPix = topControlsLayoutHeightPix; |
- if (mNativeContentViewCore != 0) nativeWasResized(mNativeContentViewCore); |
+ * |
+ * @param topControlsHeightPix The height of the top controls in pixels. |
+ * @param topControlsShrinkBlinkSize The Y amount in pixels to shrink the viewport by. This |
+ * specifies how much smaller the Blink layout size should be |
+ * relative to the size of this View. |
+ */ |
+ public void setTopControlsHeight(int topControlsHeightPix, boolean topControlsShrinkBlinkSize) { |
+ if (topControlsHeightPix == mTopControlsHeightPix |
+ && topControlsShrinkBlinkSize == mTopControlsShrinkBlinkSize) { |
+ return; |
} |
+ |
+ mTopControlsHeightPix = topControlsHeightPix; |
+ mTopControlsShrinkBlinkSize = topControlsShrinkBlinkSize; |
+ if (mNativeContentViewCore != 0) nativeWasResized(mNativeContentViewCore); |
} |
/** |
@@ -1010,15 +1017,20 @@ public class ContentViewCore |
@VisibleForTesting |
public int getViewportSizeOffsetHeightPix() { |
- return getTopControlsLayoutHeightPix(); |
+ return mTopControlsShrinkBlinkSize ? mTopControlsHeightPix : 0; |
} |
/** |
* @return The amount that the viewport size given to Blink is shrunk by the URL-bar.. |
*/ |
@CalledByNative |
- public int getTopControlsLayoutHeightPix() { |
- return mTopControlsLayoutHeightPix; |
+ public boolean doTopControlsShrinkBlinkSize() { |
+ return mTopControlsShrinkBlinkSize; |
+ } |
+ |
+ @CalledByNative |
+ public int getTopControlsHeightPix() { |
+ return mTopControlsHeightPix; |
} |
/** |