summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-01-24 00:00:56 +0900
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-01-26 10:27:45 +0100
commit06da73832af106f3b4a1921df53037e81614feae (patch)
treeed9d3180249af1d9f0cbd674edae44c7b967987a /android
parent525d73fc41bdb8afe227d6207e1f5d6df27ca24b (diff)
android: view point to document point conversion updated
Change-Id: Ie8a712f3fa24d0ffeef3ef524c02e97acdb1237e
Diffstat (limited to 'android')
-rw-r--r--android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java25
1 files changed, 3 insertions, 22 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
index 9ec1c9842cb6..db21554c7bd1 100644
--- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
+++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
@@ -398,33 +398,14 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
return this;
}
- /** Implementation of PanZoomTarget
- * Converts a point from layer view coordinates to layer coordinates. In other words, given a
- * point measured in pixels from the top left corner of the layer view, returns the point in
- * pixels measured from the last scroll position we sent to Gecko, in CSS pixels. Assuming the
- * events being sent to Gecko are processed in FIFO order, this calculation should always be
- * correct.
- */
public PointF convertViewPointToLayerPoint(PointF viewPoint) {
- if (!mGeckoIsReady) {
- return null;
- }
-
ImmutableViewportMetrics viewportMetrics = mViewportMetrics;
PointF origin = viewportMetrics.getOrigin();
float zoom = viewportMetrics.zoomFactor;
- ImmutableViewportMetrics geckoViewport = mGeckoViewport;
- PointF geckoOrigin = geckoViewport.getOrigin();
- float geckoZoom = geckoViewport.zoomFactor;
-
- // viewPoint + origin gives the coordinate in device pixels from the top-left corner of the page.
- // Divided by zoom, this gives us the coordinate in CSS pixels from the top-left corner of the page.
- // geckoOrigin / geckoZoom is where Gecko thinks it is (scrollTo position) in CSS pixels from
- // the top-left corner of the page. Subtracting the two gives us the offset of the viewPoint from
- // the current Gecko coordinate in CSS pixels.
+
PointF layerPoint = new PointF(
- ((viewPoint.x + origin.x) / zoom) - (geckoOrigin.x / geckoZoom),
- ((viewPoint.y + origin.y) / zoom) - (geckoOrigin.y / geckoZoom));
+ ((viewPoint.x + origin.x) / zoom),
+ ((viewPoint.y + origin.y) / zoom));
return layerPoint;
}