mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
Bug 937343: Remove unchanged touches from touch event sent to RenderFrameParent r=kats
This commit is contained in:
parent
a7d61c82fe
commit
931a473345
@ -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*
|
||||
|
Loading…
Reference in New Issue
Block a user