Title: [259720] trunk
Revision
259720
Author
grao...@webkit.org
Date
2020-04-08 09:31:18 -0700 (Wed, 08 Apr 2020)

Log Message

transition-property is not computed correctly when transition-duration is set to "inherit"
https://bugs.webkit.org/show_bug.cgi?id=204554
<rdar://problem/57458091>

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Somehow this test progressed slightly, it now fails in the second assertion rather than the first, although it fails still overall.

* web-platform-tests/css/css-transitions/events-004-expected.txt:

Source/WebCore:

Test: transitions/transition-property-for-element-with-transition-duration-inherit.html

The "transition-property" would behave as if "inherit" was set when the "transition-duration" property itself was set explicitly to "inherit".
We fix this by storing all the information contained in the "transition-property" into the single Animation::m_property member instead of splitting
it across Animation::m_mode as well. We now use a TransitionProperty struct which holds both the transition "mode" (none, all, single property,
unknown property) and and the CSS property targeted itself.

This requires modifying call sites of both Animation::property() and Animation::animationMode() throughout WebCore.

* animation/AnimationTimeline.cpp:
(WebCore::transitionMatchesProperty):
(WebCore::compileTransitionPropertiesInStyle):
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::createTransitionPropertyValue):
* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::mapAnimationProperty):
* css/makeprop.pl:
(generateAnimationPropertyInitialValueSetter):
(generateAnimationPropertyInheritValueSetter):
* page/animation/CompositeAnimation.cpp:
(WebCore::CompositeAnimation::updateTransitions):
* page/animation/ImplicitAnimation.cpp:
(WebCore::ImplicitAnimation::ImplicitAnimation):
* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::didAddTransition):
* platform/animation/Animation.cpp:
(WebCore::Animation::Animation):
(WebCore::Animation::operator=):
(WebCore::Animation::animationsMatch const):
(WebCore::operator<<):
* platform/animation/Animation.h:
(WebCore::Animation::property const):
(WebCore::Animation::timingFunction const):
(WebCore::Animation::setProperty):
(WebCore::Animation::setTimingFunction):
(WebCore::Animation::initialProperty):
(WebCore::Animation::animationMode const): Deleted.
(WebCore::Animation::setAnimationMode): Deleted.
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::adjustTransitions):
(WebCore::RenderStyle::transitionForProperty const):

LayoutTests:

Add a new test that checks that setting "transition-duration" to "inherit" does not cause "transition-property" to behaves
as if "inherit" was implictly set as well.

* transitions/transition-property-for-element-with-transition-duration-inherit-expected.txt: Added.
* transitions/transition-property-for-element-with-transition-duration-inherit.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (259719 => 259720)


--- trunk/LayoutTests/ChangeLog	2020-04-08 16:17:55 UTC (rev 259719)
+++ trunk/LayoutTests/ChangeLog	2020-04-08 16:31:18 UTC (rev 259720)
@@ -1,3 +1,17 @@
+2020-04-08  Antoine Quint  <grao...@apple.com>
+
+        transition-property is not computed correctly when transition-duration is set to "inherit"
+        https://bugs.webkit.org/show_bug.cgi?id=204554
+        <rdar://problem/57458091>
+
+        Reviewed by Antti Koivisto.
+
+        Add a new test that checks that setting "transition-duration" to "inherit" does not cause "transition-property" to behaves
+        as if "inherit" was implictly set as well.
+
+        * transitions/transition-property-for-element-with-transition-duration-inherit-expected.txt: Added.
+        * transitions/transition-property-for-element-with-transition-duration-inherit.html: Added.
+
 2020-04-08  Diego Pino Garcia  <dp...@igalia.com>
 
         [GTK] Gardening, flaky failures in EWS GTK-WK2

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (259719 => 259720)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-04-08 16:17:55 UTC (rev 259719)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-04-08 16:31:18 UTC (rev 259720)
@@ -1,3 +1,15 @@
+2020-04-08  Antoine Quint  <grao...@apple.com>
+
+        transition-property is not computed correctly when transition-duration is set to "inherit"
+        https://bugs.webkit.org/show_bug.cgi?id=204554
+        <rdar://problem/57458091>
+
+        Reviewed by Antti Koivisto.
+
+        Somehow this test progressed slightly, it now fails in the second assertion rather than the first, although it fails still overall.
+
+        * web-platform-tests/css/css-transitions/events-004-expected.txt:
+
 2020-04-07  Tyler Wilcock  <twilc...@protonmail.com>
 
         [css-values-4] Support font-relative lh and rlh unit

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transitions/events-004-expected.txt (259719 => 259720)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transitions/events-004-expected.txt	2020-04-08 16:17:55 UTC (rev 259719)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transitions/events-004-expected.txt	2020-04-08 16:31:18 UTC (rev 259720)
@@ -1,4 +1,4 @@
 
 PASS repeating lists 
