Skip to content

Commit ba49d5d

Browse files
committed
[@Property] Check for computational dependencies in transform functions
https://bugs.webkit.org/show_bug.cgi?id=251141 rdar://104553316 Reviewed by Tim Nguyen. trasnlateX(1em) is not computationally independent and can't be used as an initial value. * LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/at-property-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/at-property.html: * Source/WebCore/css/CSSValue.cpp: (WebCore::CSSValue::collectComputedStyleDependencies const): Collect from function argument lists. Canonical link: https://commits.webkit.org/259353@main
1 parent e233e41 commit ba49d5d

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/at-property-expected.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ PASS Rule not applied [<gandalf>, grey, false]
5656
PASS Rule not applied [gandalf, grey, false]
5757
PASS Rule not applied [<color>, notacolor, false]
5858
PASS Rule not applied [<length>, 10em, false]
59+
PASS Rule not applied [<transform-function>, translateX(1em), false]
60+
PASS Rule not applied [<transform-function>, translateY(1lh), false]
61+
PASS Rule not applied [<transform-list>, rotate(10deg) translateX(1em), false]
62+
PASS Rule not applied [<transform-list>, rotate(10deg) translateY(1lh), false]
5963
PASS Non-inherited properties do not inherit
6064
PASS Inherited properties inherit
6165
PASS Initial values substituted as computed value

LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/at-property.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@
148148
test_not_applied('<color>', 'notacolor', false);
149149
test_not_applied('<length>', '10em', false);
150150

151+
test_not_applied('<transform-function>', 'translateX(1em)', false);
152+
test_not_applied('<transform-function>', 'translateY(1lh)', false);
153+
test_not_applied('<transform-list>', 'rotate(10deg) translateX(1em)', false);
154+
test_not_applied('<transform-list>', 'rotate(10deg) translateY(1lh)', false);
155+
151156
// Inheritance
152157

153158
test_with_at_property({

Source/WebCore/css/CSSValue.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,13 @@ void CSSValue::collectComputedStyleDependencies(ComputedStyleDependencies& depen
236236
listValue->collectComputedStyleDependencies(dependencies);
237237
return;
238238
}
239-
240-
if (is<CSSPrimitiveValue>(*this))
241-
downcast<CSSPrimitiveValue>(*this).collectComputedStyleDependencies(dependencies);
239+
if (auto* asFunction = dynamicDowncast<CSSFunctionValue>(*this)) {
240+
for (auto& argument : *asFunction)
241+
argument->collectComputedStyleDependencies(dependencies);
242+
return;
243+
}
244+
if (auto* asPrimitiveValue = dynamicDowncast<CSSPrimitiveValue>(*this))
245+
asPrimitiveValue->collectComputedStyleDependencies(dependencies);
242246
}
243247

244248
bool CSSValue::equals(const CSSValue& other) const

0 commit comments

Comments
 (0)