Title: [258834] trunk/Source/WebCore
Revision
258834
Author
grao...@webkit.org
Date
2020-03-23 05:41:21 -0700 (Mon, 23 Mar 2020)

Log Message

[Web Animations] ElementAnimationRareData is created too frequently
https://bugs.webkit.org/show_bug.cgi?id=209415

Reviewed by Antti Koivisto.

The various accessors on Element to access transitions and animations will ensure there is a backing
ElementAnimationRareData object. However, in a lot of cases, such as when we consider whether CSS
Transitions should be created, updated or removed under AnimationTimeline::updateCSSTransitionsForElement(),
we end up not needing to actually access the data structures on ElementAnimationRareData.

We now make the various methods on Element to access transitions and animations `const T*` and add ensure*()
methods to access the collections for modification. We also add methods to query whether there are running or
completed transitions at all or for a given property.

No test because there is no change in visible behavior.

* animation/AnimationTimeline.cpp:
(WebCore::AnimationTimeline::animationWasAddedToElement):
(WebCore::AnimationTimeline::animationWasRemovedFromElement):
(WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement):
(WebCore::AnimationTimeline::animationsForElement const):
(WebCore::AnimationTimeline::willDestroyRendererForElement):
(WebCore::AnimationTimeline::cancelDeclarativeAnimationsForElement):
(WebCore::AnimationTimeline::updateCSSTransitionsForElementAndProperty):
(WebCore::AnimationTimeline::updateCSSTransitionsForElement):
* animation/AnimationTimeline.h:
* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::transitionDidComplete):
* dom/Element.cpp:
(WebCore::Element::webAnimations const):
(WebCore::Element::cssAnimations const):
(WebCore::Element::transitions const):
(WebCore::Element::hasCompletedTransitionsForProperty const):
(WebCore::Element::hasRunningTransitionsForProperty const):
(WebCore::Element::hasRunningTransitions const):
(WebCore::Element::ensureWebAnimations):
(WebCore::Element::ensureCSSAnimations):
(WebCore::Element::ensureTransitions):
(WebCore::Element::ensureCompletedTransitionsByProperty):
(WebCore::Element::ensureRunningTransitionsByProperty):
(WebCore::Element::webAnimations): Deleted.
(WebCore::Element::cssAnimations): Deleted.
(WebCore::Element::transitions): Deleted.
(WebCore::Element::completedTransitionsByProperty): Deleted.
(WebCore::Element::runningTransitionsByProperty): Deleted.
* dom/Element.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (258833 => 258834)


