Bug 1340344 - Calmp hue value in finite float range. r=dholbert
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Sat, 18 Feb 2017 10:43:24 +0900
changeset 373125 fe06b3adf47e5122381c7594e86af52a80e3e642
parent 373124 bab76c9ef680c8ee8ff290bc02410923c4a1bde2
child 373126 6d18f9e14d5d8a6f749aff26ee83930ca5b997aa
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1340344
milestone54.0a1
Bug 1340344 - Calmp hue value in finite float range. r=dholbert MozReview-Commit-ID: ItxwcKjpHyO
layout/style/crashtests/1340344.html
layout/style/crashtests/crashtests.list
layout/style/nsCSSParser.cpp
new file mode 100644
--- /dev/null
+++ b/layout/style/crashtests/1340344.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+<meta charset="UTF-8">
+<script>
+window.onload = function(){
+  var anim =
+    document.documentElement.animate([{ "color": "hsla(6e147grad,16%,183.379675555%,0.0210463770007)" }]);
+  anim.ready.then(() => {
+    document.documentElement.classList.remove("reftest-wait");
+  });
+};
+</script>
+</head>
+</html>
--- a/layout/style/crashtests/crashtests.list
+++ b/layout/style/crashtests/crashtests.list
@@ -164,8 +164,9 @@ load 1314531.html
 load 1315889-1.html
 load 1315894-1.html
 load 1319072-1.html
 HTTP load 1320423-1.html
 load 1321357-1.html
 load 1328535-1.html
 load 1331272.html
 HTTP load 1333001-1.html
+pref(dom.animations-api.core.enabled,true) load 1340344.html
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -6931,17 +6931,22 @@ CSSParserImpl::ParseHue(float& aAngle)
   }
   UngetToken();
 
   // <angle>
   nsCSSValue angleValue;
   // The '0' value is handled by <number> parsing, so use VARIANT_ANGLE flag
   // instead of VARIANT_ANGLE_OR_ZERO.
   if (ParseSingleTokenVariant(angleValue, VARIANT_ANGLE, nullptr)) {
+    // Convert double value of GetAngleValueInDegrees() to float.
     aAngle = angleValue.GetAngleValueInDegrees();
+    // And then clamp it as finite values in float.
+    aAngle = mozilla::clamped(aAngle,
+                              -std::numeric_limits<float>::max(),
+                               std::numeric_limits<float>::max());
     return true;
   }
 
   REPORT_UNEXPECTED_TOKEN(PEExpectedNumberOrAngle);
   return false;
 }
 
 bool