Bug 1340344 - Calmp hue value in finite float range. r?dholbert
MozReview-Commit-ID: ItxwcKjpHyO
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