Bug 1507549 [wpt PR 14077] - Fix serialization of computed style for 'paint-order', a=testonly
☠☠ backed out by 46ad93280b06 ☠ ☠
authorFredrik Söderquist <fs@opera.com>
Mon, 19 Nov 2018 18:45:48 +0000
changeset 503736 ee38ad38e9a1f86ac344708152c5cf98f72dd29d
parent 503735 0b2f801856141bb6a7673db5cb370eaf5e813ba9
child 503737 e6d88d9f73affa755a6c09ed70af2a9c76362e30
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>