Bug 1055548 - Round the APZ tap notifications to integer CSS pixels before sending to JS code. r=wesj

--HG--
extra : rebase_source : 8b8bdc94bedf21f45d9add82436fa98683b26a03
This commit is contained in:
Kartikaya Gupta 2014-08-26 12:45:04 -04:00
parent a2a79fb547
commit 1e66ae8973

View File

@ -122,7 +122,8 @@ 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));
}
@ -133,7 +134,8 @@ APZCCallbackHandler::HandleSingleTap(const CSSPoint& aPoint,
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));
}
@ -144,7 +146,8 @@ APZCCallbackHandler::HandleLongTap(const CSSPoint& aPoint,
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));
}