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

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

Issue 1386403003: Resize only the virtual viewport when the OSK triggers a resize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase master Inset handling logic Created 4 years, 11 months 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 4c199e0970ca7606cf224abdff13e083663f5c2c..f5a13cea985dc7cafaa9aaa76b3ed271ce860729 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
@@ -35,6 +35,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStructure;
+import android.view.WindowInsets;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityManager.AccessibilityStateChangeListener;
import android.view.accessibility.AccessibilityNodeProvider;
@@ -470,6 +471,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
private int mPhysicalBackingHeightPix;
private int mTopControlsHeightPix;
private boolean mTopControlsShrinkBlinkSize;
+ private Rect mWindowInsets;
aelias_OOO_until_Jul13 2016/01/28 05:04:55 Please add code that will guarantee this is popula
ymalik 2016/02/11 01:06:22 Done.
// Cached copy of all positions and scales as reported by the renderer.
private final RenderCoordinates mRenderCoordinates;
@@ -625,6 +627,33 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
}
/**
+ * @return The system window insets (from OSK, status bar, etc).
+ */
+ public Rect getWindowInsets() {
+ return mWindowInsets != null ? mWindowInsets : new Rect();
+ }
+
+ /**
+ * @param insets The system window insets Rect (from OSK, status bar, etc).
+ */
+ public void setWindowInsets(Rect insets) {
+ mWindowInsets = insets;
+ }
+
+ /**
+ * @param insets The insets (from OSK, status bar, etc).
+ */
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ public void setWindowInsets(WindowInsets insets) {
AKV 2016/02/10 11:35:28 private
ymalik 2016/02/11 01:06:23 The setWindowInsets function is used by InsetConsu
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return;
AKV 2016/02/10 11:35:28 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LO
ymalik 2016/02/11 01:06:22 Removed this function.
+ if (insets == null) return;
+ mWindowInsets = new Rect(insets.getSystemWindowInsetLeft(),
aelias_OOO_until_Jul13 2016/01/28 05:04:55 Could you create this once at construction time an
ymalik 2016/02/11 01:06:22 I have removed this function and changed it to tak
+ insets.getSystemWindowInsetTop(),
+ insets.getSystemWindowInsetRight(),
+ insets.getSystemWindowInsetBottom());
+ }
+
+ /**
* @return The WebContents currently being rendered.
*/
public WebContents getWebContents() {
@@ -1023,6 +1052,14 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
}
/**
+ * @return Viewport height when the OSK is hidden in physical pixels as set from onSizeChanged.
+ */
+ @CalledByNative
+ public int getViewportHeightWithOSKHiddenPix() {
+ return mViewportHeightPix + getWindowInsets().bottom;
aelias_OOO_until_Jul13 2016/01/28 05:04:55 Your design doc says this includes the status bar,
bokan 2016/01/28 15:53:42 The status bar would presumably be in getWindowIns
ymalik 2016/02/11 01:06:22 That's right. The status bar is in getWindowInsets
+ }
+
+ /**
* @return Width of underlying physical surface.
*/
@CalledByNative

Powered by Google App Engine
This is Rietveld 408576698