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

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

Issue 12086100: Fix conversion to from document/window points (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 957b4fa153ca5479f262b3067bb3c8aad180aeba..375f2484a9a13411cb38d259bb8a6095ec08d22d 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
@@ -217,19 +217,20 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient {
private InsertionHandleController mInsertionHandleController;
/**
- * Handles conversion of a point from window to document space and vice versa.
+ * Handles conversion of a point from window (physical pixel) to document (absolute CSS) space
+ * and vice versa.
*/
private class NormalizedPoint {
final PointF document = new PointF();
final PointF window = new PointF();
void updateDocumentFromWindow() {
- float x = (window.x + mNativeScrollX) / mNativePageScaleFactor;
- float y = (window.y + mNativeScrollY) / mNativePageScaleFactor;
+ float x = window.x / mNativePageScaleFactor + mNativeScrollX;
+ float y = window.y / mNativePageScaleFactor + mNativeScrollY;
document.set(x, y);
}
void updateWindowFromDocument() {
- float x = document.x * mNativePageScaleFactor - mNativeScrollX;
- float y = document.y * mNativePageScaleFactor - mNativeScrollY;
+ float x = (document.x - mNativeScrollX) * mNativePageScaleFactor;
+ float y = (document.y - mNativeScrollY) * mNativePageScaleFactor;
window.set(x, y);
}
void setWindow(float x, float y) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698