Title: [176480] trunk/Source/WebKit2
Revision
176480
Author
[email protected]
Date
2014-11-21 15:53:13 -0800 (Fri, 21 Nov 2014)

Log Message

REGRESSION (r176415): Can get stuck, unable to invoke any DataDetectors popovers
https://bugs.webkit.org/show_bug.cgi?id=138955
<rdar://problem/19056442>

Reviewed by Anders Carlsson.

* UIProcess/API/mac/WKView.mm:
(-[WKView mouseDown:]):
* UIProcess/mac/WKActionMenuController.h:
* UIProcess/mac/WKActionMenuController.mm:
(-[WKActionMenuController wkView:willHandleMouseDown:]):
(-[WKActionMenuController didCloseMenu:withEvent:]):
(-[WKActionMenuController menuNeedsUpdate:]):
Keep track of whether we have called shouldUseActionsWithContext: on a
DDActionContext; if we get a mouseDown without having seen didCloseMenu:
(and thus don't properly pair the shouldUseActionsWithContext: with a didUseActions),
tear down the old DDActionContext before proceeding.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (176479 => 176480)


--- trunk/Source/WebKit2/ChangeLog	2014-11-21 23:41:26 UTC (rev 176479)
+++ trunk/Source/WebKit2/ChangeLog	2014-11-21 23:53:13 UTC (rev 176480)
@@ -1,5 +1,25 @@
 2014-11-21  Tim Horton  <[email protected]>
 
+        REGRESSION (r176415): Can get stuck, unable to invoke any DataDetectors popovers
+        https://bugs.webkit.org/show_bug.cgi?id=138955
+        <rdar://problem/19056442>
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView mouseDown:]):
+        * UIProcess/mac/WKActionMenuController.h:
+        * UIProcess/mac/WKActionMenuController.mm:
+        (-[WKActionMenuController wkView:willHandleMouseDown:]):
+        (-[WKActionMenuController didCloseMenu:withEvent:]):
+        (-[WKActionMenuController menuNeedsUpdate:]):
+        Keep track of whether we have called shouldUseActionsWithContext: on a
+        DDActionContext; if we get a mouseDown without having seen didCloseMenu:
+        (and thus don't properly pair the shouldUseActionsWithContext: with a didUseActions),
+        tear down the old DDActionContext before proceeding.
+
+2014-11-21  Tim Horton  <[email protected]>
+
         REGRESSION (r176351): Parts of apple.com/contact aren't Lookup-able
         ​https://bugs.webkit.org/show_bug.cgi?id=138960
         <rdar://problem/19056715>

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (176479 => 176480)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2014-11-21 23:41:26 UTC (rev 176479)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2014-11-21 23:53:13 UTC (rev 176480)
@@ -1256,6 +1256,7 @@
 
     [self _setMouseDownEvent:event];
     _data->_ignoringMouseDraggedEvents = NO;
+    [_data->_actionMenuController wkView:self willHandleMouseDown:event];
     [self mouseDownInternal:event];
 }
 

Modified: trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.h (176479 => 176480)


--- trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.h	2014-11-21 23:41:26 UTC (rev 176479)
+++ trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.h	2014-11-21 23:53:13 UTC (rev 176480)
@@ -68,6 +68,7 @@
 
     BOOL _isShowingTextIndicator;
     BOOL _shouldKeepPreviewPopoverOpen;
+    BOOL _hasActivatedActionContext;
 
 #if WK_API_ENABLED
     RetainPtr<WKPagePreviewViewController> _previewViewController;
@@ -82,6 +83,7 @@
 - (void)prepareForMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
 - (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
 - (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
+- (void)wkView:(WKView *)wkView willHandleMouseDown:(NSEvent *)event;
 
 - (void)didPerformActionMenuHitTest:(const WebKit::ActionMenuHitTestResult&)hitTestResult userData:(API::Object*)userData;
 

Modified: trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (176479 => 176480)


--- trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2014-11-21 23:41:26 UTC (rev 176479)
+++ trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2014-11-21 23:53:13 UTC (rev 176480)
@@ -163,6 +163,14 @@
     _currentActionContext = nil;
 }
 
+- (void)wkView:(WKView *)wkView willHandleMouseDown:(NSEvent *)event
+{
+    if (_type == kWKActionMenuDataDetectedItem && _currentActionContext && _hasActivatedActionContext) {
+        [getDDActionsManagerClass() didUseActions];
+        _hasActivatedActionContext = NO;
+    }
+}
+
 - (void)prepareForMenu:(NSMenu *)menu withEvent:(NSEvent *)event
 {
     if (menu != _wkView.actionMenu)
@@ -232,9 +240,9 @@
     if (menu != _wkView.actionMenu)
         return;
 
-    if (_type == kWKActionMenuDataDetectedItem) {
-        if (_currentActionContext)
-            [getDDActionsManagerClass() didUseActions];
+    if (_type == kWKActionMenuDataDetectedItem && _currentActionContext && _hasActivatedActionContext) {
+        [getDDActionsManagerClass() didUseActions];
+        _hasActivatedActionContext = NO;
     }
 
     [_previewPopover setBehavior:NSPopoverBehaviorTransient];
@@ -779,9 +787,12 @@
     if (_state != ActionMenuState::Ready)
         [self _updateActionMenuItems];
 
-    if (_type == kWKActionMenuDataDetectedItem && _currentActionContext && ![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()]) {
-        [menu cancelTracking];
-        [menu removeAllItems];
+    if (_type == kWKActionMenuDataDetectedItem && _currentActionContext) {
+        _hasActivatedActionContext = YES;
+        if (![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()]) {
+            [menu cancelTracking];
+            [menu removeAllItems];
+        }
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to