Bug 1507549 [wpt PR 14077] - Fix serialization of computed style for 'paint-order', a=testonly
authorFredrik Söderquist <fs@opera.com>
Mon, 19 Nov 2018 18:45:48 +0000
changeset 503991 65a2135472b542f302594c39593a7e8a8a52cb71
parent 503990 b5b203f13d4b19e7d907f11fedfe89fad54d2032
child 503992 9fb1d44b189576a641165e28f5fb0c75b5952d20
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1507549, 14077, 904898, 1335579, 608623
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1507549 [wpt PR 14077] - Fix serialization of computed style for 'paint-order', a=testonly Automatic update from web-platform-testsFix serialization of computed style for 'paint-order' We were always serializing as the completed (all keywords present) form, which is not the shortest canonical form. https://svgwg.org/svg2-draft/painting.html#PaintOrder Fold the ComputedStyleUtils helper into the PaintOrder CSSProperty class, since this is very specific to this property. Matches WebKit and almost Gecko (which seems to handle some "two keyword" cases differently.) Bug: 904898 Change-Id: Ib796a111e601485e339fdf2739a587fb5f893b8a Reviewed-on: https://chromium-review.googlesource.com/c/1335579 Commit-Queue: Eric Willigers <ericwilligers@chromium.org> Reviewed-by: Eric Willigers <ericwilligers@chromium.org> Reviewed-by: Rune Lillesveen <futhark@chromium.org> Cr-Commit-Position: refs/heads/master@{#608623} -- wpt-commits: 8ffe6b78eb915feefba921914f47c40b6f1880e6 wpt-pr: 14077
testing/web-platform/tests/svg/painting/scripted/paint-order-computed-value-01.svg
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/svg/painting/scripted/paint-order-computed-value-01.svg
@@ -0,0 +1,62 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml">
+  <title>'paint-order' computed style serialization</title>
+  <h:script src="/resources/testharness.js"/>
+  <h:script src="/resources/testharnessreport.js"/>
+  <text id="text" x="100" y="100"/>
+  <script><![CDATA[
+    'use strict';
+
+    function make_tests(check, type) {
+      let tests = [
+        // Single keyword
+        ["normal", "normal"],
+        ["fill", "fill"],
+        ["stroke", "stroke"],
+        ["markers", "markers"],
+        // Two keywords
+        ["fill stroke", "fill"],
+        ["fill markers", "fill markers"],
+        ["stroke fill", "stroke"],
+        ["stroke markers", "stroke markers"],
+        ["markers fill", "markers"],
+        ["markers stroke", "markers stroke"],
+        // Three keywords
+        ["fill stroke markers", "fill"],
+        ["fill markers stroke", "fill markers"],
+        ["stroke fill markers", "stroke"],
+        ["stroke markers fill", "stroke markers"],
+        ["markers fill stroke", "markers"],
+        ["markers stroke fill", "markers stroke"],
+        // Invalid
+        ["foo", "normal"],
+        ["fill foo", "normal"],
+        ["stroke foo", "normal"],
+        ["markers foo", "normal"],
+        ["normal foo", "normal"],
+        ["fill markers stroke foo", "normal"],
+      ];
+      for (let [value, expected] of tests) {
+        test(() => {
+          check(value, expected);
+        }, `${document.title}, "${value}" => "${expected}" (${type})`);
+      }
+    }
+
+    const text = document.getElementById("text");
+
+    make_tests((value, expected) => {
+      text.setAttribute("style", "paint-order: " + value);
+      let actual = getComputedStyle(text).paintOrder;
+      text.removeAttribute("style");
+      assert_equals(actual, expected, value);
+    }, "property");
+
+    make_tests((value, expected) => {
+      text.setAttribute("paint-order", value);
+      let actual = getComputedStyle(text).paintOrder;
+      text.removeAttribute("paint-order");
+      assert_equals(actual, expected, value);
+    }, "presentation attribute");
+  ]]>
+  </script>
+</svg>