REGRESSION: Safari navigates after a cancelled force click
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Aug 2015 21:51:12 +0000 (21:51 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Aug 2015 21:51:12 +0000 (21:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148491
-and corresponding-
rdar://problem/22394323

Reviewed by Tim Horton.

Source/WebCore:

This regression was introduced on El Capitan because AppKit sends ‘cancel’ to
gesture recognizer BEFORE it sends the mouseUp. So the ImmediateActionStage needs
to track whether a cancel happened after updates or without any updates since they
signify different things.

Don’t perform default behaviors when the stage is ActionCancelledAfterUpdate.
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMouseReleaseEvent):

New possible stages, and new getter for the current stage.
* page/EventHandler.h:
(WebCore::EventHandler::immediateActionStage):

Source/WebKit/mac:

Use the current stage to determine which type of cancel this is.
* WebView/WebImmediateActionController.mm:
(-[WebImmediateActionController immediateActionRecognizerDidCancelAnimation:]):

Source/WebKit2:

Use the current stage to determine which type of cancel this is.
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::immediateActionDidCancel):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188990 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/EventHandler.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebImmediateActionController.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm

index 00a4578..84817bc 100644 (file)
@@ -1,3 +1,25 @@
+2015-08-26  Beth Dakin  <bdakin@apple.com>
+
+        REGRESSION: Safari navigates after a cancelled force click
+        https://bugs.webkit.org/show_bug.cgi?id=148491
+        -and corresponding-
+        rdar://problem/22394323
+
+        Reviewed by Tim Horton.
+
+        This regression was introduced on El Capitan because AppKit sends ‘cancel’ to 
+        gesture recognizer BEFORE it sends the mouseUp. So the ImmediateActionStage needs 
+        to track whether a cancel happened after updates or without any updates since they 
+        signify different things. 
+
+        Don’t perform default behaviors when the stage is ActionCancelledAfterUpdate.
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleMouseReleaseEvent):
+
+        New possible stages, and new getter for the current stage.
+        * page/EventHandler.h:
+        (WebCore::EventHandler::immediateActionStage):
+
 2015-08-26  Anders Carlsson  <andersca@apple.com>
 
         Fix failing tests.
index a4218d4..96012dd 100644 (file)
@@ -2101,7 +2101,7 @@ bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& platformMou
 
     // If an immediate action began or was completed using this series of mouse events, then we should send mouseup to
     // the DOM and return now so that we don't perform our own default behaviors.
-    if (m_immediateActionStage == ImmediateActionStage::ActionCompleted || m_immediateActionStage == ImmediateActionStage::ActionUpdated) {
+    if (m_immediateActionStage == ImmediateActionStage::ActionCompleted || m_immediateActionStage == ImmediateActionStage::ActionUpdated || m_immediateActionStage == ImmediateActionStage::ActionCancelledAfterUpdate) {
         m_immediateActionStage = ImmediateActionStage::None;
         return !dispatchMouseEvent(eventNames().mouseupEvent, m_lastElementUnderMouse.get(), true, m_clickCount, platformMouseEvent, false);
     }
index e5f5f9d..00de448 100644 (file)
@@ -121,7 +121,8 @@ enum class ImmediateActionStage {
     None,
     PerformedHitTest,
     ActionUpdated,
-    ActionCancelled,
+    ActionCancelledWithoutUpdate,
+    ActionCancelledAfterUpdate,
     ActionCompleted
 };
 
@@ -313,6 +314,7 @@ public:
     bool isHandlingWheelEvent() const { return m_isHandlingWheelEvent; }
 
     WEBCORE_EXPORT void setImmediateActionStage(ImmediateActionStage stage);
+    WEBCORE_EXPORT ImmediateActionStage immediateActionStage() const { return m_immediateActionStage; }
 
 private:
 #if ENABLE(DRAG_SUPPORT)
index f2ea606..24ebaf3 100644 (file)
@@ -1,3 +1,16 @@
+2015-08-26  Beth Dakin  <bdakin@apple.com>
+
+        REGRESSION: Safari navigates after a cancelled force click
+        https://bugs.webkit.org/show_bug.cgi?id=148491
+        -and corresponding-
+        rdar://problem/22394323
+
+        Reviewed by Tim Horton.
+
+        Use the current stage to determine which type of cancel this is.
+        * WebView/WebImmediateActionController.mm:
+        (-[WebImmediateActionController immediateActionRecognizerDidCancelAnimation:]):
+
 2015-08-26  Tim Horton  <timothy_horton@apple.com>
 
         Layout Test platform/mac/fast/events/content-inset-hit-testing-in-frame.html is flaky
index cdaff5a..1474b35 100644 (file)
@@ -210,8 +210,13 @@ using namespace WebCore;
         return;
 
     Frame* coreFrame = core([[[[_webView _selectedOrMainFrame] frameView] documentView] _frame]);
-    if (coreFrame)
-        coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::ActionCancelled);
+    if (coreFrame) {
+        ImmediateActionStage lastStage = coreFrame->eventHandler().immediateActionStage();
+        if (lastStage == ImmediateActionStage::ActionUpdated)
+            coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::ActionCancelledAfterUpdate);
+        else
+            coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::ActionCancelledWithoutUpdate);
+    }
 
     [_webView _setTextIndicatorAnimationProgress:0];
     [self _clearImmediateActionState];
index c4506c8..0384925 100644 (file)
@@ -1,3 +1,16 @@
+2015-08-26  Beth Dakin  <bdakin@apple.com>
+
+        REGRESSION: Safari navigates after a cancelled force click
+        https://bugs.webkit.org/show_bug.cgi?id=148491
+        -and corresponding-
+        rdar://problem/22394323
+
+        Reviewed by Tim Horton.
+
+        Use the current stage to determine which type of cancel this is.
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::immediateActionDidCancel):
+
 2015-08-26  Eric Carlson  <eric.carlson@apple.com>
 
         Media Session: make MediaSessionMetadata a class
index 5fff682..7c72444 100644 (file)
@@ -1208,7 +1208,11 @@ void WebPage::immediateActionDidUpdate()
 
 void WebPage::immediateActionDidCancel()
 {
-    m_page->mainFrame().eventHandler().setImmediateActionStage(ImmediateActionStage::ActionCancelled);
+    ImmediateActionStage lastStage = m_page->mainFrame().eventHandler().immediateActionStage();
+    if (lastStage == ImmediateActionStage::ActionUpdated)
+        m_page->mainFrame().eventHandler().setImmediateActionStage(ImmediateActionStage::ActionCancelledAfterUpdate);
+    else
+        m_page->mainFrame().eventHandler().setImmediateActionStage(ImmediateActionStage::ActionCancelledWithoutUpdate);
 }
 
 void WebPage::immediateActionDidComplete()