--- trunk/Source/WebCore/ChangeLog	2020-03-23 12:22:31 UTC (rev 258833)
+++ trunk/Source/WebCore/ChangeLog	2020-03-23 12:41:21 UTC (rev 258834)
@@ -1,3 +1,52 @@
+2020-03-23  Antoine Quint  <grao...@apple.com>
+
+        [Web Animations] ElementAnimationRareData is created too frequently
+        https://bugs.webkit.org/show_bug.cgi?id=209415
+
+        Reviewed by Antti Koivisto.
+
+        The various accessors on Element to access transitions and animations will ensure there is a backing
+        ElementAnimationRareData object. However, in a lot of cases, such as when we consider whether CSS
+        Transitions should be created, updated or removed under AnimationTimeline::updateCSSTransitionsForElement(),
+        we end up not needing to actually access the data structures on ElementAnimationRareData.
+
+        We now make the various methods on Element to access transitions and animations `const T*` and add ensure*()
+        methods to access the collections for modification. We also add methods to query whether there are running or
+        completed transitions at all or for a given property.
+
+        No test because there is no change in visible behavior.
+
+        * animation/AnimationTimeline.cpp:
+        (WebCore::AnimationTimeline::animationWasAddedToElement):
+        (WebCore::AnimationTimeline::animationWasRemovedFromElement):
+        (WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement):
+        (WebCore::AnimationTimeline::animationsForElement const):
+        (WebCore::AnimationTimeline::willDestroyRendererForElement):
+        (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForElement):
+        (WebCore::AnimationTimeline::updateCSSTransitionsForElementAndProperty):
+        (WebCore::AnimationTimeline::updateCSSTransitionsForElement):
+        * animation/AnimationTimeline.h:
+        * animation/DocumentTimeline.cpp:
+        (WebCore::DocumentTimeline::transitionDidComplete):
+        * dom/Element.cpp:
+        (WebCore::Element::webAnimations const):
+        (WebCore::Element::cssAnimations const):
+        (WebCore::Element::transitions const):
+        (WebCore::Element::hasCompletedTransitionsForProperty const):
+        (WebCore::Element::hasRunningTransitionsForProperty const):
+        (WebCore::Element::hasRunningTransitions const):
+        (WebCore::Element::ensureWebAnimations):
+        (WebCore::Element::ensureCSSAnimations):
+        (WebCore::Element::ensureTransitions):
+        (WebCore::Element::ensureCompletedTransitionsByProperty):
+        (WebCore::Element::ensureRunningTransitionsByProperty):
+        (WebCore::Element::webAnimations): Deleted.
+        (WebCore::Element::cssAnimations): Deleted.
+        (WebCore::Element::transitions): Deleted.
+        (WebCore::Element::completedTransitionsByProperty): Deleted.
+        (WebCore::Element::runningTransitionsByProperty): Deleted.
+        * dom/Element.h:
+
 2020-03-23  Charlie Turner  <ctur...@igalia.com>
 
         [GStreamer] Fail gracefully in the absence of a WebVTT encoder.

Modified: trunk/Source/WebCore/animation/AnimationTimeline.cpp (258833 => 258834)


--- trunk/Source/WebCore/animation/AnimationTimeline.cpp	2020-03-23 12:22:31 UTC (rev 258833)
+++ trunk/Source/WebCore/animation/AnimationTimeline.cpp	2020-03-23 12:41:21 UTC (rev 258834)
@@ -102,11 +102,11 @@
 void AnimationTimeline::animationWasAddedToElement(WebAnimation& animation, Element& element)
 {
     if (is<CSSTransition>(animation) && downcast<CSSTransition>(animation).owningElement() == &element)
-        element.transitions().add(&animation);
+        element.ensureTransitions().add(&animation);
     else if (is<CSSAnimation>(animation) && downcast<CSSAnimation>(animation).owningElement() == &element)
-        element.cssAnimations().add(&animation);
+        element.ensureCSSAnimations().add(&animation);
     else
-        element.webAnimations().add(&animation);
+        element.ensureWebAnimations().add(&animation);
 }
 
 static inline bool removeCSSTransitionFromMap(CSSTransition& transition, PropertyToTransitionMap& cssTransitionsByProperty)
@@ -121,9 +121,9 @@
 
 void AnimationTimeline::animationWasRemovedFromElement(WebAnimation& animation, Element& element)
 {
-    element.transitions().remove(&animation);
-    element.cssAnimations().remove(&animation);
-    element.webAnimations().remove(&animation);
+    element.ensureTransitions().remove(&animation);
+    element.ensureCSSAnimations().remove(&animation);
+    element.ensureWebAnimations().remove(&animation);
 
     // Now, if we're dealing with a CSS Transition, we remove it from the m_elementToRunningCSSTransitionByCSSPropertyID map.
     // We don't need to do this for CSS Animations because their timing can be set via CSS to end, which would cause this
@@ -139,8 +139,8 @@
 
     if (is<CSSTransition>(animation)) {
         auto& transition = downcast<CSSTransition>(animation);
-        if (!removeCSSTransitionFromMap(transition, element.runningTransitionsByProperty()))
-            removeCSSTransitionFromMap(transition, element.completedTransitionsByProperty());
+        if (!removeCSSTransitionFromMap(transition, element.ensureRunningTransitionsByProperty()))
+            removeCSSTransitionFromMap(transition, element.ensureCompletedTransitionsByProperty());
     }
 }
 
