Bug 1508028 - Change stroke-miterlimit restriction from GreaterThanOrEqualToOneNumber to NonNegativeNumber. r=longsonr,emilio
authorviolet
Sat, 09 Mar 2019 13:05:56 +0000
changeset 521255 fbbc4b0c00c3f82e351f89da586053f0aac0f3dc
parent 521254 ac1601914ac513fbf769bf9ebc4d900699ae7017
child 521256 6b4af1ecd78d9765b9b09eb9bcaf2ff88def7b80
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslongsonr, emilio
bugs1508028
milestone67.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 1508028 - Change stroke-miterlimit restriction from GreaterThanOrEqualToOneNumber to NonNegativeNumber. r=longsonr,emilio
layout/style/test/property_database.js
layout/style/test/test_transitions_per_property.html
layout/svg/nsSVGUtils.cpp
servo/components/style/properties/longhands/inherited_svg.mako.rs
testing/web-platform/meta/svg/painting/parsing/stroke-miterlimit-computed.svg.ini
testing/web-platform/meta/svg/painting/parsing/stroke-miterlimit-valid.svg.ini
--- a/layout/style/test/property_database.js
+++ b/layout/style/test/property_database.js
@@ -5589,18 +5589,18 @@ var gCSSProperties = {
     other_values: [ "round", "bevel" ],
     invalid_values: []
   },
   "stroke-miterlimit": {
     domProp: "strokeMiterlimit",
     inherited: true,
     type: CSS_TYPE_LONGHAND,
     initial_values: [ "4" ],
-    other_values: [ "1", "7", "5000", "1.1" ],
-    invalid_values: [ "0.9", "0", "-1", "3px", "-0.3" ]
+    other_values: [ "0", "0.9", "1", "7", "5000", "1.1" ],
+    invalid_values: [ "-1", "3px", "-0.3" ]
   },
   "stroke-opacity": {
     domProp: "strokeOpacity",
     inherited: true,
     type: CSS_TYPE_LONGHAND,
     initial_values: [ "1", "2.8", "1.000" ],
     other_values: [ "0", "0.3", "-7.3", "context-fill-opacity", "context-stroke-opacity" ],
     invalid_values: []
--- a/layout/style/test/test_transitions_per_property.html
+++ b/layout/style/test/test_transitions_per_property.html
@@ -258,18 +258,19 @@ var supported_properties = {
                        // opacity is clamped in computed style
                        // (not parsing/interpolation)
                        test_float_zeroToOne_clamped ],
     "stroke": [ test_color_transition,
                 test_currentcolor_transition ],
     "stroke-dasharray": [ test_dasharray_transition ],
     "stroke-dashoffset": [ test_length_transition, test_percent_transition,
                            test_length_unclamped, test_percent_unclamped, ],
-    "stroke-miterlimit": [ test_float_aboveOne_transition,
-                           test_float_aboveOne_clamped ],
+    "stroke-miterlimit": [ test_float_zeroToOne_transition,
+                           test_float_aboveOne_transition,
+                           test_float_aboveZero_clamped ],
     "stroke-opacity" : [ test_float_zeroToOne_transition,
                          // opacity is clamped in computed style
                          // (not parsing/interpolation)
                          test_float_zeroToOne_clamped ],
     "stroke-width": [ test_length_transition, test_percent_transition,
                       test_length_clamped, test_percent_clamped, ],
     "-moz-tab-size": [ test_float_zeroToOne_transition,
                        test_float_aboveOne_transition, test_length_clamped ],
@@ -1345,38 +1346,38 @@ function test_float_zeroToOne_clamped_or
      "float-valued property " + prop + ": flush before clamping test");
   div.style.setProperty("transition-property", prop, "");
   div.style.setProperty(prop, "1", "");
   (is_clamped ? is : isnot)(cs.getPropertyValue(prop), "0",
      "float-valued property " + prop + ": clamping of negatives");
   div.style.setProperty("transition-timing-function", "linear", "");
 }
 
-// Test using float values in the range [1, infinity) (e.g. stroke-miterlimit)
+// Test using float values in the range [1, infinity)
 function test_float_aboveOne_transition(prop) {
   div.style.setProperty("transition-property", "none", "");
   div.style.setProperty(prop, "1", "");
   is(cs.getPropertyValue(prop), "1",
      "float-valued property " + prop + ": computed value before transition");
   div.style.setProperty("transition-property", prop, "");
   div.style.setProperty(prop, "2.1", "");
   is(cs.getPropertyValue(prop), "1.275",
      "float-valued property " + prop + ": interpolation of floats");
   check_distance(prop, "1", "1.275", "2.1");
 }
 
