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 9246385f8588d6205b54339e37e350166fdcc358..6ed1d8d5ba6befd1c42361b3a211ef4d2d1312e2 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 |
@@ -425,6 +425,9 @@ public class ContentViewCore |
// Cached copy of all positions and scales as reported by the renderer. |
private final RenderCoordinates mRenderCoordinates; |
+ // Buffer to receive return value from View#getLocationOnScreen(int[]). |
+ private final int[] mGetLocationOnScreenBuffer = new int[2]; |
+ |
// Tracks whether a selection is currently active. When applied to selected text, indicates |
// whether the last selected text is still highlighted. |
private boolean mHasSelection; |
@@ -3073,6 +3076,13 @@ public class ContentViewCore |
mContextualSearchClient = contextualSearchClient; |
} |
+ @CalledByNative |
+ private long getLocationOnScreen() { |
+ // TODO(yukawa): ViewPositionObserver has similar logic. Try to merge them. |
+ mContainerView.getLocationInWindow(mGetLocationOnScreenBuffer); |
+ return ((long) mGetLocationOnScreenBuffer[0]) << 32 | mGetLocationOnScreenBuffer[1]; |
+ } |
+ |
private native WebContents nativeGetWebContentsAndroid(long nativeContentViewCoreImpl); |
private native void nativeOnJavaContentViewCoreDestroyed(long nativeContentViewCoreImpl); |