Title: [287669] trunk
Revision
287669
Author
grao...@webkit.org
Date
2022-01-05 18:55:15 -0800 (Wed, 05 Jan 2022)

Log Message

Refactor computed style code for transition-property and the transition shorthand
https://bugs.webkit.org/show_bug.cgi?id=234872

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Rebaseline some test output.

* web-platform-tests/css/css-pseudo/first-letter-allowed-properties-expected.txt:
* web-platform-tests/css/css-pseudo/first-line-allowed-properties-expected.txt:

Source/WebCore:

There's no reason for the "transition-property" and "transition" properties to be
handled any differently to any other "transition-" property or the "animation"
shorthand.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::animationShorthandValue):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
(WebCore::transitionPropertyValue): Deleted.

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (287668 => 287669)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-01-06 02:51:40 UTC (rev 287668)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-01-06 02:55:15 UTC (rev 287669)
@@ -1,3 +1,15 @@
+2022-01-05  Antoine Quint  <grao...@webkit.org>
+
+        Refactor computed style code for transition-property and the transition shorthand
+        https://bugs.webkit.org/show_bug.cgi?id=234872
+
+        Reviewed by Antti Koivisto.
+
+        Rebaseline some test output.
+
+        * web-platform-tests/css/css-pseudo/first-letter-allowed-properties-expected.txt:
+        * web-platform-tests/css/css-pseudo/first-line-allowed-properties-expected.txt:
+
 2022-01-05  Youenn Fablet  <you...@apple.com>
 
         MediaRecorder should support the bitsPerSecond option

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/first-letter-allowed-properties-expected.txt (287668 => 287669)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/first-letter-allowed-properties-expected.txt	2022-01-06 02:51:40 UTC (rev 287668)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/first-letter-allowed-properties-expected.txt	2022-01-06 02:55:15 UTC (rev 287669)
@@ -32,7 +32,7 @@
 PASS verticalAlign should be applied to first-letter pseudo elements.
 PASS wordSpacing should be applied to first-letter pseudo elements.
 FAIL position should not be applied to first-letter pseudo elements. assert_equals: expected "static" but got "absolute"
-FAIL transition should not be applied to first-letter pseudo elements. assert_equals: expected "all 0s ease 0s" but got "transform 1s ease 0s"
+FAIL transition should not be applied to first-letter pseudo elements. assert_equals: expected "" but got "transform 1s ease 0s"
 PASS transform should not be applied to first-letter pseudo elements.
 FAIL wordBreak should not be applied to first-letter pseudo elements. assert_equals: expected "normal" but got "break-all"
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/first-line-allowed-properties-expected.txt (287668 => 287669)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/first-line-allowed-properties-expected.txt	2022-01-06 02:51:40 UTC (rev 287668)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/first-line-allowed-properties-expected.txt	2022-01-06 02:55:15 UTC (rev 287669)
@@ -34,7 +34,7 @@
 FAIL margin should not be applied to first-line pseudo elements. assert_equals: expected "0px" but got "10px 20px 30px 40px"
 FAIL padding should not be applied to first-line pseudo elements. assert_equals: expected "0px" but got "10px 20px 30px 40px"
 FAIL position should not be applied to first-line pseudo elements. assert_equals: expected "static" but got "absolute"
-FAIL transition should not be applied to first-line pseudo elements. assert_equals: expected "all 0s ease 0s" but got "transform 1s ease 0s"
+FAIL transition should not be applied to first-line pseudo elements. assert_equals: expected "" but got "transform 1s ease 0s"
 PASS transform should not be applied to first-line pseudo elements.
 FAIL wordBreak should not be applied to first-line pseudo elements. assert_equals: expected "normal" but got "break-all"
 

Modified: trunk/Source/WebCore/ChangeLog (287668 => 287669)


--- trunk/Source/WebCore/ChangeLog	2022-01-06 02:51:40 UTC (rev 287668)
+++ trunk/Source/WebCore/ChangeLog	2022-01-06 02:55:15 UTC (rev 287669)
@@ -1,3 +1,19 @@
+2022-01-05  Antoine Quint  <grao...@webkit.org>
+
+        Refactor computed style code for transition-property and the transition shorthand
+        https://bugs.webkit.org/show_bug.cgi?id=234872
+
+        Reviewed by Antti Koivisto.
+
+        There's no reason for the "transition-property" and "transition" properties to be
+        handled any differently to any other "transition-" property or the "animation"
+        shorthand.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::animationShorthandValue):
+        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
+        (WebCore::transitionPropertyValue): Deleted.
+
 2022-01-05  Chris Dumez  <cdu...@apple.com>
 
         [ Monterey Debug arm64 ] ASSERTION FAILED: result == &worker ./workers/service/server/SWServer.cpp(837) : void WebCore::SWServer::workerContextTerminated(WebCore::SWServerWorker &)

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (287668 => 287669)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2022-01-06 02:51:40 UTC (rev 287668)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2022-01-06 02:55:15 UTC (rev 287669)
@@ -1094,17 +1094,6 @@
     return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
 }
 
