0

[WebAnimation] Optimize updateCSSTransitions by Constellation · Pull Request #17...

 4 weeks ago
source link: https://github.com/WebKit/WebKit/pull/17897
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Member

@Constellation Constellation

commented

Sep 19, 2023

edited by webkit-early-warning-system

7fd0774

[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

bdc2485


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK