Bug 937343: Remove unchanged touches from touch event sent to RenderFrameParent r=kats

This commit is contained in:
Doug Sherk 2014-01-27 17:41:12 +00:00
parent f21220320e
commit 0d2f93f21a

View File

@ -682,12 +682,12 @@ bool TabParent::SendRealMouseEvent(WidgetMouseEvent& event)
if (mIsDestroyed) {
return false;
}
WidgetMouseEvent e(event);
MaybeForwardEventToRenderFrame(event, nullptr, &e);
if (!MapEventCoordinatesForChildProcess(&e)) {
WidgetMouseEvent outEvent(event);
MaybeForwardEventToRenderFrame(event, nullptr, &outEvent);
if (!MapEventCoordinatesForChildProcess(&outEvent)) {
return false;
}
return PBrowserParent::SendRealMouseEvent(e);
return PBrowserParent::SendRealMouseEvent(outEvent);
}
CSSIntPoint TabParent::AdjustTapToChildWidget(const CSSIntPoint& aPoint)
@ -750,9 +750,9 @@ bool TabParent::SendMouseWheelEvent(WidgetWheelEvent& event)
if (mIsDestroyed) {
return false;
}
WidgetWheelEvent e(event);
MaybeForwardEventToRenderFrame(event, nullptr, &e);
if (!MapEventCoordinatesForChildProcess(&e)) {
WidgetWheelEvent outEvent(event);
MaybeForwardEventToRenderFrame(event, nullptr, &outEvent);
if (!MapEventCoordinatesForChildProcess(&outEvent)) {
return false;
}
return PBrowserParent::SendMouseWheelEvent(event);
@ -763,12 +763,12 @@ bool TabParent::SendRealKeyEvent(WidgetKeyboardEvent& event)
if (mIsDestroyed) {
return false;
}
WidgetKeyboardEvent e(event);
MaybeForwardEventToRenderFrame(event, nullptr, &e);
if (!MapEventCoordinatesForChildProcess(&e)) {
WidgetKeyboardEvent outEvent(event);
MaybeForwardEventToRenderFrame(event, nullptr, &outEvent);
if (!MapEventCoordinatesForChildProcess(&outEvent)) {
return false;
}
return PBrowserParent::SendRealKeyEvent(e);
return PBrowserParent::SendRealKeyEvent(outEvent);
}
bool TabParent::SendRealTouchEvent(WidgetTouchEvent& event)
@ -797,30 +797,36 @@ bool TabParent::SendRealTouchEvent(WidgetTouchEvent& event)
++mEventCaptureDepth;
}
WidgetTouchEvent e(event);
// PresShell::HandleEventInternal adds touches on touch end/cancel.
// This confuses remote content into thinking that the added touches
// are part of the touchend/cancel, when actually they're not.
// PresShell::HandleEventInternal adds touches on touch end/cancel. This
// confuses remote content and the panning and zooming logic into thinking
// that the added touches are part of the touchend/cancel, when actually
// they're not.
if (event.message == NS_TOUCH_END || event.message == NS_TOUCH_CANCEL) {
for (int i = e.touches.Length() - 1; i >= 0; i--) {
if (!e.touches[i]->mChanged) {
e.touches.RemoveElementAt(i);
for (int i = event.touches.Length() - 1; i >= 0; i--) {
if (!event.touches[i]->mChanged) {
event.touches.RemoveElementAt(i);
}
}
}
// Create an out event for remote content that is identical to the event that
// we send to the render frame. The out event will be transformed in such a
// way that its async transform in the compositor is unapplied. The event that
// it is created from does not get mutated.
WidgetTouchEvent outEvent(event);
ScrollableLayerGuid guid;
MaybeForwardEventToRenderFrame(event, &guid, &e);
MaybeForwardEventToRenderFrame(event, &guid, &outEvent);
if (mIsDestroyed) {
return false;
}
MapEventCoordinatesForChildProcess(mChildProcessOffsetAtTouchStart, &e);
MapEventCoordinatesForChildProcess(mChildProcessOffsetAtTouchStart, &outEvent);
return (e.message == NS_TOUCH_MOVE) ?
PBrowserParent::SendRealTouchMoveEvent(e, guid) :
PBrowserParent::SendRealTouchEvent(e, guid);
return (outEvent.message == NS_TOUCH_MOVE) ?
PBrowserParent::SendRealTouchMoveEvent(outEvent, guid) :
PBrowserParent::SendRealTouchEvent(outEvent, guid);
}
/*static*/ TabParent*