@@ -154,12 +154,12 @@
                 animations.append(effect->animation());
         }
     } else {
-        const auto& cssTransitions = element.transitions();
-        animations.appendRange(cssTransitions.begin(), cssTransitions.end());
-        const auto& cssAnimations = element.cssAnimations();
-        animations.appendRange(cssAnimations.begin(), cssAnimations.end());
-        const auto& webAnimations = element.webAnimations();
-        animations.appendRange(webAnimations.begin(), webAnimations.end());
+        if (auto* cssTransitions = element.transitions())
+            animations.appendRange(cssTransitions->begin(), cssTransitions->end());
+        if (auto* cssAnimations = element.cssAnimations())
+            animations.appendRange(cssAnimations->begin(), cssAnimations->end());
+        if (auto* webAnimations = element.webAnimations())
+            animations.appendRange(webAnimations->begin(), webAnimations->end());
     }
 
     return animations;
@@ -190,13 +190,17 @@
 
 void AnimationTimeline::willDestroyRendererForElement(Element& element)
 {
-    for (auto& cssTransition : element.transitions())
-        cssTransition->cancel(WebAnimation::Silently::Yes);
+    if (auto* transitions = element.transitions()) {
+        for (auto& cssTransition : *transitions)
+            cssTransition->cancel(WebAnimation::Silently::Yes);
+    }
 
-    for (auto& cssAnimation : element.cssAnimations()) {
-        if (is<CSSAnimation>(cssAnimation))
-            removeCSSAnimationCreatedByMarkup(element, downcast<CSSAnimation>(*cssAnimation));
-        cssAnimation->cancel(WebAnimation::Silently::Yes);
+    if (auto* cssAnimations = element.cssAnimations()) {
+        for (auto& cssAnimation : *cssAnimations) {
+            if (is<CSSAnimation>(cssAnimation))
+                removeCSSAnimationCreatedByMarkup(element, downcast<CSSAnimation>(*cssAnimation));
+            cssAnimation->cancel(WebAnimation::Silently::Yes);
+        }
     }
 }
 
@@ -219,13 +223,18 @@
 
 void AnimationTimeline::cancelDeclarativeAnimationsForElement(Element& element)
 {
-    for (auto& cssTransition : element.transitions())
-        cssTransition->cancel();
-    for (auto& cssAnimation : element.cssAnimations()) {
-        if (is<CSSAnimation>(cssAnimation))
-            removeCSSAnimationCreatedByMarkup(element, downcast<CSSAnimation>(*cssAnimation));
-        cssAnimation->cancel();
+    if (auto* transitions = element.transitions()) {
+        for (auto& cssTransition : *transitions)
+            cssTransition->cancel();
     }
+
+    if (auto* cssAnimations = element.cssAnimations()) {
+        for (auto& cssAnimation : *cssAnimations) {
+            if (is<CSSAnimation>(cssAnimation))
+                removeCSSAnimationCreatedByMarkup(element, downcast<CSSAnimation>(*cssAnimation));
+            cssAnimation->cancel();
+        }
+    }
 }
 
 static bool shouldConsiderAnimation(Element& element, const Animation& animation)
@@ -385,7 +394,7 @@
     }
 }
 
