Changeset 291537 in webkit
- Timestamp:
- Mar 19, 2022 8:18:09 PM (4 months ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/css/parse-border-image-repeat-null-crash-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-image-valid-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-image-valid.html (modified) (2 diffs)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/StyleProperties.cpp (modified) (4 diffs)
-
Source/WebCore/css/StyleProperties.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r291536 r291537 1 2022-03-19 Oriol Brufau <obrufau@igalia.com> 2 3 [cssom] Implement border-image serialization 4 https://bugs.webkit.org/show_bug.cgi?id=238102 5 6 Reviewed by Darin Adler. 7 8 Expect cssText to serialize border-image instead of longhands. 9 10 * fast/css/parse-border-image-repeat-null-crash-expected.txt: 11 1 12 2022-03-19 Oriol Brufau <obrufau@igalia.com> 2 13 -
trunk/LayoutTests/fast/css/parse-border-image-repeat-null-crash-expected.txt
r279050 r291537 1 CONSOLE MESSAGE: border-image -source: url("images/shadow-border.png"); border-image-slice: 10; border-image-repeat:stretch;1 CONSOLE MESSAGE: border-image: url("images/shadow-border.png") 10 stretch; 2 2 This test should not crash -
trunk/LayoutTests/imported/w3c/ChangeLog
r291527 r291537 1 2022-03-19 Oriol Brufau <obrufau@igalia.com> 2 3 [cssom] Implement border-image serialization 4 https://bugs.webkit.org/show_bug.cgi?id=238102 5 6 Reviewed by Darin Adler. 7 8 Let the test accept some equivalent serializations. 9 Expect it to pass. 10 11 * web-platform-tests/css/css-backgrounds/parsing/border-image-valid-expected.txt: 12 * web-platform-tests/css/css-backgrounds/parsing/border-image-valid.html: 13 1 14 2022-03-19 Antoine Quint <graouts@webkit.org> 2 15 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-image-valid-expected.txt
r255239 r291537 1 1 2 FAIL e.style['border-image'] = "none" should set the property value assert_not_equals: property should be set got disallowed value "" 3 FAIL e.style['border-image'] = "stretch" should set the property value assert_not_equals: property should be set got disallowed value "" 4 FAIL e.style['border-image'] = "none 100% / 1 / 0 stretch" should set the property value assert_not_equals: property should be set got disallowed value "" 5 FAIL e.style['border-image'] = "url(\"http://www.example.com/\") 1 2 3 4 fill" should set the property value assert_not_equals: property should be set got disallowed value "" 6 FAIL e.style['border-image'] = "url(\"http://www.example.com/\") 1 2 3 4 fill / 1 / 0 stretch" should set the property value assert_not_equals: property should be set got disallowed value "" 7 FAIL e.style['border-image'] = "url(\"http://www.example.com/\")" should set the property value assert_not_equals: property should be set got disallowed value "" 8 FAIL e.style['border-image'] = "repeat round" should set the property value assert_not_equals: property should be set got disallowed value "" 9 FAIL e.style['border-image'] = "none repeat round" should set the property value assert_not_equals: property should be set got disallowed value "" 10 FAIL e.style['border-image'] = "space" should set the property value assert_not_equals: property should be set got disallowed value "" 11 FAIL e.style['border-image'] = "none space space" should set the property value assert_not_equals: property should be set got disallowed value "" 12 FAIL e.style['border-image'] = "none 100% / 1 / 0 space" should set the property value assert_not_equals: property should be set got disallowed value "" 13 FAIL e.style['border-image'] = "1" should set the property value assert_not_equals: property should be set got disallowed value "" 14 FAIL e.style['border-image'] = "none 1 1 1 1" should set the property value assert_not_equals: property should be set got disallowed value "" 15 FAIL e.style['border-image'] = "none 1 / 1 / 0 stretch" should set the property value assert_not_equals: property should be set got disallowed value "" 16 FAIL e.style['border-image'] = "url(\"http://www.example.com/\") 1 2% 3 4%" should set the property value assert_not_equals: property should be set got disallowed value "" 17 FAIL e.style['border-image'] = "url(\"http://www.example.com/\") 1 2% 3 4% fill" should set the property value assert_not_equals: property should be set got disallowed value "" 18 FAIL e.style['border-image'] = "url(\"http://www.example.com/\") fill 1 2% 3 4%" should set the property value assert_not_equals: property should be set got disallowed value "" 19 FAIL e.style['border-image'] = "1 / 1px" should set the property value assert_not_equals: property should be set got disallowed value "" 20 FAIL e.style['border-image'] = "1 2% 3 4% / 2%" should set the property value assert_not_equals: property should be set got disallowed value "" 21 FAIL e.style['border-image'] = "1 2% 3 4% fill / 3" should set the property value assert_not_equals: property should be set got disallowed value "" 22 FAIL e.style['border-image'] = "fill 1 2% 3 4% / auto" should set the property value assert_not_equals: property should be set got disallowed value "" 23 FAIL e.style['border-image'] = "1 / 1px 2% 3 auto" should set the property value assert_not_equals: property should be set got disallowed value "" 24 FAIL e.style['border-image'] = "1 / / 1px" should set the property value assert_not_equals: property should be set got disallowed value "" 25 FAIL e.style['border-image'] = "1 2% 3 4% / / 2" should set the property value assert_not_equals: property should be set got disallowed value "" 26 FAIL e.style['border-image'] = "url(\"http://www.example.com/\") 1 2% 3 4% fill / / 1px 2 3px 4" should set the property value assert_not_equals: property should be set got disallowed value "" 27 FAIL e.style['border-image'] = "1 / 1px / 1px" should set the property value assert_not_equals: property should be set got disallowed value "" 28 FAIL e.style['border-image'] = "1 2% 3 4% / 2% / 2" should set the property value assert_not_equals: property should be set got disallowed value "" 29 FAIL e.style['border-image'] = "1 2% 3 4% fill / 3 / 1px 2 3px 4" should set the property value assert_not_equals: property should be set got disallowed value "" 30 FAIL e.style['border-image'] = "1 / auto / 1px" should set the property value assert_not_equals: property should be set got disallowed value "" 31 FAIL e.style['border-image'] = "1 2% 3 4% / 1px 2% 3 auto / 2" should set the property value assert_not_equals: property should be set got disallowed value "" 2 PASS e.style['border-image'] = "none" should set the property value 3 PASS e.style['border-image'] = "stretch" should set the property value 4 PASS e.style['border-image'] = "none 100% / 1 / 0 stretch" should set the property value 5 PASS e.style['border-image'] = "url(\"http://www.example.com/\") 1 2 3 4 fill" should set the property value 6 PASS e.style['border-image'] = "url(\"http://www.example.com/\") 1 2 3 4 fill / 1 / 0 stretch" should set the property value 7 PASS e.style['border-image'] = "url(\"http://www.example.com/\")" should set the property value 8 PASS e.style['border-image'] = "repeat round" should set the property value 9 PASS e.style['border-image'] = "none repeat round" should set the property value 10 PASS e.style['border-image'] = "space" should set the property value 11 PASS e.style['border-image'] = "none space space" should set the property value 12 PASS e.style['border-image'] = "none 100% / 1 / 0 space" should set the property value 13 PASS e.style['border-image'] = "1" should set the property value 14 PASS e.style['border-image'] = "none 1 1 1 1" should set the property value 15 PASS e.style['border-image'] = "none 1 / 1 / 0 stretch" should set the property value 16 PASS e.style['border-image'] = "url(\"http://www.example.com/\") 1 2% 3 4%" should set the property value 17 PASS e.style['border-image'] = "url(\"http://www.example.com/\") 1 2% 3 4% fill" should set the property value 18 PASS e.style['border-image'] = "url(\"http://www.example.com/\") fill 1 2% 3 4%" should set the property value 19 PASS e.style['border-image'] = "1 / 1px" should set the property value 20 PASS e.style['border-image'] = "1 2% 3 4% / 2%" should set the property value 21 PASS e.style['border-image'] = "1 2% 3 4% fill / 3" should set the property value 22 PASS e.style['border-image'] = "fill 1 2% 3 4% / auto" should set the property value 23 PASS e.style['border-image'] = "1 / 1px 2% 3 auto" should set the property value 24 PASS e.style['border-image'] = "1 / / 1px" should set the property value 25 PASS e.style['border-image'] = "1 2% 3 4% / / 2" should set the property value 26 PASS e.style['border-image'] = "url(\"http://www.example.com/\") 1 2% 3 4% fill / / 1px 2 3px 4" should set the property value 27 PASS e.style['border-image'] = "1 / 1px / 1px" should set the property value 28 PASS e.style['border-image'] = "1 2% 3 4% / 2% / 2" should set the property value 29 PASS e.style['border-image'] = "1 2% 3 4% fill / 3 / 1px 2 3px 4" should set the property value 30 PASS e.style['border-image'] = "1 / auto / 1px" should set the property value 31 PASS e.style['border-image'] = "1 2% 3 4% / 1px 2% 3 auto / 2" should set the property value 32 32 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-image-valid.html
r255239 r291537 17 17 // "none" in Edge, "none 100% / 1 / 0 stretch" in Firefox and Blink. 18 18 test_valid_value("border-image", "none", ["none", "none 100% / 1 / 0 stretch"]); 19 test_valid_value("border-image", "stretch", [" none", "none 100% / 1 / 0 stretch"]);19 test_valid_value("border-image", "stretch", ["stretch", "none", "none 100% / 1 / 0 stretch"]); 20 20 test_valid_value("border-image", "none 100% / 1 / 0 stretch", ["none", "none 100% / 1 / 0 stretch"]); 21 21 … … 29 29 30 30 test_valid_value("border-image", "space", ["space", "none space space", "none 100% / 1 / 0 space"]); 31 test_valid_value("border-image", "none space space", ["space", "none space space", "none 100% / 1 / 0 space"]);31 test_valid_value("border-image", "none space space", ["space", "none space space", "none space", "none 100% / 1 / 0 space"]); 32 32 test_valid_value("border-image", "none 100% / 1 / 0 space", ["space", "none space space", "none 100% / 1 / 0 space"]); 33 33 34 34 test_valid_value("border-image", "1", ["1", "none 1 1 1 1", "none 1 / 1 / 0 stretch"]); 35 test_valid_value("border-image", "none 1 1 1 1", ["1", "none 1 1 1 1", "none 1 / 1 / 0 stretch"]);35 test_valid_value("border-image", "none 1 1 1 1", ["1", "none 1 1 1 1", "none 1", "none 1 / 1 / 0 stretch"]); 36 36 test_valid_value("border-image", "none 1 / 1 / 0 stretch", ["1", "none 1 1 1 1", "none 1 / 1 / 0 stretch"]); 37 37 -
trunk/Source/WebCore/ChangeLog
r291536 r291537 1 2022-03-19 Oriol Brufau <obrufau@igalia.com> 2 3 [cssom] Implement border-image serialization 4 https://bugs.webkit.org/show_bug.cgi?id=238102 5 6 Reviewed by Darin Adler. 7 8 Add logic for serializing border-image at specified-value time. 9 10 Tests: fast/css/parse-border-image-repeat-null-crash.html 11 imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-image-valid.html 12 13 * css/StyleProperties.cpp: 14 (WebCore::StyleProperties::getPropertyValue const): 15 (WebCore::StyleProperties::borderImagePropertyValue const): 16 (WebCore::StyleProperties::asText const): 17 * css/StyleProperties.h: 18 1 19 2022-03-19 Oriol Brufau <obrufau@igalia.com> 2 20 -
trunk/Source/WebCore/css/StyleProperties.cpp
r291244 r291537 38 38 #include "Document.h" 39 39 #include "PropertySetCSSStyleDeclaration.h" 40 #include "Rect.h" 40 41 #include "StylePropertyShorthand.h" 41 42 #include "StylePropertyShorthandFunctions.h" … … 218 219 case CSSPropertyBorderBlockEnd: 219 220 return getShorthandValue(borderBlockEndShorthand()); 221 case CSSPropertyBorderImage: 222 return borderImagePropertyValue(); 220 223 case CSSPropertyBorderInline: 221 224 return borderPropertyValue(borderInlineWidthShorthand(), borderInlineStyleShorthand(), borderInlineColorShorthand()); … … 901 904 } 902 905 906 String StyleProperties::borderImagePropertyValue() const 907 { 908 const StylePropertyShorthand& shorthand = borderImageShorthand(); 909 StringBuilder result; 910 bool lastPropertyWasImportant = false; 911 bool omittedSlice = false; 912 bool omittedWidth = false; 913 String commonWideValueText; 914 auto separator = ""; 915 for (unsigned i = 0; i < shorthand.length(); ++i) { 916 // All longhands should have the same importance. 917 auto longhand = shorthand.properties()[i]; 918 bool currentPropertyIsImportant = propertyIsImportant(longhand); 919 if (i && lastPropertyWasImportant != currentPropertyIsImportant) 920 return String(); 921 lastPropertyWasImportant = currentPropertyIsImportant; 922 923 // All longhands should be present. 924 auto value = getPropertyCSSValue(longhand); 925 if (!value) 926 return String(); 927 928 // Omit implicit initial values. However, border-image-width and border-image-outset require border-image-slice. 929 if (value->isInitialValue() && isPropertyImplicit(longhand)) { 930 if (longhand == CSSPropertyBorderImageSlice) 931 omittedSlice = true; 932 else if (longhand == CSSPropertyBorderImageWidth) 933 omittedWidth = true; 934 continue; 935 } 936 if (omittedSlice && (longhand == CSSPropertyBorderImageWidth || longhand == CSSPropertyBorderImageOutset)) 937 return String(); 938 939 // If a longhand is set to a css-wide keyword, the others should be the same. 940 String valueText = value->cssText(); 941 if (isCSSWideValueKeyword(valueText)) { 942 if (!i) 943 commonWideValueText = valueText; 944 else if (commonWideValueText != valueText) 945 return String(); 946 continue; 947 } 948 if (!commonWideValueText.isNull()) 949 return String(); 950 951 // Append separator and text. 952 if (longhand == CSSPropertyBorderImageWidth) 953 separator = " / "; 954 else if (longhand == CSSPropertyBorderImageOutset) 955 separator = omittedWidth ? " / / " : " / "; 956 result.append(separator, valueText); 957 separator = " "; 958 } 959 if (!commonWideValueText.isNull()) 960 return commonWideValueText; 961 return result.toString(); 962 } 963 903 964 String StyleProperties::borderPropertyValue(const StylePropertyShorthand& width, const StylePropertyShorthand& style, const StylePropertyShorthand& color) const 904 965 { … … 1344 1405 shorthandPropertyID = CSSPropertyBorderSpacing; 1345 1406 break; 1407 case CSSPropertyBorderImageSource: 1408 case CSSPropertyBorderImageSlice: 1409 case CSSPropertyBorderImageWidth: 1410 case CSSPropertyBorderImageOutset: 1411 case CSSPropertyBorderImageRepeat: 1412 shorthandPropertyID = CSSPropertyBorderImage; 1413 break; 1346 1414 case CSSPropertyFontFamily: 1347 1415 case CSSPropertyLineHeight: -
trunk/Source/WebCore/css/StyleProperties.h
r289876 r291537 166 166 String getCommonValue(const StylePropertyShorthand&) const; 167 167 String getAlignmentShorthandValue(const StylePropertyShorthand&) const; 168 String borderImagePropertyValue() const; 168 169 String borderPropertyValue(const StylePropertyShorthand&, const StylePropertyShorthand&, const StylePropertyShorthand&) const; 169 170 String pageBreakPropertyValue(const StylePropertyShorthand&) const;
Note: See TracChangeset
for help on using the changeset viewer.