-static Ref<CSSValueList> transitionPropertyValue(const AnimationList* animationList)
-{
-    auto list = CSSValueList::createCommaSeparated();
-    if (animationList) {
-        for (size_t i = 0; i < animationList->size(); ++i)
-            list->append(createTransitionPropertyValue(animationList->animation(i)));
-    } else
-        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueAll));
-    return list;
-}
-
 static Ref<CSSValueList> valueForScrollSnapType(const ScrollSnapType& type)
 {
     auto value = CSSValueList::createSpaceSeparated();
@@ -1484,7 +1473,7 @@
     return list;
 }
 
-static Ref<CSSValueList> animationShorthandValue(const AnimationList* animationList)
+static Ref<CSSValueList> animationShorthandValue(CSSPropertyID property, const AnimationList* animationList)
 {
     auto parentList = CSSValueList::createCommaSeparated();
     if (animationList) {
@@ -1491,8 +1480,7 @@
         for (size_t i = 0; i < animationList->size(); ++i) {
             const auto& animation = animationList->animation(i);
             auto childList = CSSValueList::createSpaceSeparated();
-            auto shorthand = shorthandForProperty(CSSPropertyAnimation);
-            for (auto longhand : shorthand)
+            for (auto longhand : shorthandForProperty(property))
                 ComputedStyleExtractor::addValueForAnimationPropertyToList(childList.get(), longhand, &animation);
             parentList->append(childList);
         }
@@ -3582,7 +3570,7 @@
                 return cssValuePool.createIdentifierValue(CSSValueContentBox);
             return cssValuePool.createIdentifierValue(CSSValueBorderBox);
         case CSSPropertyAnimation:
-            return animationShorthandValue(style.animations());
+            return animationShorthandValue(propertyID, style.animations());
         case CSSPropertyAnimationDelay:
         case CSSPropertyAnimationDirection:
         case CSSPropertyAnimationDuration:
@@ -3786,32 +3774,10 @@
         case CSSPropertyTransitionDelay:
         case CSSPropertyTransitionDuration:
         case CSSPropertyTransitionTimingFunction:
+        case CSSPropertyTransitionProperty:
             return valueListForAnimationOrTransitionProperty(propertyID, style.transitions());
-        case CSSPropertyTransitionProperty:
-            return transitionPropertyValue(style.transitions());
-        case CSSPropertyTransition: {
-            if (auto* animationList = style.transitions()) {
-                auto transitionsList = CSSValueList::createCommaSeparated();
-                for (size_t i = 0; i < animationList->size(); ++i) {
-                    auto list = CSSValueList::createSpaceSeparated();
-                    auto& animation = animationList->animation(i);
-                    list->append(createTransitionPropertyValue(animation));
-                    list->append(cssValuePool.createValue(animation.duration(), CSSUnitType::CSS_S));
-                    list->append(valueForAnimationTimingFunction(*animation.timingFunction()));
-                    list->append(cssValuePool.createValue(animation.delay(), CSSUnitType::CSS_S));
-                    transitionsList->append(WTFMove(list));
-                }
-                return transitionsList;
-            }
-
-            auto list = CSSValueList::createSpaceSeparated();
-            // transition-property default value.
-            list->append(cssValuePool.createIdentifierValue(CSSValueAll));
-            list->append(cssValuePool.createValue(Animation::initialDuration(), CSSUnitType::CSS_S));
-            list->append(valueForAnimationTimingFunction(Animation::initialTimingFunction()));
-            list->append(cssValuePool.createValue(Animation::initialDelay(), CSSUnitType::CSS_S));
-            return list;
-        }
+        case CSSPropertyTransition:
+            return animationShorthandValue(propertyID, style.transitions());
         case CSSPropertyPointerEvents:
             return cssValuePool.createValue(style.pointerEvents());
         case CSSPropertyWebkitLineGrid:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to