Title: [176059] branches/safari-600.3-branch/Source/WebKit2
Revision
176059
Author
[email protected]
Date
2014-11-12 18:30:59 -0800 (Wed, 12 Nov 2014)

Log Message

Merged r176027. rdar://problems/18909111

Modified Paths

Diff

Modified: branches/safari-600.3-branch/Source/WebKit2/ChangeLog (176058 => 176059)


--- branches/safari-600.3-branch/Source/WebKit2/ChangeLog	2014-11-13 02:30:54 UTC (rev 176058)
+++ branches/safari-600.3-branch/Source/WebKit2/ChangeLog	2014-11-13 02:30:59 UTC (rev 176059)
@@ -1,3 +1,32 @@
+2014-11-12  Matthew Hanson  <[email protected]>
+
+        Merge r176027. <rdar://problem/18909111>
+
+    2014-11-12  Tim Horton  <[email protected]>
+
+            Make action menus much more reliable
+            https://bugs.webkit.org/show_bug.cgi?id=138654
+            <rdar://problem/18909111>
+
+            Reviewed by Anders Carlsson.
+
+            * UIProcess/mac/WKActionMenuController.mm:
+            (-[WKActionMenuController prepareForMenu:withEvent:]):
+            Remove MenuUpdateStage; nothing actually uses this value, we just pass it around.
+
+            (-[WKActionMenuController didPerformActionMenuHitTest:userData:]):
+            Update the menu as soon as we have a reply from the Web process.
+
+            (-[WKActionMenuController menuNeedsUpdate:]):
+            If our sync-wait for the Web process' reply times out, we should still update
+            the menu to remove the placeholder separator item.
+
+            (-[WKActionMenuController _updateActionMenuItems]):
+            (-[WKActionMenuController _updateActionMenuItemsForStage:]): Deleted.
+            If we have our final answer for this menu (_state == Ready), and the final answer
+            has no items in the menu, cancel tracking on the menu.
+
+
 2014-11-11  Tim Horton  <[email protected]>
 
         Add support for mailto: link action menus

Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (176058 => 176059)


--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2014-11-13 02:30:54 UTC (rev 176058)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2014-11-13 02:30:59 UTC (rev 176059)
@@ -51,11 +51,6 @@
 #import <WebCore/SoftLinking.h>
 #import <WebCore/URL.h>
 
-enum class MenuUpdateStage {
-    PrepareForMenu,
-    MenuNeedsUpdate
-};
-
 SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, ImageKit)
 SOFT_LINK_CLASS(ImageKit, IKSlideshow)
 
@@ -63,7 +58,7 @@
 using namespace WebKit;
 
 @interface WKActionMenuController () <NSSharingServiceDelegate, NSSharingServicePickerDelegate, NSPopoverDelegate>
-- (void)_updateActionMenuItemsForStage:(MenuUpdateStage)stage;
+- (void)_updateActionMenuItems;
 - (BOOL)_canAddMediaToPhotos;
 - (void)_showTextIndicator;
 - (void)_hideTextIndicator;
@@ -181,7 +176,7 @@
     _page->performActionMenuHitTestAtLocation([_wkView convertPoint:event.locationInWindow fromView:nil]);
 
     _state = ActionMenuState::Pending;
-    [self _updateActionMenuItemsForStage:MenuUpdateStage::PrepareForMenu];
+    [self _updateActionMenuItems];
 
     _shouldKeepPreviewPopoverOpen = NO;
 }
@@ -240,6 +235,8 @@
     _state = ActionMenuState::Ready;
     _hitTestResult = hitTestResult;
     _userData = userData;
+
+    [self _updateActionMenuItems];
 }
 
 - (void)dismissActionMenuPopovers
@@ -685,7 +682,8 @@
             connection->waitForAndDispatchImmediately<Messages::WebPageProxy::DidPerformActionMenuHitTest>(_page->pageID(), std::chrono::milliseconds(500));
     }
 
-    [self _updateActionMenuItemsForStage:MenuUpdateStage::MenuNeedsUpdate];
+    if (_state != ActionMenuState::Ready)
+        [self _updateActionMenuItems];
 }
 
 - (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item
@@ -909,7 +907,7 @@
     return _state != ActionMenuState::Ready ? @[ [NSMenuItem separatorItem] ] : @[ ];
 }
 
-- (void)_updateActionMenuItemsForStage:(MenuUpdateStage)stage
+- (void)_updateActionMenuItems
 {
     [_wkView.actionMenu removeAllItems];
 
@@ -923,6 +921,9 @@
 
     for (NSMenuItem *item in menuItems)
         [_wkView.actionMenu addItem:item];
+
+    if (_state == ActionMenuState::Ready && !_wkView.actionMenu.numberOfItems)
+        [_wkView.actionMenu cancelTracking];
 }
 
 #if WK_API_ENABLED
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to