-function test_float_aboveOne_clamped(prop) {
+function test_float_aboveZero_clamped(prop) {
   div.style.setProperty("transition-timing-function", FUNC_NEGATIVE, "");
   div.style.setProperty("transition-property", "none", "");
-  div.style.setProperty(prop, "1", "");
-  is(cs.getPropertyValue(prop), "1",
+  div.style.setProperty(prop, "0", "");
+  is(cs.getPropertyValue(prop), "0",
      "float-valued property " + prop + ": flush before clamping test");
   div.style.setProperty("transition-property", prop, "");
   div.style.setProperty(prop, "5", "");
-  is(cs.getPropertyValue(prop), "1",
+  is(cs.getPropertyValue(prop), "0",
      "float-valued property " + prop + ": clamping of negatives");
   div.style.setProperty("transition-timing-function", "linear", "");
 }
 
 function test_percent_transition(prop) {
   div.style.setProperty("transition-property", "none", "");
   div.style.setProperty(prop, "25%", "");
   var av = cs.getPropertyValue(prop);
--- a/layout/svg/nsSVGUtils.cpp
+++ b/layout/svg/nsSVGUtils.cpp
@@ -1290,16 +1290,18 @@ gfxRect nsSVGUtils::PathExtentsToMaxStro
   // For a shape without corners the stroke can only extend half the stroke
   // width from the path in the x/y-axis directions. For shapes with corners
   // the stroke can extend by sqrt(1/2) (think 45 degree rotated rect, or line
   // with stroke-linecaps="square").
   double styleExpansionFactor = strokeMayHaveCorners ? M_SQRT1_2 : 0.5;
 
   // The stroke can extend even further for paths that can be affected by
   // stroke-miterlimit.
+  // We only need to do this if the limit is greater than 1, but it's probably
+  // not worth optimizing for that.
   bool affectedByMiterlimit = aFrame->GetContent()->IsAnyOfSVGElements(
       nsGkAtoms::path, nsGkAtoms::polyline, nsGkAtoms::polygon);
 
   if (affectedByMiterlimit) {
     const nsStyleSVG* style = aFrame->StyleSVG();
     if (style->mStrokeLinejoin == NS_STYLE_STROKE_LINEJOIN_MITER &&
         styleExpansionFactor < style->mStrokeMiterlimit / 2.0) {
       styleExpansionFactor = style->mStrokeMiterlimit / 2.0;
--- a/servo/components/style/properties/longhands/inherited_svg.mako.rs
+++ b/servo/components/style/properties/longhands/inherited_svg.mako.rs
@@ -105,21 +105,21 @@
     "miter round bevel",
     products="gecko",
     animation_value_type="discrete",
     spec="https://www.w3.org/TR/SVG11/painting.html#StrokeLinejoinProperty",
 )}
 
 ${helpers.predefined_type(
     "stroke-miterlimit",
-    "GreaterThanOrEqualToOneNumber",
+    "NonNegativeNumber",
     "From::from(4.0)",
     products="gecko",
-    animation_value_type="crate::values::computed::GreaterThanOrEqualToOneNumber",
-    spec="https://www.w3.org/TR/SVG11/painting.html#StrokeMiterlimitProperty",
+    animation_value_type="crate::values::computed::NonNegativeNumber",
+    spec="https://www.w3.org/TR/SVG2/painting.html#StrokeMiterlimitProperty",
 )}
 
 ${helpers.predefined_type(
     "stroke-opacity",
     "SVGOpacity",
     "Default::default()",
     products="gecko",
     animation_value_type="ComputedValue",
deleted file mode 100644
--- a/testing/web-platform/meta/svg/painting/parsing/stroke-miterlimit-computed.svg.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[stroke-miterlimit-computed.svg]
-  [Property stroke-miterlimit value '0.5' computes to '0.5']
-    expected: FAIL
-
-  [Property stroke-miterlimit value '0' computes to '0']
-    expected: FAIL
-
deleted file mode 100644
--- a/testing/web-platform/meta/svg/painting/parsing/stroke-miterlimit-valid.svg.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[stroke-miterlimit-valid.svg]
-  [e.style['stroke-miterlimit'\] = "0.5" should set the property value]
-    expected: FAIL
-
-  [e.style['stroke-miterlimit'\] = "0" should set the property value]
-    expected: FAIL
-