Bug 1514329 [wpt PR 14523] - Use StyleColor for the stop-color property, a=testonly
authorFredrik Söderquist <fs@opera.com>
Wed, 19 Dec 2018 11:39:02 +0000
changeset 515022 4c026d2d70bb05c4678e8ca1e0b6dfc4eae614ae
parent 515021 99367c132437d215b047e387ea7706b8b8adf055
child 515023 42f5aecff24a2aee8ce97f46552c612934b00591
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1514329, 14523, 914728, 1377437, 616660
milestone66.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 1514329 [wpt PR 14523] - Use StyleColor for the stop-color property, a=testonly Automatic update from web-platform-tests Use StyleColor for the stop-color property This changes the ComputedStyle storage for the stop-color property to be a StyleColor rather than a plain color. This fixes explicit inheritance for the property ('currentcolor' computes to itself). It also means we'll properly pick up changes to 'color'. Bug: 914728 Change-Id: I3c78a3615220b9149d1ea5102a6e5863526a6d51 Reviewed-on: https://chromium-review.googlesource.com/c/1377437 Reviewed-by: Rune Lillesveen <futhark@chromium.org> Commit-Queue: Fredrik Söderquist <fs@opera.com> Cr-Commit-Position: refs/heads/master@{#616660} -- wpt-commits: 8a97b8ab9a745f316400585b5e8ac473886f92d0 wpt-pr: 14523
testing/web-platform/tests/svg/pservers/parsing/stop-color-computed.svg
testing/web-platform/tests/svg/pservers/reftests/reference/green-100x100.svg
testing/web-platform/tests/svg/pservers/reftests/stop-color-currentcolor-dynamic-001.svg
testing/web-platform/tests/svg/pservers/scripted/stop-color-inheritance-currentcolor.svg
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/svg/pservers/parsing/stop-color-computed.svg
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml">
+  <title>SVG Paint Servers: getComputedStyle().stopColor</title>
+  <metadata>
+    <h:link rel="help" href="https://svgwg.org/svg2-draft/pservers.html#StopColorProperty"/>
+    <h:link rel="help" href="https://drafts.csswg.org/css-color/#resolve-color-values"/>
+    <h:link rel="help" href="https://drafts.csswg.org/cssom/#serializing-css-values"/>
+  </metadata>
+  <g id="target" style="color: blue"></g>
+  <h:script src="/resources/testharness.js"/>
+  <h:script src="/resources/testharnessreport.js"/>
+  <h:script src="/css/support/computed-testcommon.js"/>
+  <script><![CDATA[
+
+test_computed_value("stop-color", "currentcolor", "rgb(0, 0, 255)");
+test_computed_value("stop-color", "white", "rgb(255, 255, 255)");
+test_computed_value("stop-color", "transparent", "rgba(0, 0, 0, 0)");
+test_computed_value("stop-color", "rgb(255, 255, 255)");
+test_computed_value("stop-color", "#ffffff", "rgb(255, 255, 255)");
+test_computed_value("stop-color", "rgba(255, 255, 255, 1.0)", "rgb(255, 255, 255)");
+test_computed_value("stop-color", "rgba(255, 255, 255, 0.4)");
+test_computed_value("stop-color", "hsl(0deg, 100%, 100%)", "rgb(255, 255, 255)");
+test_computed_value("stop-color", "hsla(0deg, 100%, 100%, 1.0)", "rgb(255, 255, 255)");
+test_computed_value("stop-color", "hsla(0deg, 100%, 100%, 0.4)", "rgba(255, 255, 255, 0.4)");
+
+  ]]></script>
+</svg>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/svg/pservers/reftests/reference/green-100x100.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+  <rect width="100" height="100" fill="green"/>
+</svg>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/svg/pservers/reftests/stop-color-currentcolor-dynamic-001.svg
@@ -0,0 +1,18 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml"
+     style="color: red">
+  <title>stop-color: Dynamically changing 'color' for a gradient with a stop with 'currentcolor'</title>
+  <h:link rel="help" href="https://svgwg.org/svg2-draft/pservers.html#StopColorProperty"/>
+  <h:link rel="match" href="reference/green-100x100.svg"/>
+  <linearGradient id="g">
+    <stop stop-color="currentcolor"/>
+  </linearGradient>
+  <rect width="50" height="100" fill="url(#g)"/>
+  <rect width="50" height="100" x="50" fill="currentcolor"/>
+  <script>
+    <![CDATA[
+      let root = document.querySelector(':root');
+      root.getBoundingClientRect();  // Force layout
+      root.style.color = 'green';
+    ]]>
+  </script>
+</svg>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/svg/pservers/scripted/stop-color-inheritance-currentcolor.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml"
+     color="red">
+  <title>SVG Paint Servers: 'stop-color' inheritance of 'currentcolor'</title>
+  <metadata>
+    <h:link rel="help" href="https://svgwg.org/svg2-draft/pservers.html#StopColorProperty"/>
+    <h:link rel="help" href="https://drafts.csswg.org/css-color/#resolve-color-values"/>
+  </metadata>
+  <h:script src="/resources/testharness.js"/>
+  <h:script src="/resources/testharnessreport.js"/>
+  <linearGradient stop-color="currentcolor" id="g">
+    <stop stop-color="inherit" color="green"/>
+  </linearGradient>
+  <script><![CDATA[
+
+    test(function() {
+      let stop = document.querySelector('stop');
+      assert_equals(getComputedStyle(stop).stopColor, 'rgb(0, 128, 0)');
+    }, '"currentcolor" is inherited as a keyword');
+
+  ]]></script>
+</svg>