[webkit-changes] [WebKit/WebKit] 8141e2: [popover] Cache auto popover list to avoid unneces...

Tim Nguyen noreply at github.com
Thu Jun 1 15:29:56 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8141e23838a14f06695a9e7c94c326ca0ceb3c70
      https://github.com/WebKit/WebKit/commit/8141e23838a14f06695a9e7c94c326ca0ceb3c70
  Author: Tim Nguyen <ntim at apple.com>
  Date:   2023-06-01 (Thu, 01 Jun 2023)

  Changed paths:
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/html/HTMLElement.cpp

  Log Message:
  -----------
  [popover] Cache auto popover list to avoid unnecessarily iterating the top layer
https://bugs.webkit.org/show_bug.cgi?id=257427
rdar://109932621

Reviewed by Ryosuke Niwa.

hideAllPopoversUntil calls autoPopoverList() and topmostAutoPopover() multiple times, which iterates through the top layer
multiple times. Store another ListHashSet which is a subset of topLayerElements(). Additions/removals are done at the same time
as adding/removing to the top layer, which prevents leaks.

* Source/WebCore/dom/Document.cpp:
(WebCore::Document::addTopLayerElement):
(WebCore::Document::removeTopLayerElement):
(WebCore::Document::topmostAutoPopover const):
(WebCore::Document::hideAllPopoversUntil):
(WebCore::Document::handlePopoverLightDismiss):
* Source/WebCore/dom/Document.h:
(WebCore::Document::autoPopoverList const):
* Source/WebCore/html/HTMLElement.cpp:
(WebCore::topmostPopoverAncestor):

Canonical link: https://commits.webkit.org/264810@main




More information about the webkit-changes mailing list