From c474aee93bb9b8a02466a8c623654a4baaaa2249 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Thu, 24 Jul 2014 07:57:53 -0400 Subject: [PATCH] Bug 1043022 - Back out bug 1016481 for making it hard to click things in the browser. r=me --- dom/events/test/test_bug603008.html | 2 +- dom/ipc/TabChild.cpp | 20 +++----------------- dom/ipc/TabChild.h | 7 ------- layout/base/nsPresShell.cpp | 8 +++----- 4 files changed, 7 insertions(+), 30 deletions(-) diff --git a/dom/events/test/test_bug603008.html b/dom/events/test/test_bug603008.html index 077560e5766..d758f0f07fe 100644 --- a/dom/events/test/test_bug603008.html +++ b/dom/events/test/test_bug603008.html @@ -427,7 +427,7 @@ function testPreventDefault() { [{ name: "touchstart", prevent: false }, { name: "touchmove", prevent: false }, { name: "touchmove", prevent: false }, - { name: "touchend", prevent: true, doPrevent: true }] + { name: "touchend", prevent: false, doPrevent: true }] ]; var dotest = function(aTest) { diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 14cd782aa1c..8a6c2d09c62 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -729,7 +729,6 @@ TabChild::TabChild(nsIContentChild* aManager, const TabContext& aContext, uint32 , mOrientation(eScreenOrientation_PortraitPrimary) , mUpdateHitRegion(false) , mPendingTouchPreventedResponse(false) - , mTouchEndIsClick(Unknown) , mIgnoreKeyPressEvent(false) , mActiveElementManager(new ActiveElementManager()) , mHasValidInnerSize(false) @@ -1816,10 +1815,6 @@ TabChild::RecvHandleSingleTap(const CSSPoint& aPoint, const ScrollableLayerGuid& return true; } - if (mTouchEndIsClick == IsNotClick) { - return true; - } - LayoutDevicePoint currentPoint = APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid) * mWidget->GetDefaultScale();; MessageLoop::current()->PostDelayedTask( @@ -1912,7 +1907,7 @@ TabChild::RecvNotifyAPZStateChange(const ViewID& aViewId, } case APZStateChange::EndTouch: { - mTouchEndIsClick = (aArg ? IsClick : IsNotClick); + mActiveElementManager->HandleTouchEnd(aArg); break; } default: @@ -2131,7 +2126,6 @@ TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent, localEvent.mFlags.mMultipleActionsPrevented; switch (aEvent.message) { case NS_TOUCH_START: { - mTouchEndIsClick = Unknown; 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. @@ -2147,17 +2141,9 @@ TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent, break; } + case NS_TOUCH_MOVE: case NS_TOUCH_END: - if (isTouchPrevented && mTouchEndIsClick == IsClick) { - mTouchEndIsClick = IsNotClick; - } - // fall through - case NS_TOUCH_CANCEL: - if (mTouchEndIsClick != Unknown) { - mActiveElementManager->HandleTouchEnd(mTouchEndIsClick == IsClick); - } - // fall through - case NS_TOUCH_MOVE: { + case NS_TOUCH_CANCEL: { SendPendingTouchPreventedResponse(isTouchPrevented, aGuid); break; } diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index f51d4712d44..430d9395b88 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -594,13 +594,6 @@ private: ScrollableLayerGuid mPendingTouchPreventedGuid; void FireSingleTapEvent(LayoutDevicePoint aPoint); - enum ClickState { - Unknown, - IsClick, - IsNotClick - }; - ClickState mTouchEndIsClick; - bool mIgnoreKeyPressEvent; nsRefPtr mActiveElementManager; bool mHasValidInnerSize; diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 98060602430..5d68c87110f 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -7844,11 +7844,9 @@ PresShell::DispatchTouchEvent(WidgetEvent* aEvent, bool aTouchIsNew) { // calling preventDefault on touchstart or the first touchmove for a - // 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); + // point prevents mouse events + bool canPrevent = aEvent->message == NS_TOUCH_START || + (aEvent->message == NS_TOUCH_MOVE && aTouchIsNew); bool preventDefault = false; nsEventStatus tmpStatus = nsEventStatus_eIgnore; WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();