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

  Changed paths:
    M Source/WebCore/style/ElementRuleCollector.cpp
    M Source/WebCore/style/ElementRuleCollector.h

  Log Message:
  -----------
  Avoid unnecessary RefPtr copy in ElementRuleCollector::ruleMatches
https://bugs.webkit.org/show_bug.cgi?id=311341

Reviewed by Darin Adler.

`ruleMatches()` was taking `std::optional<ScopingRootWithDistance>` by value,
which copies the `RefPtr<const ContainerNode>` inside and bumps its refcount
on every call through the `@scope` path. Change the parameter to a raw
const pointer to avoid the copy.

* Source/WebCore/style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::ruleMatches):
(WebCore::Style::ElementRuleCollector::collectMatchingRulesForListSlow):
* Source/WebCore/style/ElementRuleCollector.h:
(WebCore::Style::ElementRuleCollector::ruleMatches): Deleted.

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



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

Reply via email to