Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java

Issue 714003002: Allow changing top controls height (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added more invalidates when setting the height Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 8ab66704bd9049ef44bf9c4e1a57f4c3699237e4..6f7641464b222509649a228dbe6626ad92210b19 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
@@ -401,7 +401,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;
@@ -547,21 +548,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);
}
/**
@@ -992,15 +999,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 getTopControlsShrinkBlinkSize() {
+ return mTopControlsShrinkBlinkSize;
+ }
+
+ @CalledByNative
+ public int getTopControlsHeightPix() {
+ return mTopControlsHeightPix;
}
/**

Powered by Google App Engine
This is Rietveld 408576698