Bug 1055548 - Round the APZ tap notifications to integer CSS pixels before sending to JS code. r=wesj
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 26 Aug 2014 12:45:04 -0400
changeset 201721 536aaaee3ea865a302bb46b32a9fdc8678cf0a73
parent 201720 595c082491e872b2bfc6efee595d7e61d55bbfd8
child 201722 a7966a108af1a090fa1fbd04fb003104438b5b03
push id27380
push userkwierso@gmail.com
push dateWed, 27 Aug 2014 00:50:11 +0000
treeherdermozilla-central@83289be2cd12 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj
bugs1055548
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1055548 - Round the APZ tap notifications to integer CSS pixels before sending to JS code. r=wesj
widget/android/APZCCallbackHandler.cpp
--- a/widget/android/APZCCallbackHandler.cpp
+++ b/widget/android/APZCCallbackHandler.cpp
@@ -117,39 +117,42 @@ APZCCallbackHandler::AcknowledgeScrollUp
     APZCCallbackHelper::AcknowledgeScrollUpdate(aScrollId, aScrollGeneration);
 }
 
 void
 APZCCallbackHandler::HandleDoubleTap(const CSSPoint& aPoint,
                                      int32_t aModifiers,
                                      const mozilla::layers::ScrollableLayerGuid& aGuid)
 {
-    nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", aPoint.x, aPoint.y);
+    CSSIntPoint point = RoundedToInt(aPoint);
+    nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", point.x, point.y);
     nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeBroadcastEvent(
             NS_LITERAL_CSTRING("Gesture:DoubleTap"), data));
 }
 
 void
 APZCCallbackHandler::HandleSingleTap(const CSSPoint& aPoint,
                                      int32_t aModifiers,
                                      const mozilla::layers::ScrollableLayerGuid& aGuid)
 {
     // FIXME Send the modifier data to Gecko for use in mouse events.
-    nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", aPoint.x, aPoint.y);
+    CSSIntPoint point = RoundedToInt(aPoint);
+    nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", point.x, point.y);
     nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeBroadcastEvent(
             NS_LITERAL_CSTRING("Gesture:SingleTap"), data));
 }
 
 void
 APZCCallbackHandler::HandleLongTap(const CSSPoint& aPoint,
                                    int32_t aModifiers,
                                    const mozilla::layers::ScrollableLayerGuid& aGuid)
 {
     // TODO send content response back to APZC
-    nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", aPoint.x, aPoint.y);
+    CSSIntPoint point = RoundedToInt(aPoint);
+    nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", point.x, point.y);
     nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeBroadcastEvent(
             NS_LITERAL_CSTRING("Gesture:LongPress"), data));
 }
 
 void
 APZCCallbackHandler::HandleLongTapUp(const CSSPoint& aPoint,
                                      int32_t aModifiers,
                                      const mozilla::layers::ScrollableLayerGuid& aGuid)