Title: [235658] trunk
Revision
235658
Author
commit-qu...@webkit.org
Date
2018-09-04 22:02:53 -0700 (Tue, 04 Sep 2018)

Log Message

Check important flags when serializing shorthand with "initial" values
https://bugs.webkit.org/show_bug.cgi?id=188984

Patch by Oriol Brufau <obru...@igalia.com> on 2018-09-04
Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

The test still has some failures due to https://bugs.webkit.org/show_bug.cgi?id=185953
but without this patch it would fail earlier.

* web-platform-tests/css/cssom/shorthand-serialization-expected.txt:
* web-platform-tests/css/cssom/shorthand-serialization.html:

Source/WebCore:

Test: imported/w3c/web-platform-tests/css/cssom/shorthand-serialization.html

The test still has some failures due to https://bugs.webkit.org/show_bug.cgi?id=185953
but without this patch it would fail earlier.

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

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (235657 => 235658)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-09-05 04:32:59 UTC (rev 235657)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-09-05 05:02:53 UTC (rev 235658)
@@ -1,3 +1,16 @@
+2018-09-04  Oriol Brufau  <obru...@igalia.com>
+
+        Check important flags when serializing shorthand with "initial" values
+        https://bugs.webkit.org/show_bug.cgi?id=188984
+
+        Reviewed by Antti Koivisto.
+
+        The test still has some failures due to https://bugs.webkit.org/show_bug.cgi?id=185953
+        but without this patch it would fail earlier.
+
+        * web-platform-tests/css/cssom/shorthand-serialization-expected.txt:
+        * web-platform-tests/css/cssom/shorthand-serialization.html:
+
 2018-09-04  Ryosuke Niwa  <rn...@webkit.org>
 
         slotchange event doesn't get fired when inserting, removing, or renaming slot elements

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-serialization-expected.txt (235657 => 235658)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-serialization-expected.txt	2018-09-05 04:32:59 UTC (rev 235657)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-serialization-expected.txt	2018-09-05 05:02:53 UTC (rev 235658)
@@ -10,4 +10,7 @@
 PASS Shorthand serialization with just longhands. 
 FAIL Shorthand serialization with variable and variable from other shorthand. assert_equals: expected "var(--a)" but got ""
 PASS Shorthand serialization after setting 
+FAIL Shorthand serialization with 'initial' value. assert_equals: expected "margin: initial;" but got ""
+PASS Shorthand serialization with 'initial' value, one longhand with important flag. 
+PASS Shorthand serialization with 'initial' value, longhands set individually, one with important flag. 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-serialization.html (235657 => 235658)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-serialization.html	2018-09-05 04:32:59 UTC (rev 235657)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-serialization.html	2018-09-05 05:02:53 UTC (rev 235658)
@@ -58,6 +58,29 @@
             assert_equals(testElem.style.margin, "20px");
             assert_equals(testElem.style.cssText, "margin: 20px;")
         }, "Shorthand serialization after setting");
+
+        test(function() {
+            const testElem = document.getElementById("test");
+            testElem.style.cssText = "margin: initial;";
+            assert_equals(testElem.style.margin, "initial");
+            assert_equals(testElem.style.cssText, "margin: initial;");
+        }, "Shorthand serialization with 'initial' value.");
+
+        test(function() {
+            const testElem = document.getElementById("test");
+            testElem.style.setProperty("margin-top", "initial", "important");
+            assert_equals(testElem.style.margin, "");
+        }, "Shorthand serialization with 'initial' value, one longhand with important flag.");
+
+        test(function() {
+            const testElem = document.getElementById("test");
+            testElem.style.cssText = "";
+            testElem.style.setProperty("margin-top", "initial");
+            testElem.style.setProperty("margin-right", "initial");
+            testElem.style.setProperty("margin-bottom", "initial");
+            testElem.style.setProperty("margin-left", "initial", "important");
+            assert_equals(testElem.style.margin, "");
+        }, "Shorthand serialization with 'initial' value, longhands set individually, one with important flag.");
     </script>
 </body>
 </html>

Modified: trunk/Source/WebCore/ChangeLog (235657 => 235658)


--- trunk/Source/WebCore/ChangeLog	2018-09-05 04:32:59 UTC (rev 235657)
+++ trunk/Source/WebCore/ChangeLog	2018-09-05 05:02:53 UTC (rev 235658)
@@ -1,3 +1,18 @@
+2018-09-04  Oriol Brufau  <obru...@igalia.com>
+
+        Check important flags when serializing shorthand with "initial" values
+        https://bugs.webkit.org/show_bug.cgi?id=188984
+
+        Reviewed by Antti Koivisto.
+
+        Test: imported/w3c/web-platform-tests/css/cssom/shorthand-serialization.html
+
+        The test still has some failures due to https://bugs.webkit.org/show_bug.cgi?id=185953
+        but without this patch it would fail earlier.
+
+        * css/StyleProperties.cpp:
+        (WebCore::StyleProperties::get4Values const):
+
 2018-09-04  Antti Koivisto  <an...@apple.com>
 
         Remove pointless RenderSVGResourceMode::ApplyToDefault enum value

Modified: trunk/Source/WebCore/css/StyleProperties.cpp (235657 => 235658)


--- trunk/Source/WebCore/css/StyleProperties.cpp	2018-09-05 04:32:59 UTC (rev 235657)
+++ trunk/Source/WebCore/css/StyleProperties.cpp	2018-09-05 05:02:53 UTC (rev 235658)
@@ -374,6 +374,10 @@
     if (!top.value() || !right.value() || !bottom.value() || !left.value())
         return String();
 
+    // Important flags must be the same
+    if (top.isImportant() != right.isImportant() || right.isImportant() != bottom.isImportant() || bottom.isImportant() != left.isImportant())
+        return String();
+
     if (top.isInherited() && right.isInherited() && bottom.isInherited() && left.isInherited())
         return getValueName(CSSValueInherit);
 
@@ -384,8 +388,6 @@
         }
         return String();
     }
-    if (top.isImportant() != right.isImportant() || right.isImportant() != bottom.isImportant() || bottom.isImportant() != left.isImportant())
-        return String();
 
     bool showLeft = !right.value()->equals(*left.value());
     bool showBottom = !top.value()->equals(*bottom.value()) || showLeft;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to