[webkit-changes] [WebKit/WebKit] c8e664: viewTransitionNewPseudoForCapturedElement iterates...

mattwoodrow noreply at github.com
Sat Nov 9 22:57:24 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c8e664c1689c9fead17c1c4cfa7b3a09621db0e6
      https://github.com/WebKit/WebKit/commit/c8e664c1689c9fead17c1c4cfa7b3a09621db0e6
  Author: Matt Woodrow <mattwoodrow at apple.com>
  Date:   2024-11-09 (Sat, 09 Nov 2024)

  Changed paths:
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/Element.h
    M Source/WebCore/dom/ElementRareData.cpp
    M Source/WebCore/dom/ElementRareData.h
    M Source/WebCore/dom/ViewTransition.cpp
    M Source/WebCore/style/Styleable.cpp
    M Source/WebCore/style/Styleable.h

  Log Message:
  -----------
  viewTransitionNewPseudoForCapturedElement iterates all names elements unnecessarily.
https://bugs.webkit.org/show_bug.cgi?id=282377
<rdar://138980780>

Reviewed by Tim Nguyen.

Both viewTransitionNewPseudoForCapturedElement and
Styleable::capturedInViewTransition do a linear search over the captured
element, since we can't retrieve the 'view-transition-name' property from style
as it might have changed since the transition started.

Fix this by storing the name that we used for capturing on ElementRareData
(possibly indexed by pseudo element identifier, if relevant). This then becomes
the canonical state for 'captured in a view transition', though we still have
the bit set on RenderObject for fast lookups.

If the renderer gets recreated, then RenderElement::initializeStyle uses
Styleable::capturedInViewTransition to re-initialize the bit, which is now fast.

viewTransitionNewPseudoForCapturedElement can directly lookup the name, and then
do a fast lookup using a different styleable for the appropriate pseudo element.

* Source/WebCore/dom/Element.cpp:
(WebCore::Element::viewTransitionCapturedName const):
(WebCore::Element::setViewTransitionCapturedName):
* Source/WebCore/dom/Element.h:
* Source/WebCore/dom/ElementRareData.cpp:
* Source/WebCore/dom/ElementRareData.h:
(WebCore::ElementRareData::viewTransitionCapturedName const):
(WebCore::ElementRareData::setViewTransitionCapturedName):
* Source/WebCore/dom/ViewTransition.cpp:
(WebCore::ViewTransition::activateViewTransition):
(WebCore::ViewTransition::clearViewTransition):
(WebCore::ViewTransition::viewTransitionNewPseudoForCapturedElement):
* Source/WebCore/style/Styleable.cpp:
(WebCore::Styleable::capturedInViewTransition const):
(WebCore::Styleable::setCapturedInViewTransition):
* Source/WebCore/style/Styleable.h:

Canonical link: https://commits.webkit.org/286400@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