Title: [245196] trunk/Source/WebKit
Revision
245196
Author
[email protected]
Date
2019-05-10 14:28:06 -0700 (Fri, 10 May 2019)

Log Message

Streamline test-and-clear operation for ContextMenu
https://bugs.webkit.org/show_bug.cgi?id=197795
<rdar://problem/50473746>

Reviewed by Wenson Hsieh.

Rather than performing a check when entering the function, doing work,
then clearing the member variable, perform the check and clear in
a single operation. Only perform the selection if the menu exists.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didSelectItemFromActiveContextMenu):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (245195 => 245196)


--- trunk/Source/WebKit/ChangeLog	2019-05-10 20:52:32 UTC (rev 245195)
+++ trunk/Source/WebKit/ChangeLog	2019-05-10 21:28:06 UTC (rev 245196)
@@ -1,3 +1,18 @@
+2019-05-10  Brent Fulgham  <[email protected]>
+
+        Streamline test-and-clear operation for ContextMenu
+        https://bugs.webkit.org/show_bug.cgi?id=197795
+        <rdar://problem/50473746>
+
+        Reviewed by Wenson Hsieh.
+
+        Rather than performing a check when entering the function, doing work,
+        then clearing the member variable, perform the check and clear in
+        a single operation. Only perform the selection if the menu exists.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::didSelectItemFromActiveContextMenu):
+
 2019-05-10  Megan Gardner  <[email protected]>
 
         Returning incorrect marked text rects

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (245195 => 245196)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-05-10 20:52:32 UTC (rev 245195)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-05-10 21:28:06 UTC (rev 245196)
@@ -4236,11 +4236,8 @@
 #if ENABLE(CONTEXT_MENUS)
 void WebPage::didSelectItemFromActiveContextMenu(const WebContextMenuItemData& item)
 {
-    if (!m_contextMenu)
-        return;
-
-    m_contextMenu->itemSelected(item);
-    m_contextMenu = nullptr;
+    if (auto contextMenu = std::exchange(m_contextMenu, nullptr))
+        contextMenu->itemSelected(item);
 }
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to