-FAIL truncating lists assert_equals: expected "padding-top" but got "padding-left"
+FAIL truncating lists assert_approx_equals: expected 0.02 +/- 0.0005 but got 0.01
 

Added: trunk/LayoutTests/transitions/transition-property-for-element-with-transition-duration-inherit-expected.txt (0 => 259720)


--- trunk/LayoutTests/transitions/transition-property-for-element-with-transition-duration-inherit-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/transitions/transition-property-for-element-with-transition-duration-inherit-expected.txt	2020-04-08 16:31:18 UTC (rev 259720)
@@ -0,0 +1,10 @@
+Test the effect of 'transition-duration: inherit' on 'transition-property'.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS getComputedStyle(document.querySelector('span')).transitionProperty is 'all'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/transitions/transition-property-for-element-with-transition-duration-inherit.html (0 => 259720)


--- trunk/LayoutTests/transitions/transition-property-for-element-with-transition-duration-inherit.html	                        (rev 0)
+++ trunk/LayoutTests/transitions/transition-property-for-element-with-transition-duration-inherit.html	2020-04-08 16:31:18 UTC (rev 259720)
@@ -0,0 +1,7 @@
+<script src=""
+<div style="transition-duration: 1s; transition-property: margin-left;"><span style="transition-duration: inherit;"></span></div>
+<script>
+description("Test the effect of 'transition-duration: inherit' on 'transition-property'.")
+shouldBe("getComputedStyle(document.querySelector('span')).transitionProperty", "'all'");
+</script>
+<script src=""    
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (259719 => 259720)


--- trunk/Source/WebCore/ChangeLog	2020-04-08 16:17:55 UTC (rev 259719)
+++ trunk/Source/WebCore/ChangeLog	2020-04-08 16:31:18 UTC (rev 259720)
@@ -1,3 +1,53 @@
+2020-04-08  Antoine Quint  <grao...@apple.com>
+
+        transition-property is not computed correctly when transition-duration is set to "inherit"
+        https://bugs.webkit.org/show_bug.cgi?id=204554
+        <rdar://problem/57458091>
+
+        Reviewed by Antti Koivisto.
+
+        Test: transitions/transition-property-for-element-with-transition-duration-inherit.html
+
+        The "transition-property" would behave as if "inherit" was set when the "transition-duration" property itself was set explicitly to "inherit".
+        We fix this by storing all the information contained in the "transition-property" into the single Animation::m_property member instead of splitting
+        it across Animation::m_mode as well. We now use a TransitionProperty struct which holds both the transition "mode" (none, all, single property,
+        unknown property) and and the CSS property targeted itself.
+
+        This requires modifying call sites of both Animation::property() and Animation::animationMode() throughout WebCore.
+
+        * animation/AnimationTimeline.cpp:
+        (WebCore::transitionMatchesProperty):
+        (WebCore::compileTransitionPropertiesInStyle):
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::createTransitionPropertyValue):
+        * css/CSSToStyleMap.cpp:
+        (WebCore::CSSToStyleMap::mapAnimationProperty):
+        * css/makeprop.pl:
+        (generateAnimationPropertyInitialValueSetter):
+        (generateAnimationPropertyInheritValueSetter):
+        * page/animation/CompositeAnimation.cpp:
+        (WebCore::CompositeAnimation::updateTransitions):
+        * page/animation/ImplicitAnimation.cpp:
+        (WebCore::ImplicitAnimation::ImplicitAnimation):
+        * page/ios/ContentChangeObserver.cpp:
+        (WebCore::ContentChangeObserver::didAddTransition):
+        * platform/animation/Animation.cpp:
+        (WebCore::Animation::Animation):
+        (WebCore::Animation::operator=):
+        (WebCore::Animation::animationsMatch const):
+        (WebCore::operator<<):
+        * platform/animation/Animation.h:
+        (WebCore::Animation::property const):
+        (WebCore::Animation::timingFunction const):
+        (WebCore::Animation::setProperty):
+        (WebCore::Animation::setTimingFunction):
+        (WebCore::Animation::initialProperty):
+        (WebCore::Animation::animationMode const): Deleted.
+        (WebCore::Animation::setAnimationMode): Deleted.
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::adjustTransitions):
+        (WebCore::RenderStyle::transitionForProperty const):
+
 2020-04-08  Youenn Fablet  <you...@apple.com>
 
         Handle errors when grabbing grabbing microphone audio samples from the AudioUnit

