Diff
Modified: trunk/LayoutTests/ChangeLog (291536 => 291537)
--- trunk/LayoutTests/ChangeLog 2022-03-20 02:18:04 UTC (rev 291536)
+++ trunk/LayoutTests/ChangeLog 2022-03-20 03:18:09 UTC (rev 291537)
@@ -1,5 +1,16 @@
2022-03-19 Oriol Brufau <obru...@igalia.com>
+ [cssom] Implement border-image serialization
+ https://bugs.webkit.org/show_bug.cgi?id=238102
+
+ Reviewed by Darin Adler.
+
+ Expect cssText to serialize border-image instead of longhands.
+
+ * fast/css/parse-border-image-repeat-null-crash-expected.txt:
+
+2022-03-19 Oriol Brufau <obru...@igalia.com>
+
Fix hasExplicitlySetBorderRadius flag
https://bugs.webkit.org/show_bug.cgi?id=238062
Modified: trunk/LayoutTests/fast/css/parse-border-image-repeat-null-crash-expected.txt (291536 => 291537)
--- trunk/LayoutTests/fast/css/parse-border-image-repeat-null-crash-expected.txt 2022-03-20 02:18:04 UTC (rev 291536)
+++ trunk/LayoutTests/fast/css/parse-border-image-repeat-null-crash-expected.txt 2022-03-20 03:18:09 UTC (rev 291537)
@@ -1,2 +1,2 @@
-CONSOLE MESSAGE: border-image-source: url("images/shadow-border.png"); border-image-slice: 10; border-image-repeat: stretch;
+CONSOLE MESSAGE: border-image: url("images/shadow-border.png") 10 stretch;
This test should not crash
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (291536 => 291537)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-03-20 02:18:04 UTC (rev 291536)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-03-20 03:18:09 UTC (rev 291537)
@@ -1,3 +1,16 @@
+2022-03-19 Oriol Brufau <obru...@igalia.com>
+
+ [cssom] Implement border-image serialization
+ https://bugs.webkit.org/show_bug.cgi?id=238102
+
+ Reviewed by Darin Adler.
+
+ Let the test accept some equivalent serializations.
+ Expect it to pass.
+
+ * web-platform-tests/css/css-backgrounds/parsing/border-image-valid-expected.txt:
+ * web-platform-tests/css/css-backgrounds/parsing/border-image-valid.html:
+
2022-03-19 Antoine Quint <grao...@webkit.org>
Dialog element only animates once
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-image-valid-expected.txt (291536 => 291537)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-image-valid-expected.txt 2022-03-20 02:18:04 UTC (rev 291536)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-image-valid-expected.txt 2022-03-20 03:18:09 UTC (rev 291537)
@@ -1,32 +1,32 @@
-FAIL e.style['border-image'] = "none" should set the property value assert_not_equals: property should be set got disallowed value ""
-FAIL e.style['border-image'] = "stretch" should set the property value assert_not_equals: property should be set got disallowed value ""
-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 ""
-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 ""
-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 ""
-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 ""
-FAIL e.style['border-image'] = "repeat round" should set the property value assert_not_equals: property should be set got disallowed value ""
-FAIL e.style['border-image'] = "none repeat round" should set the property value assert_not_equals: property should be set got disallowed value ""
-FAIL e.style['border-image'] = "space" should set the property value assert_not_equals: property should be set got disallowed value ""
-FAIL e.style['border-image'] = "none space space" should set the property value assert_not_equals: property should be set got disallowed value ""
-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 ""
-FAIL e.style['border-image'] = "1" should set the property value assert_not_equals: property should be set got disallowed value ""
-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 ""
-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 ""
-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 ""
-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 ""
-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 ""
-FAIL e.style['border-image'] = "1 / 1px" should set the property value assert_not_equals: property should be set got disallowed value ""
-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 ""
-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 ""
-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 ""
-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 ""
-FAIL e.style['border-image'] = "1 / / 1px" should set the property value assert_not_equals: property should be set got disallowed value ""
-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 ""
-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 ""
-FAIL e.style['border-image'] = "1 / 1px / 1px" should set the property value assert_not_equals: property should be set got disallowed value ""
-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 ""
-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 ""
-FAIL e.style['border-image'] = "1 / auto / 1px" should set the property value assert_not_equals: property should be set got disallowed value ""
-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 ""
+PASS e.style['border-image'] = "none" should set the property value
+PASS e.style['border-image'] = "stretch" should set the property value
+PASS e.style['border-image'] = "none 100% / 1 / 0 stretch" should set the property value
+PASS e.style['border-image'] = "url(\"http://www.example.com/\") 1 2 3 4 fill" should set the property value
+PASS e.style['border-image'] = "url(\"http://www.example.com/\") 1 2 3 4 fill / 1 / 0 stretch" should set the property value
+PASS e.style['border-image'] = "url(\"http://www.example.com/\")" should set the property value
+PASS e.style['border-image'] = "repeat round" should set the property value
+PASS e.style['border-image'] = "none repeat round" should set the property value
+PASS e.style['border-image'] = "space" should set the property value
+PASS e.style['border-image'] = "none space space" should set the property value
+PASS e.style['border-image'] = "none 100% / 1 / 0 space" should set the property value
+PASS e.style['border-image'] = "1" should set the property value
+PASS e.style['border-image'] = "none 1 1 1 1" should set the property value
+PASS e.style['border-image'] = "none 1 / 1 / 0 stretch" should set the property value
+PASS e.style['border-image'] = "url(\"http://www.example.com/\") 1 2% 3 4%" should set the property value
+PASS e.style['border-image'] = "url(\"http://www.example.com/\") 1 2% 3 4% fill" should set the property value
+PASS e.style['border-image'] = "url(\"http://www.example.com/\") fill 1 2% 3 4%" should set the property value
+PASS e.style['border-image'] = "1 / 1px" should set the property value
+PASS e.style['border-image'] = "1 2% 3 4% / 2%" should set the property value
+PASS e.style['border-image'] = "1 2% 3 4% fill / 3" should set the property value
+PASS e.style['border-image'] = "fill 1 2% 3 4% / auto" should set the property value
+PASS e.style['border-image'] = "1 / 1px 2% 3 auto" should set the property value
+PASS e.style['border-image'] = "1 / / 1px" should set the property value
+PASS e.style['border-image'] = "1 2% 3 4% / / 2" should set the property value
+PASS e.style['border-image'] = "url(\"http://www.example.com/\") 1 2% 3 4% fill / / 1px 2 3px 4" should set the property value
+PASS e.style['border-image'] = "1 / 1px / 1px" should set the property value
+PASS e.style['border-image'] = "1 2% 3 4% / 2% / 2" should set the property value
+PASS e.style['border-image'] = "1 2% 3 4% fill / 3 / 1px 2 3px 4" should set the property value
+PASS e.style['border-image'] = "1 / auto / 1px" should set the property value
+PASS e.style['border-image'] = "1 2% 3 4% / 1px 2% 3 auto / 2" should set the property value
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-image-valid.html (291536 => 291537)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-image-valid.html 2022-03-20 02:18:04 UTC (rev 291536)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-image-valid.html 2022-03-20 03:18:09 UTC (rev 291537)
@@ -16,7 +16,7 @@
// "none" in Edge, "none 100% / 1 / 0 stretch" in Firefox and Blink.
test_valid_value("border-image", "none", ["none", "none 100% / 1 / 0 stretch"]);
-test_valid_value("border-image", "stretch", ["none", "none 100% / 1 / 0 stretch"]);
+test_valid_value("border-image", "stretch", ["stretch", "none", "none 100% / 1 / 0 stretch"]);
test_valid_value("border-image", "none 100% / 1 / 0 stretch", ["none", "none 100% / 1 / 0 stretch"]);
test_valid_value("border-image", 'url("http://www.example.com/") 1 2 3 4 fill', ['url("http://www.example.com/") 1 2 3 4 fill', 'url("http://www.example.com/") 1 2 3 4 fill / 1 / 0 stretch']);
@@ -28,11 +28,11 @@
test_valid_value("border-image", "none repeat round", ["repeat round", "none repeat round", "none 100% / 1 / 0 repeat round"]);
test_valid_value("border-image", "space", ["space", "none space space", "none 100% / 1 / 0 space"]);
-test_valid_value("border-image", "none space space", ["space", "none space space", "none 100% / 1 / 0 space"]);
+test_valid_value("border-image", "none space space", ["space", "none space space", "none space", "none 100% / 1 / 0 space"]);
test_valid_value("border-image", "none 100% / 1 / 0 space", ["space", "none space space", "none 100% / 1 / 0 space"]);
test_valid_value("border-image", "1", ["1", "none 1 1 1 1", "none 1 / 1 / 0 stretch"]);
-test_valid_value("border-image", "none 1 1 1 1", ["1", "none 1 1 1 1", "none 1 / 1 / 0 stretch"]);
+test_valid_value("border-image", "none 1 1 1 1", ["1", "none 1 1 1 1", "none 1", "none 1 / 1 / 0 stretch"]);
test_valid_value("border-image", "none 1 / 1 / 0 stretch", ["1", "none 1 1 1 1", "none 1 / 1 / 0 stretch"]);
test_valid_value("border-image", 'url("http://www.example.com/") 1 2% 3 4%', ['url("http://www.example.com/") 1 2% 3 4%', 'url("http://www.example.com/") 1 2% 3 4% / 1 / 0 stretch']);
Modified: trunk/Source/WebCore/ChangeLog (291536 => 291537)
--- trunk/Source/WebCore/ChangeLog 2022-03-20 02:18:04 UTC (rev 291536)
+++ trunk/Source/WebCore/ChangeLog 2022-03-20 03:18:09 UTC (rev 291537)
@@ -1,5 +1,23 @@
2022-03-19 Oriol Brufau <obru...@igalia.com>
+ [cssom] Implement border-image serialization
+ https://bugs.webkit.org/show_bug.cgi?id=238102
+
+ Reviewed by Darin Adler.
+
+ Add logic for serializing border-image at specified-value time.
+
+ Tests: fast/css/parse-border-image-repeat-null-crash.html
+ imported/w3c/web-platform-tests/css/css-backgrounds/parsing/border-image-valid.html
+
+ * css/StyleProperties.cpp:
+ (WebCore::StyleProperties::getPropertyValue const):
+ (WebCore::StyleProperties::borderImagePropertyValue const):
+ (WebCore::StyleProperties::asText const):
+ * css/StyleProperties.h:
+
+2022-03-19 Oriol Brufau <obru...@igalia.com>
+
Fix hasExplicitlySetBorderRadius flag
https://bugs.webkit.org/show_bug.cgi?id=238062
Modified: trunk/Source/WebCore/css/StyleProperties.cpp (291536 => 291537)
--- trunk/Source/WebCore/css/StyleProperties.cpp 2022-03-20 02:18:04 UTC (rev 291536)
+++ trunk/Source/WebCore/css/StyleProperties.cpp 2022-03-20 03:18:09 UTC (rev 291537)
@@ -37,6 +37,7 @@
#include "Color.h"
#include "Document.h"
#include "PropertySetCSSStyleDeclaration.h"
+#include "Rect.h"
#include "StylePropertyShorthand.h"
#include "StylePropertyShorthandFunctions.h"
#include "StyleSheetContents.h"
@@ -217,6 +218,8 @@
return getShorthandValue(borderBlockStartShorthand());
case CSSPropertyBorderBlockEnd:
return getShorthandValue(borderBlockEndShorthand());
+ case CSSPropertyBorderImage:
+ return borderImagePropertyValue();
case CSSPropertyBorderInline:
return borderPropertyValue(borderInlineWidthShorthand(), borderInlineStyleShorthand(), borderInlineColorShorthand());
case CSSPropertyBorderInlineColor:
@@ -900,6 +903,64 @@
return value;
}
+String StyleProperties::borderImagePropertyValue() const
+{
+ const StylePropertyShorthand& shorthand = borderImageShorthand();
+ StringBuilder result;
+ bool lastPropertyWasImportant = false;
+ bool omittedSlice = false;
+ bool omittedWidth = false;
+ String commonWideValueText;
+ auto separator = "";
+ for (unsigned i = 0; i < shorthand.length(); ++i) {
+ // All longhands should have the same importance.
+ auto longhand = shorthand.properties()[i];
+ bool currentPropertyIsImportant = propertyIsImportant(longhand);
+ if (i && lastPropertyWasImportant != currentPropertyIsImportant)
+ return String();
+ lastPropertyWasImportant = currentPropertyIsImportant;
+
+ // All longhands should be present.
+ auto value = getPropertyCSSValue(longhand);
+ if (!value)
+ return String();
+
+ // Omit implicit initial values. However, border-image-width and border-image-outset require border-image-slice.
+ if (value->isInitialValue() && isPropertyImplicit(longhand)) {
+ if (longhand == CSSPropertyBorderImageSlice)
+ omittedSlice = true;
+ else if (longhand == CSSPropertyBorderImageWidth)
+ omittedWidth = true;
+ continue;
+ }
+ if (omittedSlice && (longhand == CSSPropertyBorderImageWidth || longhand == CSSPropertyBorderImageOutset))
+ return String();
+
+ // If a longhand is set to a css-wide keyword, the others should be the same.
+ String valueText = value->cssText();
+ if (isCSSWideValueKeyword(valueText)) {
+ if (!i)
+ commonWideValueText = valueText;
+ else if (commonWideValueText != valueText)
+ return String();
+ continue;
+ }
+ if (!commonWideValueText.isNull())
+ return String();
+
+ // Append separator and text.
+ if (longhand == CSSPropertyBorderImageWidth)
+ separator = " / ";
+ else if (longhand == CSSPropertyBorderImageOutset)
+ separator = omittedWidth ? " / / " : " / ";
+ result.append(separator, valueText);
+ separator = " ";
+ }
+ if (!commonWideValueText.isNull())
+ return commonWideValueText;
+ return result.toString();
+}
+
String StyleProperties::borderPropertyValue(const StylePropertyShorthand& width, const StylePropertyShorthand& style, const StylePropertyShorthand& color) const
{
const StylePropertyShorthand properties[3] = { width, style, color };
@@ -1343,6 +1404,13 @@
case CSSPropertyWebkitBorderVerticalSpacing:
shorthandPropertyID = CSSPropertyBorderSpacing;
break;
+ case CSSPropertyBorderImageSource:
+ case CSSPropertyBorderImageSlice:
+ case CSSPropertyBorderImageWidth:
+ case CSSPropertyBorderImageOutset:
+ case CSSPropertyBorderImageRepeat:
+ shorthandPropertyID = CSSPropertyBorderImage;
+ break;
case CSSPropertyFontFamily:
case CSSPropertyLineHeight:
case CSSPropertyFontSize:
Modified: trunk/Source/WebCore/css/StyleProperties.h (291536 => 291537)
--- trunk/Source/WebCore/css/StyleProperties.h 2022-03-20 02:18:04 UTC (rev 291536)
+++ trunk/Source/WebCore/css/StyleProperties.h 2022-03-20 03:18:09 UTC (rev 291537)
@@ -165,6 +165,7 @@
String getShorthandValue(const StylePropertyShorthand&, const char* separator = " ") const;
String getCommonValue(const StylePropertyShorthand&) const;
String getAlignmentShorthandValue(const StylePropertyShorthand&) const;
+ String borderImagePropertyValue() const;
String borderPropertyValue(const StylePropertyShorthand&, const StylePropertyShorthand&, const StylePropertyShorthand&) const;
String pageBreakPropertyValue(const StylePropertyShorthand&) const;
String getLayeredShorthandValue(const StylePropertyShorthand&) const;