Title: [290823] trunk
Revision
290823
Author
[email protected]
Date
2022-03-04 00:53:38 -0800 (Fri, 04 Mar 2022)

Log Message

[web-animations] keyframe values set to "inherit" should recompute their values when the inherited value changes
https://bugs.webkit.org/show_bug.cgi?id=237371

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

* web-platform-tests/web-animations/responsive/lineHeight-expected.txt:
* web-platform-tests/web-animations/responsive/opacity-expected.txt:
* web-platform-tests/web-animations/responsive/textIndent-expected.txt:

Source/WebCore:

We now keep track of properties set to "inherit" in keyframes such that we may determine when the
computed value may have changed when resolving animations.

* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::processKeyframes):
* animation/KeyframeEffect.h:
(WebCore::KeyframeEffect::inheritedProperties const):
* animation/KeyframeEffectStack.cpp:
(WebCore::KeyframeEffectStack::applyKeyframeEffects):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (290822 => 290823)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-03-04 08:42:45 UTC (rev 290822)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-03-04 08:53:38 UTC (rev 290823)
@@ -1,3 +1,14 @@
+2022-03-02  Antoine Quint  <[email protected]>
+
+        [web-animations] keyframe values set to "inherit" should recompute their values when the inherited value changes
+        https://bugs.webkit.org/show_bug.cgi?id=237371
+
+        Reviewed by Antti Koivisto.
+
+        * web-platform-tests/web-animations/responsive/lineHeight-expected.txt:
+        * web-platform-tests/web-animations/responsive/opacity-expected.txt:
+        * web-platform-tests/web-animations/responsive/textIndent-expected.txt:
+
 2022-03-03  Chris Dumez  <[email protected]>
 
         REGRESSION(r290356-r290351?): [ iOS EWS ] 3 imported/w3c/web-platform-tests/service-workers/service-worker/* tests are constant text failures.

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/responsive/lineHeight-expected.txt (290822 => 290823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/responsive/lineHeight-expected.txt	2022-03-04 08:42:45 UTC (rev 290822)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/responsive/lineHeight-expected.txt	2022-03-04 08:53:38 UTC (rev 290823)
@@ -1,7 +1,7 @@
 
 PASS lineHeight responsive to style changes
 FAIL lineHeight clamped to 0px assert_equals: expected "0px" but got "20px"
-FAIL lineHeight responsive to inherited changes from keyword assert_equals: expected "80px" but got "normal"
-FAIL lineHeight responsive to inherited changes from number assert_equals: expected "80px" but got "40px"
-FAIL lineHeight responsive to inherited changes from length assert_equals: expected "97px" but got "50px"
+PASS lineHeight responsive to inherited changes from keyword
+PASS lineHeight responsive to inherited changes from number
+PASS lineHeight responsive to inherited changes from length
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/responsive/opacity-expected.txt (290822 => 290823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/responsive/opacity-expected.txt	2022-03-04 08:42:45 UTC (rev 290822)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/responsive/opacity-expected.txt	2022-03-04 08:53:38 UTC (rev 290823)
@@ -1,8 +1,8 @@
 
-FAIL fillOpacity responsive to inherited changes assert_equals: expected "0.375" but got "0.75"
+PASS fillOpacity responsive to inherited changes
 FAIL floodOpacity responsive to inherited changes assert_equals: expected "0.375" but got "0.75"
 FAIL opacity responsive to inherited changes assert_equals: expected "0.375" but got "0.75"
 FAIL shapeImageThreshold responsive to inherited changes assert_equals: expected "0.375" but got "0.75"
 FAIL stopOpacity responsive to inherited changes assert_equals: expected "0.375" but got "0.75"
-FAIL strokeOpacity responsive to inherited changes assert_equals: expected "0.375" but got "0.75"
+PASS strokeOpacity responsive to inherited changes
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/responsive/textIndent-expected.txt (290822 => 290823)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/responsive/textIndent-expected.txt	2022-03-04 08:42:45 UTC (rev 290822)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/responsive/textIndent-expected.txt	2022-03-04 08:53:38 UTC (rev 290823)
@@ -1,4 +1,4 @@
 
 PASS textIndent responsive to style changes
-FAIL textIndent responsive to inherited textIndent changes assert_equals: expected "200px hanging each-line" but got "150px hanging each-line"
+FAIL textIndent responsive to inherited textIndent changes assert_equals: expected "300px hanging each-line" but got "200px hanging each-line"
 

Modified: trunk/Source/WebCore/ChangeLog (290822 => 290823)


--- trunk/Source/WebCore/ChangeLog	2022-03-04 08:42:45 UTC (rev 290822)
+++ trunk/Source/WebCore/ChangeLog	2022-03-04 08:53:38 UTC (rev 290823)
@@ -1,3 +1,20 @@
+2022-03-02  Antoine Quint  <[email protected]>
+
+        [web-animations] keyframe values set to "inherit" should recompute their values when the inherited value changes
+        https://bugs.webkit.org/show_bug.cgi?id=237371
+
+        Reviewed by Antti Koivisto.
+
+        We now keep track of properties set to "inherit" in keyframes such that we may determine when the
+        computed value may have changed when resolving animations.
+
+        * animation/KeyframeEffect.cpp:
+        (WebCore::KeyframeEffect::processKeyframes):
+        * animation/KeyframeEffect.h:
+        (WebCore::KeyframeEffect::inheritedProperties const):
+        * animation/KeyframeEffectStack.cpp:
+        (WebCore::KeyframeEffectStack::applyKeyframeEffects):
+
 2022-03-04  Sihui Liu  <[email protected]>
 
         SQLiteDatabase::open should return early if journal mode cannot be set

Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (290822 => 290823)


--- trunk/Source/WebCore/animation/KeyframeEffect.cpp	2022-03-04 08:42:45 UTC (rev 290822)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp	2022-03-04 08:53:38 UTC (rev 290823)
@@ -770,6 +770,8 @@
     // since they can be computed up-front.
     computeMissingKeyframeOffsets(parsedKeyframes);
 
+    m_inheritedProperties.clear();
+
     // 8. For each frame in processed keyframes, perform the following steps:
     for (auto& keyframe : parsedKeyframes) {
         // Let the timing function of frame be the result of parsing the “easing” property on frame using the CSS syntax
@@ -779,6 +781,11 @@
         if (timingFunctionResult.hasException())
             return timingFunctionResult.releaseException();
         keyframe.timingFunction = timingFunctionResult.returnValue();
+
+        for (auto& [property, value] : keyframe.styleStrings) {
+            if (equalLettersIgnoringASCIICase(value, "inherit"))
+                m_inheritedProperties.add(property);
+        }
     }
 
     // 9. Parse each of the values in unused easings using the CSS syntax defined for easing property of the

Modified: trunk/Source/WebCore/animation/KeyframeEffect.h (290822 => 290823)


--- trunk/Source/WebCore/animation/KeyframeEffect.h	2022-03-04 08:42:45 UTC (rev 290822)
+++ trunk/Source/WebCore/animation/KeyframeEffect.h	2022-03-04 08:53:38 UTC (rev 290823)
@@ -156,6 +156,7 @@
     void computeDeclarativeAnimationBlendingKeyframes(const RenderStyle* oldStyle, const RenderStyle& newStyle, const Style::ResolutionContext&);
     const KeyframeList& blendingKeyframes() const { return m_blendingKeyframes; }
     const HashSet<CSSPropertyID>& animatedProperties();
+    const HashSet<CSSPropertyID>& inheritedProperties() const { return m_inheritedProperties; }
     bool animatesProperty(CSSPropertyID) const;
 
     bool computeExtentOfTransformAnimation(LayoutRect&) const;
@@ -234,6 +235,7 @@
 
     KeyframeList m_blendingKeyframes { emptyString() };
     HashSet<CSSPropertyID> m_animatedProperties;
+    HashSet<CSSPropertyID> m_inheritedProperties;
     Vector<ParsedKeyframe> m_parsedKeyframes;
     Vector<AcceleratedAction> m_pendingAcceleratedActions;
     RefPtr<Element> m_target;

Modified: trunk/Source/WebCore/animation/KeyframeEffectStack.cpp (290822 => 290823)


--- trunk/Source/WebCore/animation/KeyframeEffectStack.cpp	2022-03-04 08:42:45 UTC (rev 290822)
+++ trunk/Source/WebCore/animation/KeyframeEffectStack.cpp	2022-03-04 08:53:38 UTC (rev 290823)
@@ -27,6 +27,7 @@
 #include "KeyframeEffectStack.h"
 
 #include "CSSAnimation.h"
+#include "CSSPropertyAnimation.h"
 #include "CSSTransition.h"
 #include "KeyframeEffect.h"
 #include "WebAnimation.h"
@@ -143,7 +144,17 @@
     for (const auto& effect : sortedEffects()) {
         ASSERT(effect->animation());
 
-        if (propertyAffectingLogicalPropertiesChanged || fontSizeChanged)
+        auto inheritedPropertyChanged = [&]() {
+            if (previousLastStyleChangeEventStyle) {
+                for (auto property : effect->inheritedProperties()) {
+                    if (!CSSPropertyAnimation::propertiesEqual(property, *previousLastStyleChangeEventStyle, unanimatedStyle))
+                        return true;
+                }
+            }
+            return false;
+        };
+
+        if (propertyAffectingLogicalPropertiesChanged || fontSizeChanged || inheritedPropertyChanged())
             effect->propertyAffectingKeyframeResolutionDidChange(unanimatedStyle, resolutionContext);
 
         effect->animation()->resolve(targetStyle, resolutionContext);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to