⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 245196 in webkit


Ignore:
Timestamp:
May 10, 2019, 2:28:06 PM (7 years ago)
Author:
Brent Fulgham
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):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r245195 r245196  
     12019-05-10  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Streamline test-and-clear operation for ContextMenu
     4        https://bugs.webkit.org/show_bug.cgi?id=197795
     5        <rdar://problem/50473746>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        Rather than performing a check when entering the function, doing work,
     10        then clearing the member variable, perform the check and clear in
     11        a single operation. Only perform the selection if the menu exists.
     12
     13        * WebProcess/WebPage/WebPage.cpp:
     14        (WebKit::WebPage::didSelectItemFromActiveContextMenu):
     15
    1162019-05-10  Megan Gardner  <megan_gardner@apple.com>
    217
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r245187 r245196  
    42374237void WebPage::didSelectItemFromActiveContextMenu(const WebContextMenuItemData& item)
    42384238{
    4239     if (!m_contextMenu)
    4240         return;
    4241 
    4242     m_contextMenu->itemSelected(item);
    4243     m_contextMenu = nullptr;
     4239    if (auto contextMenu = std::exchange(m_contextMenu, nullptr))
     4240        contextMenu->itemSelected(item);
    42444241}
    42454242#endif
Note: See TracChangeset for help on using the changeset viewer.