mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1016481 - Allow touch-end events to be cancelled and have them prevent dispatching click events. r=smaug
This commit is contained in:
parent
d3b737e5a4
commit
103c4e7b33
@ -427,7 +427,7 @@ function testPreventDefault() {
|
||||
[{ name: "touchstart", prevent: false },
|
||||
{ name: "touchmove", prevent: false },
|
||||
{ name: "touchmove", prevent: false },
|
||||
{ name: "touchend", prevent: false, doPrevent: true }]
|
||||
{ name: "touchend", prevent: true, doPrevent: true }]
|
||||
];
|
||||
|
||||
var dotest = function(aTest) {
|
||||
|
@ -730,6 +730,7 @@ TabChild::TabChild(nsIContentChild* aManager, const TabContext& aContext, uint32
|
||||
, mOrientation(eScreenOrientation_PortraitPrimary)
|
||||
, mUpdateHitRegion(false)
|
||||
, mPendingTouchPreventedResponse(false)
|
||||
, mTouchEndCancelled(false)
|
||||
, mIgnoreKeyPressEvent(false)
|
||||
, mActiveElementManager(new ActiveElementManager())
|
||||
, mHasValidInnerSize(false)
|
||||
@ -1816,6 +1817,10 @@ TabChild::RecvHandleSingleTap(const CSSPoint& aPoint, const ScrollableLayerGuid&
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mTouchEndCancelled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
LayoutDevicePoint currentPoint = APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid) * mWidget->GetDefaultScale();;
|
||||
|
||||
MessageLoop::current()->PostDelayedTask(
|
||||
@ -2127,6 +2132,7 @@ TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
|
||||
localEvent.mFlags.mMultipleActionsPrevented;
|
||||
switch (aEvent.message) {
|
||||
case NS_TOUCH_START: {
|
||||
mTouchEndCancelled = false;
|
||||
if (mPendingTouchPreventedResponse) {
|
||||
// We can enter here if we get two TOUCH_STARTs in a row and didn't
|
||||
// respond to the first one. Respond to it now.
|
||||
@ -2142,9 +2148,13 @@ TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
|
||||
break;
|
||||
}
|
||||
|
||||
case NS_TOUCH_MOVE:
|
||||
case NS_TOUCH_END:
|
||||
case NS_TOUCH_CANCEL: {
|
||||
if (isTouchPrevented) {
|
||||
mTouchEndCancelled = true;
|
||||
}
|
||||
// fall through
|
||||
case NS_TOUCH_CANCEL:
|
||||
case NS_TOUCH_MOVE: {
|
||||
SendPendingTouchPreventedResponse(isTouchPrevented, aGuid);
|
||||
break;
|
||||
}
|
||||
|
@ -594,6 +594,8 @@ private:
|
||||
ScrollableLayerGuid mPendingTouchPreventedGuid;
|
||||
void FireSingleTapEvent(LayoutDevicePoint aPoint);
|
||||
|
||||
bool mTouchEndCancelled;
|
||||
|
||||
bool mIgnoreKeyPressEvent;
|
||||
nsRefPtr<ActiveElementManager> mActiveElementManager;
|
||||
bool mHasValidInnerSize;
|
||||
|
@ -7843,9 +7843,11 @@ PresShell::DispatchTouchEvent(WidgetEvent* aEvent,
|
||||
bool aTouchIsNew)
|
||||
{
|
||||
// calling preventDefault on touchstart or the first touchmove for a
|
||||
// point prevents mouse events
|
||||
bool canPrevent = aEvent->message == NS_TOUCH_START ||
|
||||
(aEvent->message == NS_TOUCH_MOVE && aTouchIsNew);
|
||||
// point prevents mouse events. calling it on the touchend should
|
||||
// prevent click dispatching.
|
||||
bool canPrevent = (aEvent->message == NS_TOUCH_START) ||
|
||||
(aEvent->message == NS_TOUCH_MOVE && aTouchIsNew) ||
|
||||
(aEvent->message == NS_TOUCH_END);
|
||||
bool preventDefault = false;
|
||||
nsEventStatus tmpStatus = nsEventStatus_eIgnore;
|
||||
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
|
||||
|
Loading…
Reference in New Issue
Block a user