Title: [214383] trunk
Revision
214383
Author
[email protected]
Date
2017-03-24 16:16:52 -0700 (Fri, 24 Mar 2017)

Log Message

Serialization of custom props in longhand should be "" not value of shorthand
https://bugs.webkit.org/show_bug.cgi?id=167699
<rdar://problem/30324200>

Reviewed by Sam Weinig.

Source/WebCore:

https://www.w3.org/TR/css-variables/#variables-in-shorthands says
"Pending-substitution values must be serialized as the empty string, if
an API allows them to be observed."

We were returning the cssText instead.

Test: fast/css/variables/rule-property-get.html has been updated.

* css/StyleProperties.cpp:
(WebCore::StyleProperties::getPropertyValue): Return the empty string
if we're a pending substitution value.

LayoutTests:

* fast/css/variables/rule-property-get-expected.html:
* fast/css/variables/rule-property-get.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (214382 => 214383)


--- trunk/LayoutTests/ChangeLog	2017-03-24 23:09:41 UTC (rev 214382)
+++ trunk/LayoutTests/ChangeLog	2017-03-24 23:16:52 UTC (rev 214383)
@@ -1,3 +1,14 @@
+2017-03-24  Dean Jackson  <[email protected]>
+
+        Serialization of custom props in longhand should be "" not value of shorthand
+        https://bugs.webkit.org/show_bug.cgi?id=167699
+        <rdar://problem/30324200>
+
+        Reviewed by Sam Weinig.
+
+        * fast/css/variables/rule-property-get-expected.html:
+        * fast/css/variables/rule-property-get.html:
+
 2017-03-24  Antoine Quint  <[email protected]>
 
         [Modern Media Controls] Captions don't move with the appearance of the inline controls

Modified: trunk/LayoutTests/fast/css/variables/rule-property-get-expected.html (214382 => 214383)


--- trunk/LayoutTests/fast/css/variables/rule-property-get-expected.html	2017-03-24 23:09:41 UTC (rev 214382)
+++ trunk/LayoutTests/fast/css/variables/rule-property-get-expected.html	2017-03-24 23:16:52 UTC (rev 214383)
@@ -1,5 +1,4 @@
 <html>
 <body style="background-color:green">
-var(--bgcolor)
 </body>
 </html>

Modified: trunk/LayoutTests/fast/css/variables/rule-property-get.html (214382 => 214383)


--- trunk/LayoutTests/fast/css/variables/rule-property-get.html	2017-03-24 23:09:41 UTC (rev 214382)
+++ trunk/LayoutTests/fast/css/variables/rule-property-get.html	2017-03-24 23:16:52 UTC (rev 214383)
@@ -5,6 +5,10 @@
 </style>
 <body>
 <script>
+/* https://www.w3.org/TR/css-variables/#variables-in-shorthands
+   "Pending-substitution values must be serialized as the empty string, if an API allows them to be observed."
+   This means getting the shorthand value for background directly from the style rule or element.style
+   should produce an empty string if the property contains a variable. */
 document.write(document.styleSheets[0].cssRules[0].style.getPropertyValue("background"))
 </script>
 </body>

Modified: trunk/Source/WebCore/ChangeLog (214382 => 214383)


--- trunk/Source/WebCore/ChangeLog	2017-03-24 23:09:41 UTC (rev 214382)
+++ trunk/Source/WebCore/ChangeLog	2017-03-24 23:16:52 UTC (rev 214383)
@@ -1,3 +1,23 @@
+2017-03-24  Dean Jackson  <[email protected]>
+
+        Serialization of custom props in longhand should be "" not value of shorthand
+        https://bugs.webkit.org/show_bug.cgi?id=167699
+        <rdar://problem/30324200>
+
+        Reviewed by Sam Weinig.
+
+        https://www.w3.org/TR/css-variables/#variables-in-shorthands says
+        "Pending-substitution values must be serialized as the empty string, if
+        an API allows them to be observed."
+
+        We were returning the cssText instead.
+
+        Test: fast/css/variables/rule-property-get.html has been updated.
+
+        * css/StyleProperties.cpp:
+        (WebCore::StyleProperties::getPropertyValue): Return the empty string
+        if we're a pending substitution value.
+
 2017-03-24  Wenson Hsieh  <[email protected]>
 
         Unreviewed, fix the ToT build on the latest SDK.

Modified: trunk/Source/WebCore/css/StyleProperties.cpp (214382 => 214383)


--- trunk/Source/WebCore/css/StyleProperties.cpp	2017-03-24 23:09:41 UTC (rev 214382)
+++ trunk/Source/WebCore/css/StyleProperties.cpp	2017-03-24 23:16:52 UTC (rev 214383)
@@ -131,10 +131,8 @@
     const StylePropertyShorthand& shorthand = shorthandForProperty(propertyID);
     if (shorthand.length()) {
         RefPtr<CSSValue> value = getPropertyCSSValueInternal(shorthand.properties()[0]);
-        if (!value)
+        if (!value || value->isPendingSubstitutionValue())
             return String();
-        if (value->isPendingSubstitutionValue())
-            return downcast<CSSPendingSubstitutionValue>(*value).shorthandValue()->cssText();
     }
 
     // Shorthand and 4-values properties
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to