Title: [286652] trunk
Revision
286652
Author
[email protected]
Date
2021-12-08 05:51:18 -0800 (Wed, 08 Dec 2021)

Log Message

'border-radius shorthand is getting expanded in WebKit
https://bugs.webkit.org/show_bug.cgi?id=233960

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Add a new WPT to check the behavior of border-radius when serializing using cssText.

* web-platform-tests/css/css-backgrounds/border-radius-css-text-expected.txt: Added.
* web-platform-tests/css/css-backgrounds/border-radius-css-text.html: Added.

Source/WebCore:

Test: imported/w3c/web-platform-tests/css/css-backgrounds/border-radius-css-text.html

Use the border-radius shorthand property instead of individual longhands when serializing.

* css/StyleProperties.cpp:
(WebCore::StyleProperties::asText const):

LayoutTests:

Rebase an existing test now that we correctly use the shorthand in cssText for border-radius.

* fast/css/remove-shorthand-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (286651 => 286652)


--- trunk/LayoutTests/ChangeLog	2021-12-08 13:42:30 UTC (rev 286651)
+++ trunk/LayoutTests/ChangeLog	2021-12-08 13:51:18 UTC (rev 286652)
@@ -1,3 +1,14 @@
+2021-12-08  Antoine Quint  <[email protected]>
+
+        'border-radius shorthand is getting expanded in WebKit
+        https://bugs.webkit.org/show_bug.cgi?id=233960
+
+        Reviewed by Antti Koivisto.
+
+        Rebase an existing test now that we correctly use the shorthand in cssText for border-radius.
+
+        * fast/css/remove-shorthand-expected.txt:
+
 2021-12-08  Antti Koivisto  <[email protected]>
 
         [CSS Cascade Layers] import some new WPTs

Modified: trunk/LayoutTests/fast/css/remove-shorthand-expected.txt (286651 => 286652)


--- trunk/LayoutTests/fast/css/remove-shorthand-expected.txt	2021-12-08 13:42:30 UTC (rev 286651)
+++ trunk/LayoutTests/fast/css/remove-shorthand-expected.txt	2021-12-08 13:51:18 UTC (rev 286652)
@@ -33,10 +33,10 @@
 removes "border"
 and adds "border-style, border-color".
 Removing border-radius
-removes "border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius"
+removes "border-radius"
 and adds "".
 Removing -webkit-border-radius
-removes "border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius"
+removes "border-radius"
 and adds "".
 Removing border-spacing
 removes "border-spacing"

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (286651 => 286652)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-12-08 13:42:30 UTC (rev 286651)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-12-08 13:51:18 UTC (rev 286652)
@@ -1,3 +1,15 @@
+2021-12-08  Antoine Quint  <[email protected]>
+
+        'border-radius shorthand is getting expanded in WebKit
+        https://bugs.webkit.org/show_bug.cgi?id=233960
+
+        Reviewed by Antti Koivisto.
+
+        Add a new WPT to check the behavior of border-radius when serializing using cssText.
+
+        * web-platform-tests/css/css-backgrounds/border-radius-css-text-expected.txt: Added.
+        * web-platform-tests/css/css-backgrounds/border-radius-css-text.html: Added.
+
 2021-12-08  Antti Koivisto  <[email protected]>
 
         [CSS Cascade Layers] import some new WPTs

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/border-radius-css-text-expected.txt (0 => 286652)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/border-radius-css-text-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/border-radius-css-text-expected.txt	2021-12-08 13:51:18 UTC (rev 286652)
@@ -0,0 +1,3 @@
+
+PASS Setting border-radius does not expand to longhand properties in cssText.
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/border-radius-css-text.html (0 => 286652)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/border-radius-css-text.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/border-radius-css-text.html	2021-12-08 13:51:18 UTC (rev 286652)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Backgrounds and Borders Module Level 3: border-radius in cssText</title>
+<link rel="help" href=""
+<script src=""
+<script src=""
+</head>
+<body>
+<div id="test"></div>
+<script>
+test(() => {
+    const element = document.getElementById("test");
+    assert_equals(element.style.cssText, "", "cssText is initially empty");
+
+    element.style.borderRadius = "10px";
+    assert_equals(element.style.cssText, "border-radius: 10px;");
+
+    element.style.borderTopLeftRadius = "20px";
+    assert_equals(element.style.cssText, "border-radius: 20px 10px 10px;");
+
+    element.style.borderBottomLeftRadius = "30px";
+    assert_equals(element.style.cssText, "border-radius: 20px 10px 10px 30px;");
+}, "Setting border-radius does not expand to longhand properties in cssText.");
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (286651 => 286652)


--- trunk/Source/WebCore/ChangeLog	2021-12-08 13:42:30 UTC (rev 286651)
+++ trunk/Source/WebCore/ChangeLog	2021-12-08 13:51:18 UTC (rev 286652)
@@ -1,3 +1,17 @@
+2021-12-08  Antoine Quint  <[email protected]>
+
+        'border-radius shorthand is getting expanded in WebKit
+        https://bugs.webkit.org/show_bug.cgi?id=233960
+
+        Reviewed by Antti Koivisto.
+
+        Test: imported/w3c/web-platform-tests/css/css-backgrounds/border-radius-css-text.html
+
+        Use the border-radius shorthand property instead of individual longhands when serializing.
+
+        * css/StyleProperties.cpp:
+        (WebCore::StyleProperties::asText const):
+
 2021-12-08  Youenn Fablet  <[email protected]>
 
         Let RemoteAudioMediaStreamTrackRendererInternalUnitManager::Unit switch to VPIO unit if VPIO is running

Modified: trunk/Source/WebCore/css/StyleProperties.cpp (286651 => 286652)


--- trunk/Source/WebCore/css/StyleProperties.cpp	2021-12-08 13:42:30 UTC (rev 286651)
+++ trunk/Source/WebCore/css/StyleProperties.cpp	2021-12-08 13:51:18 UTC (rev 286652)
@@ -1168,7 +1168,7 @@
             if (!shorthandPropertyID)
                 shorthandPropertyID = fallbackProperty;
         };
-        
+
         if (is<CSSPendingSubstitutionValue>(property.value())) {
             auto& substitutionValue = downcast<CSSPendingSubstitutionValue>(*property.value());
             shorthandPropertyID = substitutionValue.shorthandPropertyId();
@@ -1245,6 +1245,12 @@
                 if (!borderInlineFallbackShorthandProperty)
                     borderInlineFallbackShorthandProperty = CSSPropertyBorderInlineStyle;
                 FALLTHROUGH;
+            case CSSPropertyBorderTopLeftRadius:
+            case CSSPropertyBorderTopRightRadius:
+            case CSSPropertyBorderBottomRightRadius:
+            case CSSPropertyBorderBottomLeftRadius:
+                shorthandPropertyID = CSSPropertyBorderRadius;
+                break;
             case CSSPropertyBorderInlineStartColor:
             case CSSPropertyBorderInlineEndColor:
                 if (!borderInlineFallbackShorthandProperty)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to