[webkit-changes] [WebKit/WebKit] 7fd077: [WebAnimation] Optimize updateCSSTransitions
Yusuke Suzuki
noreply at github.com
Tue Sep 19 01:30:41 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7fd07749f8f7e25ed38999bcd1f91505f9b3d472
https://github.com/WebKit/WebKit/commit/7fd07749f8f7e25ed38999bcd1f91505f9b3d472
Author: Yusuke Suzuki <ysuzuki at apple.com>
Date: 2023-09-19 (Tue, 19 Sep 2023)
Changed paths:
M Source/WebCore/animation/CSSPropertyAnimation.cpp
M Source/WebCore/animation/CSSPropertyAnimation.h
M Source/WebCore/animation/CSSTransition.cpp
M Source/WebCore/animation/CSSTransition.h
M Source/WebCore/animation/KeyframeEffect.cpp
M Source/WebCore/animation/KeyframeEffect.h
M Source/WebCore/dom/Element.cpp
M Source/WebCore/dom/Element.h
M Source/WebCore/rendering/style/KeyframeList.cpp
M Source/WebCore/rendering/style/KeyframeList.h
M Source/WebCore/style/Styleable.cpp
M Source/WebCore/style/Styleable.h
Log Message:
-----------
[WebAnimation] Optimize updateCSSTransitions
https://bugs.webkit.org/show_bug.cgi?id=261715
rdar://115703255
Reviewed by Mark Lam.
WebAnimation's updateCSSTransitions is inefficient,
1. We are repeatedly copying AnimationProperty while it is held. This is appearing much in the profiler.
Let's not copy them. We use `const AnimationProperty&`. This is OK since
1.1. updateCSSTransitionsForStyleableAndProperty's owner is holding this ownership. Reference is always valid.
1.2. Other change immediately copies or uses switchOn to dispatch. So this is fine.
2. Avoid repeated call of `styleable.hasRunningTransitionForProperty` etc. This is really costly function since
it involves HashMap lookup. We reorganize updateCSSTransitionsForStyleableAndProperty not to do wasteful
operations multiple times.
* Source/WebCore/animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyBlendingContext::CSSPropertyBlendingContext):
(WebCore::CSSPropertyAnimation::blendProperty):
(WebCore::CSSPropertyAnimation::isPropertyAnimatable):
(WebCore::CSSPropertyAnimation::isPropertyAdditiveOrCumulative):
(WebCore::CSSPropertyAnimation::propertyRequiresBlendingForAccumulativeIteration):
(WebCore::CSSPropertyAnimation::animationOfPropertyIsAccelerated):
(WebCore::CSSPropertyAnimation::propertiesEqual):
(WebCore::CSSPropertyAnimation::canPropertyBeInterpolated):
* Source/WebCore/animation/CSSPropertyAnimation.h:
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::hasCompletedTransitionForProperty const):
(WebCore::Element::hasRunningTransitionForProperty const):
* Source/WebCore/dom/Element.h:
* Source/WebCore/style/Styleable.cpp:
(WebCore::keyframeEffectForElementAndProperty):
(WebCore::propertyInStyleMatchesValueForTransitionInMap):
(WebCore::transitionMatchesProperty):
(WebCore::updateCSSTransitionsForStyleableAndProperty):
(WebCore::Styleable::updateCSSTransitions const):
* Source/WebCore/style/Styleable.h:
(WebCore::Styleable::hasCompletedTransitionForProperty const):
(WebCore::Styleable::hasRunningTransitionForProperty const):
Canonical link: https://commits.webkit.org/268113@main
More information about the webkit-changes
mailing list