-void AnimationTimeline::updateCSSTransitionsForElementAndProperty(Element& element, CSSPropertyID property, const RenderStyle& currentStyle, const RenderStyle& afterChangeStyle, PropertyToTransitionMap& runningTransitionsByProperty, PropertyToTransitionMap& completedTransitionsByProperty, const MonotonicTime generationTime)
+void AnimationTimeline::updateCSSTransitionsForElementAndProperty(Element& element, CSSPropertyID property, const RenderStyle& currentStyle, const RenderStyle& afterChangeStyle, const MonotonicTime generationTime)
 {
     const Animation* matchingBackingAnimation = nullptr;
     if (auto* transitions = afterChangeStyle.transitions()) {
@@ -399,12 +408,12 @@
     // https://drafts.csswg.org/css-transitions-1/#before-change-style
     // Define the before-change style as the computed values of all properties on the element as of the previous style change event, except with
     // any styles derived from declarative animations such as CSS Transitions, CSS Animations, and SMIL Animations updated to the current time.
-    bool hasRunningTransition = runningTransitionsByProperty.contains(property);
+    bool hasRunningTransition = element.hasRunningTransitionsForProperty(property);
     auto beforeChangeStyle = [&]() {
         if (hasRunningTransition && CSSPropertyAnimation::animationOfPropertyIsAccelerated(property)) {
             // In case we have an accelerated transition running for this element, we need to get its computed style as the before-change style
             // since otherwise the animated value for that property won't be visible.
-            auto* runningTransition = runningTransitionsByProperty.get(property);
+            auto* runningTransition = element.ensureRunningTransitionsByProperty().get(property);
             if (is<KeyframeEffect>(runningTransition->effect())) {
                 auto& keyframeEffect = *downcast<KeyframeEffect>(runningTransition->effect());
                 if (keyframeEffect.isRunningAccelerated()) {
@@ -436,7 +445,7 @@
     if (!hasRunningTransition
         && !CSSPropertyAnimation::propertiesEqual(property, &beforeChangeStyle, &afterChangeStyle)
         && CSSPropertyAnimation::canPropertyBeInterpolated(property, &beforeChangeStyle, &afterChangeStyle)
-        && !propertyInStyleMatchesValueForTransitionInMap(property, afterChangeStyle, completedTransitionsByProperty)
+        && !propertyInStyleMatchesValueForTransitionInMap(property, afterChangeStyle, element.ensureCompletedTransitionsByProperty())
         && matchingBackingAnimation && transitionCombinedDuration(matchingBackingAnimation) > 0) {
         // 1. If all of the following are true:
         //   - the element does not have a running transition for the property,
@@ -446,7 +455,7 @@
         //   - the combined duration is greater than 0s,
 
         // then implementations must remove the completed transition (if present) from the set of completed transitions
-        completedTransitionsByProperty.remove(property);
+        element.ensureCompletedTransitionsByProperty().remove(property);
 
         // and start a transition whose:
         //   - start time is the time of the style change event plus the matching transition delay,
@@ -459,25 +468,25 @@
         auto duration = Seconds(matchingBackingAnimation->duration());
         auto& reversingAdjustedStartStyle = beforeChangeStyle;
         auto reversingShorteningFactor = 1;
-        runningTransitionsByProperty.set(property, CSSTransition::create(element, property, generationTime, *matchingBackingAnimation, &beforeChangeStyle, afterChangeStyle, delay, duration, reversingAdjustedStartStyle, reversingShorteningFactor));
-    } else if (completedTransitionsByProperty.contains(property) && !propertyInStyleMatchesValueForTransitionInMap(property, afterChangeStyle, completedTransitionsByProperty)) {
+        element.ensureRunningTransitionsByProperty().set(property, CSSTransition::create(element, property, generationTime, *matchingBackingAnimation, &beforeChangeStyle, afterChangeStyle, delay, duration, reversingAdjustedStartStyle, reversingShorteningFactor));
+    } else if (element.hasCompletedTransitionsForProperty(property) && !propertyInStyleMatchesValueForTransitionInMap(property, afterChangeStyle, element.ensureCompletedTransitionsByProperty())) {
         // 2. Otherwise, if the element has a completed transition for the property and the end value of the completed transition is different from
         //    the after-change style for the property, then implementations must remove the completed transition from the set of completed transitions.
-        completedTransitionsByProperty.remove(property);
+        element.ensureCompletedTransitionsByProperty().remove(property);
     }
 
-    hasRunningTransition = runningTransitionsByProperty.contains(property);
-    if ((hasRunningTransition || completedTransitionsByProperty.contains(property)) && !matchingBackingAnimation) {
+    hasRunningTransition = element.hasRunningTransitionsForProperty(property);
+    if ((hasRunningTransition || element.hasCompletedTransitionsForProperty(property)) && !matchingBackingAnimation) {
         // 3. If the element has a running transition or completed transition for the property, and there is not a matching transition-property
         //    value, then implementations must cancel the running transition or remove the completed transition from the set of completed transitions.
         if (hasRunningTransition)
-            runningTransitionsByProperty.take(property)->cancel();
+            element.ensureRunningTransitionsByProperty().take(property)->cancel();
         else
-            completedTransitionsByProperty.remove(property);
+            element.ensureCompletedTransitionsByProperty().remove(property);
     }
 
-    if (matchingBackingAnimation && runningTransitionsByProperty.contains(property) && !propertyInStyleMatchesValueForTransitionInMap(property, afterChangeStyle, runningTransitionsByProperty)) {
-        auto previouslyRunningTransition = runningTransitionsByProperty.take(property);
+    if (matchingBackingAnimation && element.hasRunningTransitionsForProperty(property) && !propertyInStyleMatchesValueForTransitionInMap(property, afterChangeStyle, element.ensureRunningTransitionsByProperty())) {
+        auto previouslyRunningTransition = element.ensureRunningTransitionsByProperty().take(property);
         auto& previouslyRunningTransitionCurrentStyle = previouslyRunningTransition->currentStyle();
         // 4. If the element has a running transition for the property, there is a matching transition-property value, and the end value of the running
         //    transition is not equal to the value of the property in the after-change style, then:
@@ -515,7 +524,7 @@
             auto delay = matchingBackingAnimation->delay() < 0 ? Seconds(matchingBackingAnimation->delay()) * reversingShorteningFactor : Seconds(matchingBackingAnimation->delay());
             auto duration = Seconds(matchingBackingAnimation->duration()) * reversingShorteningFactor;
 
-            element.runningTransitionsByProperty().set(property, CSSTransition::create(element, property, generationTime, *matchingBackingAnimation, &previouslyRunningTransitionCurrentStyle, afterChangeStyle, delay, duration, reversingAdjustedStartStyle, reversingShorteningFactor));
+            element.ensureRunningTransitionsByProperty().set(property, CSSTransition::create(element, property, generationTime, *matchingBackingAnimation, &previouslyRunningTransitionCurrentStyle, afterChangeStyle, delay, duration, reversingAdjustedStartStyle, reversingShorteningFactor));
         } else {
             // 4. Otherwise, implementations must cancel the running transition
             previouslyRunningTransition->cancelFromStyle();
@@ -531,7 +540,7 @@
             auto duration = Seconds(matchingBackingAnimation->duration());
             auto& reversingAdjustedStartStyle = currentStyle;
             auto reversingShorteningFactor = 1;
-            element.runningTransitionsByProperty().set(property, CSSTransition::create(element, property, generationTime, *matchingBackingAnimation, &previouslyRunningTransitionCurrentStyle, afterChangeStyle, delay, duration, reversingAdjustedStartStyle, reversingShorteningFactor));
+            element.ensureRunningTransitionsByProperty().set(property, CSSTransition::create(element, property, generationTime, *matchingBackingAnimation, &previouslyRunningTransitionCurrentStyle, afterChangeStyle, delay, duration, reversingAdjustedStartStyle, reversingShorteningFactor));
         }
     }
 }
@@ -540,9 +549,11 @@
 {
     // In case this element is newly getting a "display: none" we need to cancel all of its transitions and disregard new ones.
     if (currentStyle.hasTransitions() && currentStyle.display() != DisplayType::None && afterChangeStyle.display() == DisplayType::None) {
-        auto runningTransitions = element.runningTransitionsByProperty();
-        for (const auto& cssTransitionsByCSSPropertyIDMapItem : runningTransitions)
-            cssTransitionsByCSSPropertyIDMapItem.value->cancelFromStyle();
+        if (element.hasRunningTransitions()) {
+            auto runningTransitions = element.ensureRunningTransitionsByProperty();
+            for (const auto& cssTransitionsByCSSPropertyIDMapItem : runningTransitions)
+                cssTransitionsByCSSPropertyIDMapItem.value->cancelFromStyle();
+        }
         return;
     }
 
@@ -549,9 +560,6 @@
     // Section 3 "Starting of transitions" from the CSS Transitions Level 1 specification.
     // https://drafts.csswg.org/css-transitions-1/#starting
 
-    auto& runningTransitionsByProperty = element.runningTransitionsByProperty();
-    auto& completedTransitionsByProperty = element.completedTransitionsByProperty();
-
     auto generationTime = MonotonicTime::now();
 
     // First, let's compile the list of all CSS properties found in the current style and the after-change style.
@@ -567,13 +575,13 @@
             auto property = CSSPropertyAnimation::getPropertyAtIndex(propertyIndex, isShorthand);
             if (isShorthand && *isShorthand)
                 continue;
-            updateCSSTransitionsForElementAndProperty(element, property, currentStyle, afterChangeStyle, runningTransitionsByProperty, completedTransitionsByProperty, generationTime);
+            updateCSSTransitionsForElementAndProperty(element, property, currentStyle, afterChangeStyle, generationTime);
         }
         return;
     }
 
     for (auto property : transitionProperties)
-        updateCSSTransitionsForElementAndProperty(element, property, currentStyle, afterChangeStyle, runningTransitionsByProperty, completedTransitionsByProperty, generationTime);
+        updateCSSTransitionsForElementAndProperty(element, property, currentStyle, afterChangeStyle, generationTime);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/animation/AnimationTimeline.h (258833 => 258834)


--- trunk/Source/WebCore/animation/AnimationTimeline.h	2020-03-23 12:22:31 UTC (rev 258833)
+++ trunk/Source/WebCore/animation/AnimationTimeline.h	2020-03-23 12:41:21 UTC (rev 258834)
@@ -85,7 +85,7 @@
 
 private:
     void updateGlobalPosition(WebAnimation&);
-    void updateCSSTransitionsForElementAndProperty(Element&, CSSPropertyID, const RenderStyle& currentStyle, const RenderStyle& afterChangeStyle, PropertyToTransitionMap&, PropertyToTransitionMap&, const MonotonicTime);
+    void updateCSSTransitionsForElementAndProperty(Element&, CSSPropertyID, const RenderStyle& currentStyle, const RenderStyle& afterChangeStyle, const MonotonicTime);
     void removeCSSAnimationCreatedByMarkup(Element&, CSSAnimation&);
 
     Markable<Seconds, Seconds::MarkableTraits> m_currentTime;

Modified: trunk/Source/WebCore/animation/DocumentTimeline.cpp (258833 => 258834)


--- trunk/Source/WebCore/animation/DocumentTimeline.cpp	2020-03-23 12:22:31 UTC (rev 258833)
+++ trunk/Source/WebCore/animation/DocumentTimeline.cpp	2020-03-23 12:41:21 UTC (rev 258834)
@@ -547,7 +547,7 @@
     removeAnimation(*transition);
     if (is<KeyframeEffect>(transition->effect())) {
         if (auto* target = downcast<KeyframeEffect>(transition->effect())->target())
-            target->completedTransitionsByProperty().set(transition->property(), transition);
+            target->ensureCompletedTransitionsByProperty().set(transition->property(), transition);
     }
 }
 

Modified: trunk/Source/WebCore/dom/Element.cpp (258833 => 258834)


--- trunk/Source/WebCore/dom/Element.cpp	2020-03-23 12:22:31 UTC (rev 258833)
+++ trunk/Source/WebCore/dom/Element.cpp	2020-03-23 12:41:21 UTC (rev 258834)
@@ -3797,17 +3797,59 @@
     return impact;
 }
 
-AnimationCollection& Element::webAnimations()
+const AnimationCollection* Element::webAnimations() const
 {
+    if (auto* animationData = animationRareData())
+        return &animationRareData()->webAnimations();
+    return nullptr;
+}
+
+const AnimationCollection* Element::cssAnimations() const
+{
+    if (auto* animationData = animationRareData())
+        return &animationRareData()->cssAnimations();
+    return nullptr;
+}
+
+const AnimationCollection* Element::transitions() const
+{
+    if (auto* animationData = animationRareData())
+        return &animationRareData()->transitions();
+    return nullptr;
+}
+
+bool Element::hasCompletedTransitionsForProperty(CSSPropertyID property) const
+{
+    if (auto* animationData = animationRareData())
+        return animationRareData()->completedTransitionsByProperty().contains(property);
+    return false;
+}
+
+bool Element::hasRunningTransitionsForProperty(CSSPropertyID property) const
+{
+    if (auto* animationData = animationRareData())
+        return animationRareData()->runningTransitionsByProperty().contains(property);
+    return false;
+}
+
+bool Element::hasRunningTransitions() const
+{
+    if (auto* animationData = animationRareData())
+        return !animationRareData()->runningTransitionsByProperty().isEmpty();
+    return false;
+}
+
+AnimationCollection& Element::ensureWebAnimations()
+{
     return ensureAnimationRareData().webAnimations();
 }
 
-AnimationCollection& Element::cssAnimations()
+AnimationCollection& Element::ensureCSSAnimations()
 {
     return ensureAnimationRareData().cssAnimations();
 }
 
-AnimationCollection& Element::transitions()
+AnimationCollection& Element::ensureTransitions()
 {
     return ensureAnimationRareData().transitions();
 }
@@ -3822,12 +3864,12 @@
     ensureAnimationRareData().setAnimationsCreatedByMarkup(WTFMove(animations));
 }
 
-PropertyToTransitionMap& Element::completedTransitionsByProperty()
+PropertyToTransitionMap& Element::ensureCompletedTransitionsByProperty()
 {
     return ensureAnimationRareData().completedTransitionsByProperty();
 }
 
-PropertyToTransitionMap& Element::runningTransitionsByProperty()
+PropertyToTransitionMap& Element::ensureRunningTransitionsByProperty()
 {
     return ensureAnimationRareData().runningTransitionsByProperty();
 }

Modified: trunk/Source/WebCore/dom/Element.h (258833 => 258834)


--- trunk/Source/WebCore/dom/Element.h	2020-03-23 12:22:31 UTC (rev 258833)
+++ trunk/Source/WebCore/dom/Element.h	2020-03-23 12:41:21 UTC (rev 258834)
@@ -487,13 +487,19 @@
     bool hasKeyframeEffects() const;
     OptionSet<AnimationImpact> applyKeyframeEffects(RenderStyle&);
 
-    AnimationCollection& webAnimations();
-    AnimationCollection& cssAnimations();
-    AnimationCollection& transitions();
+    const AnimationCollection* webAnimations() const;
+    const AnimationCollection* cssAnimations() const;
+    const AnimationCollection* transitions() const;
+    bool hasCompletedTransitionsForProperty(CSSPropertyID) const;
+    bool hasRunningTransitionsForProperty(CSSPropertyID) const;
+    bool hasRunningTransitions() const;
+    AnimationCollection& ensureWebAnimations();
+    AnimationCollection& ensureCSSAnimations();
+    AnimationCollection& ensureTransitions();
+    PropertyToTransitionMap& ensureCompletedTransitionsByProperty();
+    PropertyToTransitionMap& ensureRunningTransitionsByProperty();
     CSSAnimationCollection& animationsCreatedByMarkup();
     void setAnimationsCreatedByMarkup(CSSAnimationCollection&&);
-    PropertyToTransitionMap& completedTransitionsByProperty();
-    PropertyToTransitionMap& runningTransitionsByProperty();
 
 #if ENABLE(FULLSCREEN_API)
     WEBCORE_EXPORT bool containsFullScreenElement() const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to