Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 42f0125d23cb7bedc71515cbe1889213e667f226
      
https://github.com/WebKit/WebKit/commit/42f0125d23cb7bedc71515cbe1889213e667f226
  Author: Chris Dumez <[email protected]>
  Date:   2026-04-02 (Thu, 02 Apr 2026)

  Changed paths:
    M Source/WebCore/css/CSSSelectorList.cpp

  Log Message:
  -----------
  Avoid redundant traversal in CSSSelectorList::hasExplicitNestingParent()
https://bugs.webkit.org/show_bug.cgi?id=311313

Reviewed by Ryosuke Niwa.

forEachTagSelector already recursively visits every simple selector in
the tree, including nested selector lists. The functor was calling
`CSSSelector::hasExplicitNestingParent()` on each one, which itself
re-walks the tree via `visitSimpleSelectors()` — making this O(N²).

Check the match type directly in the functor instead, reducing this
to a single O(N) pass.

* Source/WebCore/css/CSSSelectorList.cpp:
(WebCore::CSSSelectorList::hasExplicitNestingParent const):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to