Part 2: Update wpt to accept non-normalized path string at computed time.

There is still no conclusion in https://github.com/w3c/svgwg/issues/321,
so we follow the option 3 in [1] for now:
  Don't absolutize anywhere except when needed for animations.

[1] https://github.com/w3c/svgwg/issues/321#issuecomment-423309441

Note:
1. Drop "offset-path-serialization.html" because we are doing the simliar
   thing in offset-path-computed.html and offset-path-parsing-valid.html.
2. `z` is serialized as `Z` because `Z` and `z` commands take no parameters,
   they have an identical effect.
   (https://www.w3.org/TR/SVG2/paths.html#PathDataClosePathCommand)

Differential Revision: https://phabricator.services.mozilla.com/D172071

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1489392
gecko-commit: 4ee091c23aa2976da9922f3bf9c8e62a5b9462f5
gecko-reviewers: emilio
diff --git a/css/motion/offset-path-serialization.html b/css/motion/offset-path-serialization.html
deleted file mode 100644
index 7c835c7..0000000
--- a/css/motion/offset-path-serialization.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-<title>Motion Path Module Level 1: path serialization</title>
-<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
-<link rel="help" href="https://drafts.fxtf.org/motion-1/">
-<h:meta name="assert" content="computed offset-path is serialized using absolute commands"/>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-</head>
-<body>
-<div id="target"></div>
-<script>
-'use strict';
-
-test(function() {
-  var target = document.getElementById('target');
-
-  target.style.offsetPath = 'path("m 10 20 q 30 60 40 50 q 100 70 90 80")';
-  assert_equals(target.style.offsetPath, 'path("m 10 20 q 30 60 40 50 q 100 70 90 80")');
-  assert_equals(getComputedStyle(target).offsetPath, 'path("M 10 20 Q 40 80 50 70 Q 150 140 140 150")');
-
-  target.style.offsetPath = "path('M 0 0 L 100 100 m 0 100 l 100 0 Z l 160 20 Z')";
-  assert_equals(target.style.offsetPath, 'path("M 0 0 L 100 100 m 0 100 l 100 0 Z l 160 20 Z")');
-  assert_equals(getComputedStyle(target).offsetPath, 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 260 220 Z")');
-
-  target.style.offsetPath = 'path("m 10 20   l 20 30   Z   l 50 60   Z   m 70 80   l 90 60   Z   t 70 120")';
-  assert_equals(target.style.offsetPath, 'path("m 10 20 l 20 30 Z l 50 60 Z m 70 80 l 90 60 Z t 70 120")');
-  assert_equals(getComputedStyle(target).offsetPath, 'path("M 10 20 L 30 50 Z L 60 80 Z M 80 100 L 170 160 Z T 150 220")');
-
-  target.style.offsetPath = 'path("m 10.0 170.0 h 90.00 v 30.00 m 0 0 s 1 2 3 4 z c 9 8 7 6 5 4")';
-  assert_equals(target.style.offsetPath, 'path("m 10 170 h 90 v 30 m 0 0 s 1 2 3 4 Z c 9 8 7 6 5 4")');
-  assert_equals(getComputedStyle(target).offsetPath, 'path("M 10 170 H 100 V 200 M 100 200 S 101 202 103 204 Z C 109 208 107 206 105 204")');
-
-  target.style.offsetPath = '  path(  "m 10 20 a 10 20 30 1 0 40 50 a 110 120 30 1 1 140 50"  )  ';
-  assert_equals(target.style.offsetPath, 'path("m 10 20 a 10 20 30 1 0 40 50 a 110 120 30 1 1 140 50")');
-  assert_equals(getComputedStyle(target).offsetPath, 'path("M 10 20 A 10 20 30 1 0 50 70 A 110 120 30 1 1 190 120")');
-
-  target.style.offsetPath = 'path("M 1 2 H 3 v 4 h 5 V 6 h 7 v 8")';
-  assert_equals(target.style.offsetPath, 'path("M 1 2 H 3 v 4 h 5 V 6 h 7 v 8")');
-  assert_equals(getComputedStyle(target).offsetPath, 'path("M 1 2 H 3 V 6 H 8 V 6 H 15 V 14")');
-});
-</script>
-</body>
-</html>
diff --git a/css/motion/parsing/offset-path-computed.html b/css/motion/parsing/offset-path-computed.html
index 6fc2fa4..c2f9d4b 100644
--- a/css/motion/parsing/offset-path-computed.html
+++ b/css/motion/parsing/offset-path-computed.html
@@ -22,13 +22,34 @@
 test_computed_value("offset-path", "ray(-720deg sides)");
 test_computed_value("offset-path", "ray(calc(180deg - 45deg) farthest-side)", "ray(135deg farthest-side)");
 
-test_computed_value("offset-path", 'path("m 20 0 h -100")', 'path("M 20 0 H -80")');
+// It's unclear about the normalization at computed time, so we accept both
+// cases for now.
+// https://github.com/w3c/svgwg/issues/321
+test_computed_value("offset-path", 'path("m 20 0 h -100")', [
+    'path("M 20 0 H -80")',
+    'path("m 20 0 h -100")'
+]);
 test_computed_value("offset-path", 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 300 300 Z")');
-test_computed_value("offset-path", 'path("m 10 20 q 30 60 40 50 q 100 70 90 80")', 'path("M 10 20 Q 40 80 50 70 Q 150 140 140 150")');
-test_computed_value("offset-path", 'path("M 0 0 L 100 100 m 0 100 l 100 0 Z l 160 20 Z")', 'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 260 220 Z")');
-test_computed_value("offset-path", 'path("m 10 20 l 20 30 Z l 50 60 Z m 70 80 l 90 60 Z t 70 120")', 'path("M 10 20 L 30 50 Z L 60 80 Z M 80 100 L 170 160 Z T 150 220")');
-test_computed_value("offset-path", 'path("m 10 170 h 90 v 30 m 0 0 s 1 2 3 4 z c 9 8 7 6 5 4")', 'path("M 10 170 H 100 V 200 M 100 200 S 101 202 103 204 Z C 109 208 107 206 105 204")');
-test_computed_value("offset-path", 'path("m 10 20 a 10 20 30 1 0 40 50 a 110 120 30 1 1 140 50")', 'path("M 10 20 A 10 20 30 1 0 50 70 A 110 120 30 1 1 190 120")');
+test_computed_value("offset-path", 'path("m 10 20 q 30 60 40 50 q 100 70 90 80")', [
+    'path("M 10 20 Q 40 80 50 70 Q 150 140 140 150")',
+    'path("m 10 20 q 30 60 40 50 q 100 70 90 80")'
+]);
+test_computed_value("offset-path", 'path("M 0 0 L 100 100 m 0 100 l 100 0 Z l 160 20 Z")', [
+    'path("M 0 0 L 100 100 M 100 200 L 200 200 Z L 260 220 Z")',
+    'path("M 0 0 L 100 100 m 0 100 l 100 0 Z l 160 20 Z")'
+]);
+test_computed_value("offset-path", 'path("m 10 20 l 20 30 Z l 50 60 Z m 70 80 l 90 60 Z t 70 120")', [
+    'path("M 10 20 L 30 50 Z L 60 80 Z M 80 100 L 170 160 Z T 150 220")',
+    'path("m 10 20 l 20 30 Z l 50 60 Z m 70 80 l 90 60 Z t 70 120")'
+]);
+test_computed_value("offset-path", 'path("m 10 170 h 90 v 30 m 0 0 s 1 2 3 4 z c 9 8 7 6 5 4")', [
+    'path("M 10 170 H 100 V 200 M 100 200 S 101 202 103 204 Z C 109 208 107 206 105 204")',
+    'path("m 10 170 h 90 v 30 m 0 0 s 1 2 3 4 Z c 9 8 7 6 5 4")'
+]);
+test_computed_value("offset-path", 'path("m 10 20 a 10 20 30 1 0 40 50 a 110 120 30 1 1 140 50")', [
+    'path("M 10 20 A 10 20 30 1 0 50 70 A 110 120 30 1 1 190 120")',
+    'path("m 10 20 a 10 20 30 1 0 40 50 a 110 120 30 1 1 140 50")',
+]);
 
 // url, shape and geometry-box paths are not yet supported by implementations.
 </script>
diff --git a/css/motion/parsing/offset-path-parsing-valid.html b/css/motion/parsing/offset-path-parsing-valid.html
index db55250..25915b9 100644
--- a/css/motion/parsing/offset-path-parsing-valid.html
+++ b/css/motion/parsing/offset-path-parsing-valid.html
@@ -29,6 +29,18 @@
 test_valid_value("offset-path", 'path("m 10 20 l 20 30 Z l 50 60 Z m 70 80 l 90 60 Z t 70 120")');
 test_valid_value("offset-path", 'path("m 10 170 h 90 v 30 m 0 0 s 1 2 3 4 z c 9 8 7 6 5 4")', 'path("m 10 170 h 90 v 30 m 0 0 s 1 2 3 4 Z c 9 8 7 6 5 4")');
 test_valid_value("offset-path", 'path("m 10 20 a 10 20 30 1 0 40 50 a 110 120 30 1 1 140 50")');
+test_valid_value("offset-path",
+    'path("m 10 20   l 20 30   Z   l 50 60   Z   m 70 80   l 90 60   Z   t 70 120")',
+    'path("m 10 20 l 20 30 Z l 50 60 Z m 70 80 l 90 60 Z t 70 120")'
+);
+test_valid_value("offset-path",
+    'path("m 10.0 170.0 h 90.00 v 30.00 m 0 0 s 1 2 3 4 z c 9 8 7 6 5 4")',
+    'path("m 10 170 h 90 v 30 m 0 0 s 1 2 3 4 Z c 9 8 7 6 5 4")'
+);
+test_valid_value("offset-path",
+    '  path(  "m 10 20 a 10 20 30 1 0 40 50 a 110 120 30 1 1 140 50"  )  ',
+    'path("m 10 20 a 10 20 30 1 0 40 50 a 110 120 30 1 1 140 50")'
+);
 // See https://github.com/w3c/fxtf-drafts/issues/392. If empty path string,
 // Blink serializes it as none, but Gecko serializes as path("").
 test_valid_value("offset-path", 'path("")', ['none', 'path("")']);