Modified: trunk/Source/WebCore/animation/AnimationTimeline.cpp (259719 => 259720)


--- trunk/Source/WebCore/animation/AnimationTimeline.cpp	2020-04-08 16:17:55 UTC (rev 259719)
+++ trunk/Source/WebCore/animation/AnimationTimeline.cpp	2020-04-08 16:31:18 UTC (rev 259720)
@@ -328,11 +328,11 @@
 
 static bool transitionMatchesProperty(const Animation& transition, CSSPropertyID property)
 {
-    auto mode = transition.animationMode();
-    if (mode == Animation::AnimateNone || mode == Animation::AnimateUnknownProperty)
+    auto mode = transition.property().mode;
+    if (mode == Animation::TransitionMode::None || mode == Animation::TransitionMode::UnknownProperty)
         return false;
-    if (mode == Animation::AnimateSingleProperty) {
-        auto transitionProperty = transition.property();
+    if (mode == Animation::TransitionMode::SingleProperty) {
+        auto transitionProperty = transition.property().id;
         if (transitionProperty != property) {
             for (auto longhand : shorthandForProperty(transitionProperty)) {
                 if (longhand == property)
@@ -355,15 +355,15 @@
 
     for (size_t i = 0; i < transitions->size(); ++i) {
         const auto& animation = transitions->animation(i);
-        auto mode = animation.animationMode();
-        if (mode == Animation::AnimateSingleProperty) {
-            auto property = animation.property();
+        auto mode = animation.property().mode;
+        if (mode == Animation::TransitionMode::SingleProperty) {
+            auto property = animation.property().id;
             if (isShorthandCSSProperty(property)) {
                 for (auto longhand : shorthandForProperty(property))
                     transitionProperties.add(longhand);
             } else if (property != CSSPropertyInvalid)
                 transitionProperties.add(property);
-        } else if (mode == Animation::AnimateAll) {
+        } else if (mode == Animation::TransitionMode::All) {
             transitionPropertiesContainAll = true;
             return;
         }

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (259719 => 259720)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2020-04-08 16:17:55 UTC (rev 259719)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2020-04-08 16:31:18 UTC (rev 259720)
@@ -959,14 +959,14 @@
 
 static Ref<CSSValue> createTransitionPropertyValue(const Animation& animation)
 {
-    switch (animation.animationMode()) {
-    case Animation::AnimateNone:
+    switch (animation.property().mode) {
+    case Animation::TransitionMode::None:
         return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
-    case Animation::AnimateAll:
+    case Animation::TransitionMode::All:
         return CSSValuePool::singleton().createIdentifierValue(CSSValueAll);
-    case Animation::AnimateSingleProperty:
-        return CSSValuePool::singleton().createValue(getPropertyNameString(animation.property()), CSSUnitType::CSS_STRING);
-    case Animation::AnimateUnknownProperty:
+    case Animation::TransitionMode::SingleProperty:
+        return CSSValuePool::singleton().createValue(getPropertyNameString(animation.property().id), CSSUnitType::CSS_STRING);
+    case Animation::TransitionMode::UnknownProperty:
         return CSSValuePool::singleton().createValue(animation.unknownProperty(), CSSUnitType::CSS_STRING);
     }
     ASSERT_NOT_REACHED();

Modified: trunk/Source/WebCore/css/CSSToStyleMap.cpp (259719 => 259720)


--- trunk/Source/WebCore/css/CSSToStyleMap.cpp	2020-04-08 16:17:55 UTC (rev 259719)
+++ trunk/Source/WebCore/css/CSSToStyleMap.cpp	2020-04-08 16:31:18 UTC (rev 259720)
@@ -424,8 +424,7 @@
 void CSSToStyleMap::mapAnimationProperty(Animation& animation, const CSSValue& value)
 {
     if (value.treatAsInitialValue(CSSPropertyAnimation)) {
-        animation.setAnimationMode(Animation::AnimateAll);
-        animation.setProperty(CSSPropertyInvalid);
+        animation.setProperty(Animation::initialProperty());
         return;
     }
 
@@ -434,23 +433,20 @@
 
     auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
     if (primitiveValue.valueID() == CSSValueAll) {
-        animation.setAnimationMode(Animation::AnimateAll);
-        animation.setProperty(CSSPropertyInvalid);
+        animation.setProperty({ Animation::TransitionMode::All, CSSPropertyInvalid });
         return;
     }
     if (primitiveValue.valueID() == CSSValueNone) {
-        animation.setAnimationMode(Animation::AnimateNone);
-        animation.setProperty(CSSPropertyInvalid);
+        animation.setProperty({ Animation::TransitionMode::None, CSSPropertyInvalid });
         return;
     }
     if (primitiveValue.propertyID() == CSSPropertyInvalid) {
-        animation.setAnimationMode(Animation::AnimateUnknownProperty);
-        animation.setProperty(CSSPropertyInvalid);
+        animation.setProperty({ Animation::TransitionMode::UnknownProperty, CSSPropertyInvalid });
         animation.setUnknownProperty(primitiveValue.stringValue());
         return;
     }
-    animation.setAnimationMode(Animation::AnimateSingleProperty);
-    animation.setProperty(primitiveValue.propertyID());
+
+    animation.setProperty({ Animation::TransitionMode::SingleProperty, primitiveValue.propertyID() });
 }
 
 void CSSToStyleMap::mapAnimationTimingFunction(Animation& animation, const CSSValue& value)

Modified: trunk/Source/WebCore/css/makeprop.pl (259719 => 259720)


--- trunk/Source/WebCore/css/makeprop.pl	2020-04-08 16:17:55 UTC (rev 259719)
+++ trunk/Source/WebCore/css/makeprop.pl	2020-04-08 16:31:18 UTC (rev 259720)
@@ -769,9 +769,6 @@
   my $setter = $propertiesWithStyleBuilderOptions{$name}{"setter"};
   my $initial = $propertiesWithStyleBuilderOptions{$name}{"initial"};
   $setterContent .= $indent . "list.animation(0)." . $setter . "(Animation::" . $initial . "());\n";
-  if ($name eq "-webkit-transition-property") {
-    $setterContent .= $indent . "list.animation(0).setAnimationMode(Animation::AnimateAll);\n";
-  }
   $setterContent .= $indent . "for (size_t i = 1; i < list.size(); ++i)\n";
   $setterContent .= $indent . "    list.animation(i)." . getClearFunction($name) . "();\n";
 
@@ -792,7 +789,6 @@
   my $getter = $propertiesWithStyleBuilderOptions{$name}{"getter"};
   my $setter = $propertiesWithStyleBuilderOptions{$name}{"setter"};
   $setterContent .= $indent . "    list.animation(i)." . $setter . "(parentList->animation(i)." . $getter . "());\n";
-  $setterContent .= $indent . "    list.animation(i).setAnimationMode(parentList->animation(i).animationMode());\n";
   $setterContent .= $indent . "}\n";
   $setterContent .= "\n";
   $setterContent .= $indent . "// Reset any remaining animations to not have the property set.\n";

Modified: trunk/Source/WebCore/page/animation/CompositeAnimation.cpp (259719 => 259720)


--- trunk/Source/WebCore/page/animation/CompositeAnimation.cpp	2020-04-08 16:17:55 UTC (rev 259719)
+++ trunk/Source/WebCore/page/animation/CompositeAnimation.cpp	2020-04-08 16:31:18 UTC (rev 259720)
@@ -97,13 +97,13 @@
             auto& animation = targetStyle.transitions()->animation(i);
             bool isActiveTransition = animation.duration() || animation.delay() > 0;
 
-            Animation::AnimationMode mode = animation.animationMode();
-            if (mode == Animation::AnimateNone || mode == Animation::AnimateUnknownProperty)
+            auto mode = animation.property().mode;
+            if (mode == Animation::TransitionMode::None || mode == Animation::TransitionMode::UnknownProperty)
                 continue;
 
-            CSSPropertyID prop = animation.property();
+            CSSPropertyID prop = animation.property().id;
 
-            bool all = mode == Animation::AnimateAll;
+            bool all = mode == Animation::TransitionMode::All;
 
             // Handle both the 'all' and single property cases. For the single prop case, we make only one pass
             // through the loop.

Modified: trunk/Source/WebCore/page/animation/ImplicitAnimation.cpp (259719 => 259720)


--- trunk/Source/WebCore/page/animation/ImplicitAnimation.cpp	2020-04-08 16:17:55 UTC (rev 259719)
+++ trunk/Source/WebCore/page/animation/ImplicitAnimation.cpp	2020-04-08 16:31:18 UTC (rev 259720)
@@ -46,7 +46,7 @@
 ImplicitAnimation::ImplicitAnimation(const Animation& transition, CSSPropertyID animatingProperty, Element& element, CompositeAnimation& compositeAnimation, const RenderStyle& fromStyle)
     : AnimationBase(transition, element, compositeAnimation)
     , m_fromStyle(RenderStyle::clonePtr(fromStyle))
-    , m_transitionProperty(transition.property())
+    , m_transitionProperty(transition.property().id)
     , m_animatingProperty(animatingProperty)
 {
 #if PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp (259719 => 259720)


--- trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp	2020-04-08 16:17:55 UTC (rev 259719)
+++ trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp	2020-04-08 16:31:18 UTC (rev 259720)
@@ -223,7 +223,7 @@
         return;
     if (!transition.isDurationSet() || !transition.isPropertySet())
         return;
-    if (!isObservedPropertyForTransition(transition.property()))
+    if (!isObservedPropertyForTransition(transition.property().id))
         return;
     auto transitionEnd = Seconds { transition.duration() + std::max<double>(0, transition.isDelaySet() ? transition.delay() : 0) };
     if (transitionEnd > maximumDelayForTransitions)

Modified: trunk/Source/WebCore/platform/animation/Animation.cpp (259719 => 259720)


--- trunk/Source/WebCore/platform/animation/Animation.cpp	2020-04-08 16:17:55 UTC (rev 259719)
+++ trunk/Source/WebCore/platform/animation/Animation.cpp	2020-04-08 16:31:18 UTC (rev 259720)
@@ -33,7 +33,6 @@
     , m_delay(initialDelay())
     , m_duration(initialDuration())
     , m_timingFunction(initialTimingFunction())
-    , m_mode(AnimateAll)
     , m_direction(initialDirection())
     , m_fillMode(static_cast<unsigned>(initialFillMode()))
     , m_playState(static_cast<unsigned>(initialPlayState()))
@@ -59,7 +58,6 @@
     , m_duration(o.m_duration)
     , m_timingFunction(o.m_timingFunction)
     , m_nameStyleScopeOrdinal(o.m_nameStyleScopeOrdinal)
-    , m_mode(o.m_mode)
     , m_direction(o.m_direction)
     , m_fillMode(o.m_fillMode)
     , m_playState(o.m_playState)
@@ -85,7 +83,6 @@
     m_timingFunction = o.m_timingFunction;
     m_nameStyleScopeOrdinal = o.m_nameStyleScopeOrdinal;
     m_property = o.m_property;
-    m_mode = o.m_mode;
     m_direction = o.m_direction;
     m_fillMode = o.m_fillMode;
     m_playState = o.m_playState;
@@ -130,7 +127,7 @@
     if (!result)
         return false;
 
-    return !matchProperties || (m_mode == other.m_mode && m_property == other.m_property && m_propertySet == other.m_propertySet);
+    return !matchProperties || (m_property.mode == other.m_property.mode && m_property.id == other.m_property.id && m_propertySet == other.m_propertySet);
 }
 
 const String& Animation::initialName()
@@ -139,13 +136,13 @@
     return initialValue;
 }
 
-TextStream& operator<<(TextStream& ts, Animation::AnimationMode mode)
+TextStream& operator<<(TextStream& ts, Animation::TransitionProperty transitionProperty)
 {
-    switch (mode) {
-    case Animation::AnimateAll: ts << "all"; break;
-    case Animation::AnimateNone: ts << "none"; break;
-    case Animation::AnimateSingleProperty: ts << "single property"; break;
-    case Animation::AnimateUnknownProperty: ts << "unknown property"; break;
+    switch (transitionProperty.mode) {
+    case Animation::TransitionMode::All: ts << "all"; break;
+    case Animation::TransitionMode::None: ts << "none"; break;
+    case Animation::TransitionMode::SingleProperty: ts << getPropertyName(transitionProperty.id); break;
+    case Animation::TransitionMode::UnknownProperty: ts << "unknown property"; break;
     }
     return ts;
 }
@@ -163,7 +160,7 @@
 
 TextStream& operator<<(TextStream& ts, const Animation& animation)
 {
-    ts.dumpProperty("property", getPropertyName(animation.property()));
+    ts.dumpProperty("property", animation.property());
     ts.dumpProperty("name", animation.name());
     ts.dumpProperty("iteration count", animation.iterationCount());
     ts.dumpProperty("delay", animation.iterationCount());
@@ -170,7 +167,6 @@
     ts.dumpProperty("duration", animation.duration());
     if (animation.timingFunction())
         ts.dumpProperty("timing function", *animation.timingFunction());
-    ts.dumpProperty("mode", animation.animationMode());
     ts.dumpProperty("direction", animation.direction());
     ts.dumpProperty("fill-mode", animation.fillMode());
     ts.dumpProperty("play-state", animation.playState());

Modified: trunk/Source/WebCore/platform/animation/Animation.h (259719 => 259720)


--- trunk/Source/WebCore/platform/animation/Animation.h	2020-04-08 16:17:55 UTC (rev 259719)
+++ trunk/Source/WebCore/platform/animation/Animation.h	2020-04-08 16:31:18 UTC (rev 259720)
@@ -92,13 +92,18 @@
 
     double delay() const { return m_delay; }
 
-    enum AnimationMode {
-        AnimateAll,
-        AnimateNone,
-        AnimateSingleProperty,
-        AnimateUnknownProperty
+    enum class TransitionMode : uint8_t {
+        All,
+        None,
+        SingleProperty,
+        UnknownProperty
     };
 
+    struct TransitionProperty {
+        TransitionMode mode;
+        CSSPropertyID id;
+    };
+
     enum AnimationDirection {
         AnimationDirectionNormal,
         AnimationDirectionAlternate,
@@ -118,10 +123,9 @@
     const String& name() const { return m_name; }
     Style::ScopeOrdinal nameStyleScopeOrdinal() const { return m_nameStyleScopeOrdinal; }
     AnimationPlayState playState() const { return static_cast<AnimationPlayState>(m_playState); }
-    CSSPropertyID property() const { return m_property; }
+    TransitionProperty property() const { return m_property; }
     const String& unknownProperty() const { return m_unknownProperty; }
     TimingFunction* timingFunction() const { return m_timingFunction.get(); }
-    AnimationMode animationMode() const { return static_cast<AnimationMode>(m_mode); }
 
     void setDelay(double c) { m_delay = c; m_delaySet = true; }
     void setDirection(AnimationDirection d) { m_direction = d; m_directionSet = true; }
@@ -135,10 +139,9 @@
         m_nameSet = true;
     }
     void setPlayState(AnimationPlayState d) { m_playState = static_cast<unsigned>(d); m_playStateSet = true; }
-    void setProperty(CSSPropertyID t) { m_property = t; m_propertySet = true; }
+    void setProperty(TransitionProperty t) { m_property = t; m_propertySet = true; }
     void setUnknownProperty(const String& property) { m_unknownProperty = property; }
     void setTimingFunction(RefPtr<TimingFunction>&& function) { m_timingFunction = WTFMove(function); m_timingFunctionSet = true; }
-    void setAnimationMode(AnimationMode mode) { m_mode = static_cast<unsigned>(mode); }
 
     void setIsNoneAnimation(bool n) { m_isNone = n; }
 
@@ -159,7 +162,7 @@
     Animation(const Animation& o);
     
     // Packs with m_refCount from the base class.
-    CSSPropertyID m_property { CSSPropertyInvalid };
+    TransitionProperty m_property { TransitionMode::All, CSSPropertyInvalid };
 
     String m_name;
     String m_unknownProperty;
@@ -170,7 +173,6 @@
 
     Style::ScopeOrdinal m_nameStyleScopeOrdinal { Style::ScopeOrdinal::Element };
 
-    unsigned m_mode : 2; // AnimationMode
     unsigned m_direction : 2; // AnimationDirection
     unsigned m_fillMode : 2; // AnimationFillMode
     unsigned m_playState : 2; // AnimationPlayState
@@ -195,12 +197,12 @@
     static double initialIterationCount() { return 1.0; }
     static const String& initialName();
     static AnimationPlayState initialPlayState() { return AnimationPlayState::Playing; }
-    static CSSPropertyID initialProperty() { return CSSPropertyInvalid; }
+    static TransitionProperty initialProperty() { return { TransitionMode::All, CSSPropertyInvalid }; }
     static Ref<TimingFunction> initialTimingFunction() { return CubicBezierTimingFunction::create(); }
 };
 
 WTF::TextStream& operator<<(WTF::TextStream&, AnimationPlayState);
-WTF::TextStream& operator<<(WTF::TextStream&, Animation::AnimationMode);
+WTF::TextStream& operator<<(WTF::TextStream&, Animation::TransitionProperty);
 WTF::TextStream& operator<<(WTF::TextStream&, Animation::AnimationDirection);
 WTF::TextStream& operator<<(WTF::TextStream&, const Animation&);
 

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (259719 => 259720)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2020-04-08 16:17:55 UTC (rev 259719)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2020-04-08 16:31:18 UTC (rev 259720)
@@ -1661,7 +1661,7 @@
     // This is an O(n^2) algorithm but the lists tend to be short, so it is probably OK.
     for (size_t i = 0; i < transitionList->size(); ++i) {
         for (size_t j = i + 1; j < transitionList->size(); ++j) {
-            if (transitionList->animation(i).property() == transitionList->animation(j).property()) {
+            if (transitionList->animation(i).property().id == transitionList->animation(j).property().id) {
                 // toss i
                 transitionList->remove(i);
                 j = i;
@@ -1691,7 +1691,7 @@
         return nullptr;
     for (size_t i = 0, size = transitions->size(); i < size; ++i) {
         auto& animation = transitions->animation(i);
-        if (animation.animationMode() == Animation::AnimateAll || animation.property() == property)
+        if (animation.property().mode == Animation::TransitionMode::All || animation.property().id == property)
             return &animation;
     }
     return nullptr;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to