[webkit-changes] [WebKit/WebKit] 4a0a44: [view-transitions] Resolving styles with a large s...

mattwoodrow noreply at github.com
Wed May 29 18:07:53 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4a0a4473f9267a3fe5de4d7de102e1bb68140170
      https://github.com/WebKit/WebKit/commit/4a0a4473f9267a3fe5de4d7de102e1bb68140170
  Author: Matt Woodrow <mattwoodrow at apple.com>
  Date:   2024-05-29 (Wed, 29 May 2024)

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

  Log Message:
  -----------
  [view-transitions] Resolving styles with a large set of named view-transition elements is slow.
https://bugs.webkit.org/show_bug.cgi?id=274739
<rdar://128774070>

Reviewed by Antti Koivisto.

For every named element in a view transition, 4 styles are inserted in the UA style sheet.

View transitions currently restyle the entire view transition pseudo tree for changes to any of
them (since mutations are keyed to the owning element, which is the document element for the whole tree).

There are 4 named pseudo elements per view transition name, resulting in pretty slow O(n^2) restyling.

We can improve this somewhat by putting pseudo element selectors with a name argument (like
::view-transition-group(name)) into a hash map, so that we only need to iterate the somewhat-relevant ones.

* Source/WebCore/style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::collectMatchingRules):
* Source/WebCore/style/RuleSet.cpp:
(WebCore::Style::RuleSet::addRule):
(WebCore::Style::RuleSet::traverseRuleDatas):
(WebCore::Style::RuleSet::shrinkToFit):
* Source/WebCore/style/RuleSet.h:
(WebCore::Style::RuleSet::namedPseudoElementRules const):

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



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


More information about the webkit-changes mailing list