[webkit-changes] [WebKit/WebKit] 66eb8a: [CSSTransition] Do not list up all properties for ...

Yusuke Suzuki noreply at github.com
Mon Sep 25 14:42:25 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 66eb8a0eb60e88dc4a31d1ee690e7fe132267708
      https://github.com/WebKit/WebKit/commit/66eb8a0eb60e88dc4a31d1ee690e7fe132267708
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-09-25 (Mon, 25 Sep 2023)

  Changed paths:
    M Source/WebCore/animation/CSSPropertyAnimation.cpp
    M Source/WebCore/animation/WebAnimationTypes.h
    M Source/WebCore/css/CSSProperty.h
    M Source/WebCore/css/process-css-properties.py
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/Element.h
    M Source/WebCore/rendering/style/RenderStyle.cpp
    M Source/WebCore/rendering/style/RenderStyle.h
    M Source/WebCore/rendering/style/SVGRenderStyle.cpp
    M Source/WebCore/rendering/style/SVGRenderStyle.h
    M Source/WebCore/style/Styleable.cpp

  Log Message:
  -----------
  [CSSTransition] Do not list up all properties for transition: all
https://bugs.webkit.org/show_bug.cgi?id=261917
rdar://115861030

Reviewed by Antti Koivisto.

When `transition: all ...` CSS rule is applied, we end up listing all animatable properties.
This is incredibly costly since there are so many CSS properties. And all properties are queried,
checked equality via very slow virtual function. Many hash table lookups etc.
We found that we are using massive amount of time in this transitioning in Speedometer3/NewsSite-Next / NewsSite-Nuxt.

But in almost all cases, almost all properties are not related at all.

In this patch, we do RenderStyle comparison and collect all affected CSS properties candidate which needs to be visited in
updateCSSTransitions. We can conservatively say "this property needs to be visited". But if we know that this
is totally equal, then we can skip that.

We cannot use RenderStyle::diff for this purpose. It is highly tailored to rendering purpose. And a lof of
properties changes are not reported when it is unrelated to layout (but it is necessary for updateCSSTransitions).
Example is `top` / `left`. So instead, we have more tailored path collecting necessary properties in this patch.

With this patch, we always collect all possible affected properties. So we no longer need to list up all animatable properties.
It results in 0.7% progression in Speedometer3.

* Source/WebCore/dom/Element.cpp:
(WebCore::Element::hasAnimations const):
* Source/WebCore/dom/Element.h:
* Source/WebCore/dom/ElementRareData.h:
(WebCore::ElementRareData::hasAnimations const):
* Source/WebCore/style/Styleable.cpp:
(WebCore::Styleable::updateCSSTransitions const):

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




More information about the webkit-changes mailing list