Title: [176883] trunk/Source/WebKit2
Revision
176883
Author
[email protected]
Date
2014-12-05 15:59:18 -0800 (Fri, 05 Dec 2014)

Log Message

If the action menu hit test times out, a menu with a single separator appears
https://bugs.webkit.org/show_bug.cgi?id=139320
<rdar://problem/19158331>

Reviewed by Beth Dakin.

* UIProcess/mac/WKActionMenuController.h:
* UIProcess/mac/WKActionMenuController.mm:
(-[WKActionMenuController menuNeedsUpdate:]):
(-[WKActionMenuController _defaultMenuItems]):
Add a new "TimedOut" state, which we get into if the sync wait for
didPerformActionMenuHitTest times out. In this case, we'll drop the
separator item and give up on the menu. This way, the menu will never
have just a single separator item at the end of menuNeedsUpdate:.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (176882 => 176883)


--- trunk/Source/WebKit2/ChangeLog	2014-12-05 23:56:20 UTC (rev 176882)
+++ trunk/Source/WebKit2/ChangeLog	2014-12-05 23:59:18 UTC (rev 176883)
@@ -1,3 +1,20 @@
+2014-12-05  Tim Horton  <[email protected]>
+
+        If the action menu hit test times out, a menu with a single separator appears
+        https://bugs.webkit.org/show_bug.cgi?id=139320
+        <rdar://problem/19158331>
+
+        Reviewed by Beth Dakin.
+
+        * UIProcess/mac/WKActionMenuController.h:
+        * UIProcess/mac/WKActionMenuController.mm:
+        (-[WKActionMenuController menuNeedsUpdate:]):
+        (-[WKActionMenuController _defaultMenuItems]):
+        Add a new "TimedOut" state, which we get into if the sync wait for
+        didPerformActionMenuHitTest times out. In this case, we'll drop the
+        separator item and give up on the menu. This way, the menu will never
+        have just a single separator item at the end of menuNeedsUpdate:.
+
 2014-12-05  Mark Lam  <[email protected]>
 
         Gardening: speculative build fix for GTK builds.

Modified: trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.h (176882 => 176883)


--- trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.h	2014-12-05 23:56:20 UTC (rev 176882)
+++ trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.h	2014-12-05 23:59:18 UTC (rev 176883)
@@ -40,6 +40,7 @@
 enum class ActionMenuState {
     None = 0,
     Pending,
+    TimedOut,
     Ready
 };
 }

Modified: trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (176882 => 176883)


--- trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2014-12-05 23:56:20 UTC (rev 176882)
+++ trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2014-12-05 23:59:18 UTC (rev 176883)
@@ -889,8 +889,11 @@
     // FIXME: We need to be able to cancel this if the menu goes away.
     // FIXME: Connection can be null if the process is closed; we should clean up better in that case.
     if (_state == ActionMenuState::Pending) {
-        if (auto* connection = _page->process().connection())
-            connection->waitForAndDispatchImmediately<Messages::WebPageProxy::DidPerformActionMenuHitTest>(_page->pageID(), std::chrono::milliseconds(500));
+        if (auto* connection = _page->process().connection()) {
+            bool receivedReply = connection->waitForAndDispatchImmediately<Messages::WebPageProxy::DidPerformActionMenuHitTest>(_page->pageID(), std::chrono::milliseconds(500));
+            if (!receivedReply)
+                _state = ActionMenuState::TimedOut;
+        }
     }
 
     if (_state != ActionMenuState::Ready)
@@ -1093,7 +1096,7 @@
     RefPtr<WebHitTestResult> hitTestResult = [self _webHitTestResult];
     if (!hitTestResult) {
         _type = kWKActionMenuNone;
-        return _state != ActionMenuState::Ready ? @[ [NSMenuItem separatorItem] ] : @[ ];
+        return _state == ActionMenuState::Pending ? @[ [NSMenuItem separatorItem] ] : @[ ];
     }
 
     String absoluteLinkURL = hitTestResult->absoluteLinkURL();
@@ -1164,7 +1167,7 @@
     }
 
     _type = kWKActionMenuNone;
-    return _state != ActionMenuState::Ready ? @[ [NSMenuItem separatorItem] ] : @[ ];
+    return _state == ActionMenuState::Pending ? @[ [NSMenuItem separatorItem] ] : @[ ];
 }
 
 - (void)_updateActionMenuItems
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to