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

Unified Diff: ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java

Issue 2502763003: Introduce ViewRoot to forward input/view events to native (Closed)
Patch Set: Created 4 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: ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java
diff --git a/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java b/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java
index 82d09ea85aba6095b160d67ec5238c93b1586bb1..41c2e35cfa8b1e03a014aa9007a57d4fdde3aa35 100644
--- a/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java
+++ b/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java
@@ -25,6 +25,11 @@ public abstract class ViewAndroidDelegate {
// TODO(hush): use View#DRAG_FLAG_GLOBAL when Chromium starts to build with API 24.
private static final int DRAG_FLAG_GLOBAL = 1 << 8;
+ private int mPhysicalBackingWidthPix;
+ private int mPhysicalBackingHeightPix;
+
+ private long mNativeViewAndroid;
+
/**
* @return An anchor view that can be used to anchor decoration views like Autofill popup.
*/
@@ -104,6 +109,27 @@ public abstract class ViewAndroidDelegate {
new View.DragShadowBuilder(imageView), null, DRAG_FLAG_GLOBAL);
}
+ @CalledByNative
+ private void setNativePointer(long nativeViewAndroid) {
+ mNativeViewAndroid = nativeViewAndroid;
+ }
+
+ /**
+ * Called when the underlying surface the compositor draws to changes size.
+ * This may be larger than the viewport size.
+ */
+ public void onPhysicalBackingSizeChanged(int wPix, int hPix) {
+ assert mNativeViewAndroid != 0L;
+
+ if (mPhysicalBackingWidthPix == wPix && mPhysicalBackingHeightPix == hPix) return;
+
+ mPhysicalBackingWidthPix = wPix;
+ mPhysicalBackingHeightPix = hPix;
+
+ nativeOnPhysicalBackingSizeChanged(
+ mNativeViewAndroid, mPhysicalBackingWidthPix, mPhysicalBackingHeightPix);
+ }
+
/**
* @return container view that the anchor views are added to. May be null.
*/
@@ -130,4 +156,7 @@ public abstract class ViewAndroidDelegate {
}
}.init(containerView);
}
+
+ private native void nativeOnPhysicalBackingSizeChanged(
+ long nativeViewAndroid, int width, int height);
}

Powered by Google App Engine
This is Rietveld 408576698