Changeset 285015 in webkit
- Timestamp:
- Oct 28, 2021 7:19:51 PM (9 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 2 deleted
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/css3/short-hand-var-serialization-expected.txt (added)
-
LayoutTests/css3/short-hand-var-serialization.html (added)
-
LayoutTests/fast/css/variables/rule-property-get-expected.html (deleted)
-
LayoutTests/fast/css/variables/rule-property-get.html (deleted)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logicalprops-with-variables-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-reference-shorthands-cssom-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-reference-shorthands-expected.txt (modified) (2 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-serialization-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/StyleProperties.cpp (modified) (2 diffs)
-
Source/WebCore/css/StyleProperties.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r285011 r285015 1 2021-10-28 Nikos Mouchtaris <nmouchtaris@apple.com> 2 3 if border-radius includes a var(), the value is not readable from .style 4 https://bugs.webkit.org/show_bug.cgi?id=230389 5 6 Reviewed by Myles Maxfield. 7 8 * css3/short-hand-var-serialization-expected.txt: Added. 9 * css3/short-hand-var-serialization.html: Added. 10 1 11 2021-10-28 Arcady Goldmints-Orlov <agoldmints@igalia.com> 2 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-logical/logicalprops-with-variables-expected.txt
r276837 r285015 2 2 PASS Logical longhands with variables - margin-inline-start 3 3 PASS Logical longhands with variables - margin-inline-end 4 FAIL Logical longhands with variables - margin-inline assert_equals: Specified value expected "" but got "var(--one) var(--two)" 4 PASS Logical longhands with variables - margin-inline 5 5 PASS Logical shorthand with 1 variable - margin-inline-start 6 6 PASS Logical shorthand with 1 variable - margin-inline-end 7 FAIL Logical shorthand with 1 variable - margin-inline assert_equals: Specified value expected "var(--one)" but got "" 7 PASS Logical shorthand with 1 variable - margin-inline 8 8 PASS Logical shorthand with 2 variables - margin-inline-start 9 9 PASS Logical shorthand with 2 variables - margin-inline-end 10 FAIL Logical shorthand with 2 variables - margin-inline assert_equals: Specified value expected "var(--one) var(--two)" but got "" 10 PASS Logical shorthand with 2 variables - margin-inline 11 11 PASS Logical shorthand with 1 variable and 1 length - margin-inline-start 12 12 PASS Logical shorthand with 1 variable and 1 length - margin-inline-end 13 FAIL Logical shorthand with 1 variable and 1 length - margin-inline assert_equals: Specified value expected "var(--one) 2px" but got "" 13 PASS Logical shorthand with 1 variable and 1 length - margin-inline 14 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-reference-shorthands-cssom-expected.txt
r271706 r285015 1 1 2 FAIL CSS variable references - shorthand properties - via CSSOM assert_equals: margin property value after calling setProperty expected "var(--prop)" but got "" 2 PASS CSS variable references - shorthand properties - via CSSOM 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-reference-shorthands-expected.txt
r271706 r285015 1 1 2 FAIL target1 margin assert_equals: expected "" but got "10px" 2 PASS target1 margin 3 3 PASS target1 margin-left 4 4 PASS target1 margin-top 5 5 PASS target1 margin-right 6 6 PASS target1 margin-bottom 7 FAIL target2 margin assert_equals: expected "var(--prop)" but got "" 7 PASS target2 margin 8 8 PASS target2 margin-left 9 9 PASS target2 margin-top … … 15 15 PASS target3 margin-right 16 16 PASS target3 margin-bottom 17 FAIL target4 background assert_equals: expected "var(--prop)" but got "" 17 PASS target4 background 18 18 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-serialization-expected.txt
r267650 r285015 9 9 PASS Shorthand serialization with shorthand and longhands mixed. 10 10 PASS Shorthand serialization with just longhands. 11 FAIL Shorthand serialization with variable and variable from other shorthand. assert_equals: expected "var(--a)" but got "" 11 PASS Shorthand serialization with variable and variable from other shorthand. 12 12 PASS Shorthand serialization after setting 13 13 FAIL Shorthand serialization with 'initial' value. assert_equals: expected "margin: initial;" but got "" -
trunk/Source/WebCore/ChangeLog
r285012 r285015 1 2021-10-28 Nikos Mouchtaris <nmouchtaris@apple.com> 2 3 if border-radius includes a var(), the value is not readable from .style 4 https://bugs.webkit.org/show_bug.cgi?id=230389 5 6 Reviewed by Myles Maxfield. 7 8 Return correct string for shorthand CSS values set by var. Add extra checks for if all 9 longhand properties are pending values and if the requested shorthand property was set 10 to a variable. 11 12 Test: css3/short-hand-var-serialization.html 13 14 * css/StyleProperties.cpp: 15 (WebCore::StyleProperties::getPropertyValue const): 16 1 17 2021-10-28 Chris Dumez <cdumez@apple.com> 2 18 -
trunk/Source/WebCore/css/StyleProperties.cpp
r284857 r285015 126 126 } 127 127 128 bool StyleProperties::shorthandHasVariableReference(CSSPropertyID propertyID, String& shorthandValue) const 129 { 130 auto shorthand = shorthandForProperty(propertyID); 131 if (shorthand.length()) { 132 size_t numSetFromShorthand = 0; 133 // Checks for shorthand property if any of its longhand properties have set to a variable 134 // or are all pending substitution 135 for (size_t i = 0; i < shorthand.length(); i++) { 136 auto cssPropertyValue = getPropertyCSSValue(shorthand.properties()[i]); 137 138 auto hasBeenSetFromLonghand = is<CSSVariableReferenceValue>(cssPropertyValue); 139 auto hasBeenSetFromShorthand = is<CSSPendingSubstitutionValue>(cssPropertyValue); 140 auto hasNotBeenSetFromRequestedShorthand = hasBeenSetFromShorthand && downcast<CSSPendingSubstitutionValue>(*cssPropertyValue).shorthandPropertyId() != propertyID; 141 142 // Request for shorthand value should return empty string if any longhand values have been 143 // set to a variable or if they were set to a variable by a different shorthand. 144 if (hasBeenSetFromLonghand || hasNotBeenSetFromRequestedShorthand) 145 return true; 146 if (hasBeenSetFromShorthand) 147 numSetFromShorthand += 1; 148 } 149 if (numSetFromShorthand) { 150 if (numSetFromShorthand != shorthand.length()) 151 return true; 152 shorthandValue = downcast<CSSPendingSubstitutionValue>(* getPropertyCSSValue(shorthand.properties()[0])).shorthandValue().cssText(); 153 return true; 154 } 155 } 156 return false; 157 } 158 128 159 String StyleProperties::getPropertyValue(CSSPropertyID propertyID) const 129 160 { … … 145 176 146 177 { 147 auto shorthand = shorthandForProperty(propertyID);148 if (shorthand .length() && is<CSSPendingSubstitutionValue>(getPropertyCSSValue(shorthand.properties()[0])))149 return String();178 auto shorthandValue = String(); 179 if (shorthandHasVariableReference(propertyID, shorthandValue)) 180 return shorthandValue; 150 181 } 151 182 -
trunk/Source/WebCore/css/StyleProperties.h
r284857 r285015 176 176 String textDecorationSkipValue() const; 177 177 void appendFontLonghandValueIfExplicit(CSSPropertyID, StringBuilder& result, String& value) const; 178 bool shorthandHasVariableReference(CSSPropertyID, String&) const; 178 179 179 180 friend class PropertySetCSSStyleDeclaration;
Note: See TracChangeset
for help on using the changeset viewer.