Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (292731 => 292732)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-04-11 22:56:48 UTC (rev 292731)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-04-11 23:05:22 UTC (rev 292732)
@@ -1,3 +1,15 @@
+2022-04-11 Nikolaos Mouchtaris <[email protected]>
+
+ calc(): Propogate nan for min, max, clamp, and hypot
+ https://bugs.webkit.org/show_bug.cgi?id=238974
+
+ Reviewed by Darin Adler.
+
+ * web-platform-tests/css/css-values/calc-catch-divide-by-0-expected.txt:
+ * web-platform-tests/css/css-values/calc-infinity-nan-serialize-angle-expected.txt:
+ * web-platform-tests/css/css-values/calc-infinity-nan-serialize-length-expected.txt:
+ * web-platform-tests/css/css-values/calc-infinity-nan-serialize-time-expected.txt:
+
2022-04-11 Youenn Fablet <[email protected]>
Expose more ServiceWorker interfaces to workers
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-catch-divide-by-0-expected.txt (292731 => 292732)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-catch-divide-by-0-expected.txt 2022-04-11 22:56:48 UTC (rev 292731)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-catch-divide-by-0-expected.txt 2022-04-11 23:05:22 UTC (rev 292732)
@@ -13,11 +13,11 @@
PASS 'calc(1px * max(0/0, 0))' as a specified value should serialize as 'calc(NaN * 1px)'.
PASS 'calc(1px * min(0/0, 0))' as a specified value should serialize as 'calc(NaN * 1px)'.
PASS 'calc(1px * max(0/0, min(0,10)))' as a specified value should serialize as 'calc(NaN * 1px)'.
-FAIL 'calc(1px * clamp(0/0, 0, 10))' as a specified value should serialize as 'calc(NaN * 1px)'. assert_equals: 'calc(1px * clamp(0/0, 0, 10))' and 'calc(NaN * 1px)' should serialize the same in specified values. expected "calc(NaN * 1px)" but got "calc(1px * clamp(NaN, 0, 10))"
-FAIL 'calc(1px * max(0, min(10, 0/0)))' as a specified value should serialize as 'calc(NaN * 1px)'. assert_equals: 'calc(1px * max(0, min(10, 0/0)))' and 'calc(NaN * 1px)' should serialize the same in specified values. expected "calc(NaN * 1px)" but got "calc(10px)"
-FAIL 'calc(1px * clamp(0, 10, 0/0))' as a specified value should serialize as 'calc(NaN * 1px)'. assert_equals: 'calc(1px * clamp(0, 10, 0/0))' and 'calc(NaN * 1px)' should serialize the same in specified values. expected "calc(NaN * 1px)" but got "calc(1px * clamp(0, 10, NaN))"
-FAIL 'calc(1px * max(0, min(0/0, 10)))' as a specified value should serialize as 'calc(NaN * 1px)'. assert_equals: 'calc(1px * max(0, min(0/0, 10)))' and 'calc(NaN * 1px)' should serialize the same in specified values. expected "calc(NaN * 1px)" but got "calc(0px)"
-FAIL 'calc(1px * clamp(0, 0/0, 10))' as a specified value should serialize as 'calc(NaN * 1px)'. assert_equals: 'calc(1px * clamp(0, 0/0, 10))' and 'calc(NaN * 1px)' should serialize the same in specified values. expected "calc(NaN * 1px)" but got "calc(1px * clamp(0, NaN, 10))"
-FAIL 'calc(1px * clamp(-1/0, 0, 1/0))' as a specified value should serialize as 'calc(0px)'. assert_equals: 'calc(1px * clamp(-1/0, 0, 1/0))' and 'calc(0px)' should serialize the same in specified values. expected "calc(0px)" but got "calc(1px * clamp(-infinity, 0, infinity))"
-FAIL 'calc(1px * clamp(-1/0, 1/0, 10))' as a specified value should serialize as 'calc(10px)'. assert_equals: 'calc(1px * clamp(-1/0, 1/0, 10))' and 'calc(10px)' should serialize the same in specified values. expected "calc(10px)" but got "calc(1px * clamp(-infinity, infinity, 10))"
+PASS 'calc(1px * clamp(0/0, 0, 10))' as a specified value should serialize as 'calc(NaN * 1px)'.
+PASS 'calc(1px * max(0, min(10, 0/0)))' as a specified value should serialize as 'calc(NaN * 1px)'.
+PASS 'calc(1px * clamp(0, 10, 0/0))' as a specified value should serialize as 'calc(NaN * 1px)'.
+PASS 'calc(1px * max(0, min(0/0, 10)))' as a specified value should serialize as 'calc(NaN * 1px)'.
+PASS 'calc(1px * clamp(0, 0/0, 10))' as a specified value should serialize as 'calc(NaN * 1px)'.
+PASS 'calc(1px * clamp(-1/0, 0, 1/0))' as a specified value should serialize as 'calc(0px)'.
+PASS 'calc(1px * clamp(-1/0, 1/0, 10))' as a specified value should serialize as 'calc(10px)'.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-infinity-nan-serialize-angle-expected.txt (292731 => 292732)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-infinity-nan-serialize-angle-expected.txt 2022-04-11 22:56:48 UTC (rev 292731)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-infinity-nan-serialize-angle-expected.txt 2022-04-11 23:05:22 UTC (rev 292732)
@@ -20,13 +20,13 @@
PASS 'rotate(calc(1 * min(inFInity*4deg, 0deg)))' as a specified value should serialize as 'rotate(calc(0deg))'.
PASS 'rotate(calc(1 * max(nAn*2deg, 0deg)))' as a specified value should serialize as 'rotate(calc(NaN * 1deg))'.
PASS 'rotate(calc(1 * min(nan*3deg, 0deg)))' as a specified value should serialize as 'rotate(calc(NaN * 1deg))'.
-FAIL 'rotate(calc(1 * clamp(-INFINITY*20deg, 0deg, infiniTY*10deg)))' as a specified value should serialize as 'rotate(calc(0deg))'. assert_equals: 'rotate(calc(1 * clamp(-INFINITY*20deg, 0deg, infiniTY*10deg)))' and 'rotate(calc(0deg))' should serialize the same in specified values. expected "rotate(calc(0deg))" but got "rotate(calc(1 * clamp(-infinity * 1deg, 0deg, infinity * 1deg)))"
+PASS 'rotate(calc(1 * clamp(-INFINITY*20deg, 0deg, infiniTY*10deg)))' as a specified value should serialize as 'rotate(calc(0deg))'.
PASS 'rotate(calc(1deg * max(NaN, min(0,10))))' as a specified value should serialize as 'rotate(calc(NaN * 1deg))'.
-FAIL 'rotate(calc(1deg * clamp(NaN, 0, 10)))' as a specified value should serialize as 'rotate(calc(NaN * 1deg))'. assert_equals: 'rotate(calc(1deg * clamp(NaN, 0, 10)))' and 'rotate(calc(NaN * 1deg))' should serialize the same in specified values. expected "rotate(calc(NaN * 1deg))" but got "rotate(calc(1deg * clamp(NaN, 0, 10)))"
-FAIL 'rotate(calc(1deg * max(0, min(10, NaN))))' as a specified value should serialize as 'rotate(calc(NaN * 1deg))'. assert_equals: 'rotate(calc(1deg * max(0, min(10, NaN))))' and 'rotate(calc(NaN * 1deg))' should serialize the same in specified values. expected "rotate(calc(NaN * 1deg))" but got "rotate(calc(10deg))"
-FAIL 'rotate(calc(1deg * clamp(0, 10, NaN)))' as a specified value should serialize as 'rotate(calc(NaN * 1deg))'. assert_equals: 'rotate(calc(1deg * clamp(0, 10, NaN)))' and 'rotate(calc(NaN * 1deg))' should serialize the same in specified values. expected "rotate(calc(NaN * 1deg))" but got "rotate(calc(1deg * clamp(0, 10, NaN)))"
-FAIL 'rotate(calc(1deg * max(0, min(NaN, 10))))' as a specified value should serialize as 'rotate(calc(NaN * 1deg))'. assert_equals: 'rotate(calc(1deg * max(0, min(NaN, 10))))' and 'rotate(calc(NaN * 1deg))' should serialize the same in specified values. expected "rotate(calc(NaN * 1deg))" but got "rotate(calc(0deg))"
-FAIL 'rotate(calc(1deg * clamp(0, NaN, 10)))' as a specified value should serialize as 'rotate(calc(NaN * 1deg))'. assert_equals: 'rotate(calc(1deg * clamp(0, NaN, 10)))' and 'rotate(calc(NaN * 1deg))' should serialize the same in specified values. expected "rotate(calc(NaN * 1deg))" but got "rotate(calc(1deg * clamp(0, NaN, 10)))"
-FAIL 'rotate(calc(1deg * clamp(-Infinity, 0, infinity)))' as a specified value should serialize as 'rotate(calc(0deg))'. assert_equals: 'rotate(calc(1deg * clamp(-Infinity, 0, infinity)))' and 'rotate(calc(0deg))' should serialize the same in specified values. expected "rotate(calc(0deg))" but got "rotate(calc(1deg * clamp(-infinity, 0, infinity)))"
-FAIL 'rotate(calc(1deg * clamp(-inFinity, infinity, 10)))' as a specified value should serialize as 'rotate(calc(10deg))'. assert_equals: 'rotate(calc(1deg * clamp(-inFinity, infinity, 10)))' and 'rotate(calc(10deg))' should serialize the same in specified values. expected "rotate(calc(10deg))" but got "rotate(calc(1deg * clamp(-infinity, infinity, 10)))"
+PASS 'rotate(calc(1deg * clamp(NaN, 0, 10)))' as a specified value should serialize as 'rotate(calc(NaN * 1deg))'.
+PASS 'rotate(calc(1deg * max(0, min(10, NaN))))' as a specified value should serialize as 'rotate(calc(NaN * 1deg))'.
+PASS 'rotate(calc(1deg * clamp(0, 10, NaN)))' as a specified value should serialize as 'rotate(calc(NaN * 1deg))'.
+PASS 'rotate(calc(1deg * max(0, min(NaN, 10))))' as a specified value should serialize as 'rotate(calc(NaN * 1deg))'.
+PASS 'rotate(calc(1deg * clamp(0, NaN, 10)))' as a specified value should serialize as 'rotate(calc(NaN * 1deg))'.
+PASS 'rotate(calc(1deg * clamp(-Infinity, 0, infinity)))' as a specified value should serialize as 'rotate(calc(0deg))'.
+PASS 'rotate(calc(1deg * clamp(-inFinity, infinity, 10)))' as a specified value should serialize as 'rotate(calc(10deg))'.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-infinity-nan-serialize-length-expected.txt (292731 => 292732)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-infinity-nan-serialize-length-expected.txt 2022-04-11 22:56:48 UTC (rev 292731)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-infinity-nan-serialize-length-expected.txt 2022-04-11 23:05:22 UTC (rev 292732)
@@ -18,13 +18,13 @@
PASS 'calc(1 * min(inFInity*4px, 0px))' as a specified value should serialize as 'calc(0px)'.
PASS 'calc(1 * max(nAn*2px, 0px))' as a specified value should serialize as 'calc(NaN * 1px)'.
PASS 'calc(1 * min(nan*3px, 0px))' as a specified value should serialize as 'calc(NaN * 1px)'.
-FAIL 'calc(1 * clamp(-INFINITY*20px, 0px, infiniTY*10px))' as a specified value should serialize as 'calc(0px)'. assert_equals: 'calc(1 * clamp(-INFINITY*20px, 0px, infiniTY*10px))' and 'calc(0px)' should serialize the same in specified values. expected "calc(0px)" but got "calc(1 * clamp(-infinity * 1px, 0px, infinity * 1px))"
+PASS 'calc(1 * clamp(-INFINITY*20px, 0px, infiniTY*10px))' as a specified value should serialize as 'calc(0px)'.
PASS 'calc(1px * max(NaN, min(0,10)))' as a specified value should serialize as 'calc(NaN * 1px)'.
-FAIL 'calc(1px * clamp(NaN, 0, 10))' as a specified value should serialize as 'calc(NaN * 1px)'. assert_equals: 'calc(1px * clamp(NaN, 0, 10))' and 'calc(NaN * 1px)' should serialize the same in specified values. expected "calc(NaN * 1px)" but got "calc(1px * clamp(NaN, 0, 10))"
-FAIL 'calc(1px * max(0, min(10, NaN)))' as a specified value should serialize as 'calc(NaN * 1px)'. assert_equals: 'calc(1px * max(0, min(10, NaN)))' and 'calc(NaN * 1px)' should serialize the same in specified values. expected "calc(NaN * 1px)" but got "calc(10px)"
-FAIL 'calc(1px * clamp(0, 10, NaN))' as a specified value should serialize as 'calc(NaN * 1px)'. assert_equals: 'calc(1px * clamp(0, 10, NaN))' and 'calc(NaN * 1px)' should serialize the same in specified values. expected "calc(NaN * 1px)" but got "calc(1px * clamp(0, 10, NaN))"
-FAIL 'calc(1px * max(0, min(NaN, 10)))' as a specified value should serialize as 'calc(NaN * 1px)'. assert_equals: 'calc(1px * max(0, min(NaN, 10)))' and 'calc(NaN * 1px)' should serialize the same in specified values. expected "calc(NaN * 1px)" but got "calc(0px)"
-FAIL 'calc(1px * clamp(0, NaN, 10))' as a specified value should serialize as 'calc(NaN * 1px)'. assert_equals: 'calc(1px * clamp(0, NaN, 10))' and 'calc(NaN * 1px)' should serialize the same in specified values. expected "calc(NaN * 1px)" but got "calc(1px * clamp(0, NaN, 10))"
-FAIL 'calc(1px * clamp(-Infinity, 0, infinity))' as a specified value should serialize as 'calc(0px)'. assert_equals: 'calc(1px * clamp(-Infinity, 0, infinity))' and 'calc(0px)' should serialize the same in specified values. expected "calc(0px)" but got "calc(1px * clamp(-infinity, 0, infinity))"
-FAIL 'calc(1px * clamp(-inFinity, infinity, 10))' as a specified value should serialize as 'calc(10px)'. assert_equals: 'calc(1px * clamp(-inFinity, infinity, 10))' and 'calc(10px)' should serialize the same in specified values. expected "calc(10px)" but got "calc(1px * clamp(-infinity, infinity, 10))"
+PASS 'calc(1px * clamp(NaN, 0, 10))' as a specified value should serialize as 'calc(NaN * 1px)'.
+PASS 'calc(1px * max(0, min(10, NaN)))' as a specified value should serialize as 'calc(NaN * 1px)'.
+PASS 'calc(1px * clamp(0, 10, NaN))' as a specified value should serialize as 'calc(NaN * 1px)'.
+PASS 'calc(1px * max(0, min(NaN, 10)))' as a specified value should serialize as 'calc(NaN * 1px)'.
+PASS 'calc(1px * clamp(0, NaN, 10))' as a specified value should serialize as 'calc(NaN * 1px)'.
+PASS 'calc(1px * clamp(-Infinity, 0, infinity))' as a specified value should serialize as 'calc(0px)'.
+PASS 'calc(1px * clamp(-inFinity, infinity, 10))' as a specified value should serialize as 'calc(10px)'.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-infinity-nan-serialize-time-expected.txt (292731 => 292732)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-infinity-nan-serialize-time-expected.txt 2022-04-11 22:56:48 UTC (rev 292731)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-infinity-nan-serialize-time-expected.txt 2022-04-11 23:05:22 UTC (rev 292732)
@@ -18,13 +18,13 @@
PASS 'calc(1 * min(inFInity*4s, 0s))' as a specified value should serialize as 'calc(0s)'.
PASS 'calc(1 * max(nAn*2s, 0s))' as a specified value should serialize as 'calc(NaN * 1s)'.
PASS 'calc(1 * min(nan*3s, 0s))' as a specified value should serialize as 'calc(NaN * 1s)'.
-FAIL 'calc(1 * clamp(-INFINITY*20s, 0s, infiniTY*10s))' as a specified value should serialize as 'calc(0s)'. assert_equals: 'calc(1 * clamp(-INFINITY*20s, 0s, infiniTY*10s))' and 'calc(0s)' should serialize the same in specified values. expected "calc(0s)" but got "calc(1 * clamp(-infinity * 1s, 0s, infinity * 1s))"
+PASS 'calc(1 * clamp(-INFINITY*20s, 0s, infiniTY*10s))' as a specified value should serialize as 'calc(0s)'.
PASS 'calc(1s * max(NaN, min(0,10)))' as a specified value should serialize as 'calc(NaN * 1s)'.
-FAIL 'calc(1s * clamp(NaN, 0, 10))' as a specified value should serialize as 'calc(NaN * 1s)'. assert_equals: 'calc(1s * clamp(NaN, 0, 10))' and 'calc(NaN * 1s)' should serialize the same in specified values. expected "calc(NaN * 1s)" but got "calc(1s * clamp(NaN, 0, 10))"
-FAIL 'calc(1s * max(0, min(10, NaN)))' as a specified value should serialize as 'calc(NaN * 1s)'. assert_equals: 'calc(1s * max(0, min(10, NaN)))' and 'calc(NaN * 1s)' should serialize the same in specified values. expected "calc(NaN * 1s)" but got "calc(10s)"
-FAIL 'calc(1s * clamp(0, 10, NaN))' as a specified value should serialize as 'calc(NaN * 1s)'. assert_equals: 'calc(1s * clamp(0, 10, NaN))' and 'calc(NaN * 1s)' should serialize the same in specified values. expected "calc(NaN * 1s)" but got "calc(1s * clamp(0, 10, NaN))"
-FAIL 'calc(1s * max(0, min(NaN, 10)))' as a specified value should serialize as 'calc(NaN * 1s)'. assert_equals: 'calc(1s * max(0, min(NaN, 10)))' and 'calc(NaN * 1s)' should serialize the same in specified values. expected "calc(NaN * 1s)" but got "calc(0s)"
-FAIL 'calc(1s * clamp(0, NaN, 10))' as a specified value should serialize as 'calc(NaN * 1s)'. assert_equals: 'calc(1s * clamp(0, NaN, 10))' and 'calc(NaN * 1s)' should serialize the same in specified values. expected "calc(NaN * 1s)" but got "calc(1s * clamp(0, NaN, 10))"
-FAIL 'calc(1s * clamp(-Infinity, 0, infinity))' as a specified value should serialize as 'calc(0s)'. assert_equals: 'calc(1s * clamp(-Infinity, 0, infinity))' and 'calc(0s)' should serialize the same in specified values. expected "calc(0s)" but got "calc(1s * clamp(-infinity, 0, infinity))"
-FAIL 'calc(1s * clamp(-inFinity, infinity, 10))' as a specified value should serialize as 'calc(10s)'. assert_equals: 'calc(1s * clamp(-inFinity, infinity, 10))' and 'calc(10s)' should serialize the same in specified values. expected "calc(10s)" but got "calc(1s * clamp(-infinity, infinity, 10))"
+PASS 'calc(1s * clamp(NaN, 0, 10))' as a specified value should serialize as 'calc(NaN * 1s)'.
+PASS 'calc(1s * max(0, min(10, NaN)))' as a specified value should serialize as 'calc(NaN * 1s)'.
+PASS 'calc(1s * clamp(0, 10, NaN))' as a specified value should serialize as 'calc(NaN * 1s)'.
+PASS 'calc(1s * max(0, min(NaN, 10)))' as a specified value should serialize as 'calc(NaN * 1s)'.
+PASS 'calc(1s * clamp(0, NaN, 10))' as a specified value should serialize as 'calc(NaN * 1s)'.
+PASS 'calc(1s * clamp(-Infinity, 0, infinity))' as a specified value should serialize as 'calc(0s)'.
+PASS 'calc(1s * clamp(-inFinity, infinity, 10))' as a specified value should serialize as 'calc(10s)'.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/clamp-length-serialize.html (292731 => 292732)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/clamp-length-serialize.html 2022-04-11 22:56:48 UTC (rev 292731)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/clamp-length-serialize.html 2022-04-11 23:05:22 UTC (rev 292732)
@@ -10,6 +10,6 @@
}
test_valid_length('clamp(1px, 2px, 3px)', 'clamp(1px, 2px, 3px)');
-test_valid_length('clamp(1px, 2px, clamp(2px, 3px, 4px))', 'clamp(1px, 2px, clamp(2px, 3px, 4px))');
+test_valid_length('clamp(1px, 2px, clamp(2px, 3px, 4px))', 'clamp(1px, 2px, 3px)');
</script>
Modified: trunk/Source/WebCore/ChangeLog (292731 => 292732)
--- trunk/Source/WebCore/ChangeLog 2022-04-11 22:56:48 UTC (rev 292731)
+++ trunk/Source/WebCore/ChangeLog 2022-04-11 23:05:22 UTC (rev 292732)
@@ -1,3 +1,24 @@
+2022-04-11 Nikolaos Mouchtaris <[email protected]>
+
+ calc(): Propogate nan for min, max, clamp, and hypot
+ https://bugs.webkit.org/show_bug.cgi?id=238974
+
+ Reviewed by Darin Adler.
+
+ If min, max, clamp, and hypot have a NaN value we need to propagate the NaN. This has to
+ do with the "infectious" NaN behavior the spec mentions. This patch also removes some
+ unnecessary code in CSSCalcPrimitiveValueNode::invert() and has clamp() properly serialize.
+ May want to separate them and expand clamp() serialization testing so it would have caught
+ this issue.
+
+ * css/calc/CSSCalcOperationNode.cpp:
+ (WebCore::CSSCalcOperationNode::combineChildren):
+ (WebCore::CSSCalcOperationNode::simplifyNode):
+ (WebCore::CSSCalcOperationNode::evaluateOperator):
+ * css/calc/CSSCalcOperationNode.h:
+ * css/calc/CSSCalcPrimitiveValueNode.cpp:
+ (WebCore::CSSCalcPrimitiveValueNode::invert):
+
2022-04-11 Devin Rousso <[email protected]>
[Modern Media Controls] remove unnecessary `LayoutTraits` methods
Modified: trunk/Source/WebCore/css/calc/CSSCalcOperationNode.cpp (292731 => 292732)
--- trunk/Source/WebCore/css/calc/CSSCalcOperationNode.cpp 2022-04-11 22:56:48 UTC (rev 292731)
+++ trunk/Source/WebCore/css/calc/CSSCalcOperationNode.cpp 2022-04-11 23:05:22 UTC (rev 292732)
@@ -781,7 +781,7 @@
m_children = WTFMove(newChildren);
}
- if ((isMinOrMaxNode() || isHypotNode()) && canCombineAllChildren()) {
+ if ((isMinOrMaxNode() || isHypotNode() || isClampNode()) && canCombineAllChildren()) {
auto combinedUnitType = m_children[0]->primitiveType();
auto involvesPercentageComparisons = [&]() {
return combinedUnitType == CSSUnitType::CSS_PERCENTAGE && m_children.size() > 1;
@@ -1303,8 +1303,11 @@
if (children.isEmpty())
return std::numeric_limits<double>::quiet_NaN();
double minimum = children[0];
- for (auto child : children)
+ for (auto child : children) {
+ if (std::isnan(child))
+ return child;
minimum = std::min(minimum, child);
+ }
return minimum;
}
case CalcOperator::Max: {
@@ -1311,8 +1314,11 @@
if (children.isEmpty())
return std::numeric_limits<double>::quiet_NaN();
double maximum = children[0];
- for (auto child : children)
+ for (auto child : children) {
+ if (std::isnan(child))
+ return child;
maximum = std::max(maximum, child);
+ }
return maximum;
}
case CalcOperator::Clamp: {
@@ -1321,6 +1327,8 @@
double min = children[0];
double value = children[1];
double max = children[2];
+ if (std::isnan(min) || std::isnan(value) || std::isnan(max))
+ return std::numeric_limits<double>::quiet_NaN();
return std::max(min, std::min(value, max));
}
case CalcOperator::Pow:
@@ -1338,8 +1346,11 @@
if (children.size() == 1)
return std::abs(children[0]);
double sum = 0;
- for (auto child : children)
+ for (auto child : children) {
+ if (std::isnan(child))
+ return child;
sum += (child * child);
+ }
return std::sqrt(sum);
}
case CalcOperator::Sin: {
Modified: trunk/Source/WebCore/css/calc/CSSCalcOperationNode.h (292731 => 292732)
--- trunk/Source/WebCore/css/calc/CSSCalcOperationNode.h 2022-04-11 22:56:48 UTC (rev 292731)
+++ trunk/Source/WebCore/css/calc/CSSCalcOperationNode.h 2022-04-11 23:05:22 UTC (rev 292732)
@@ -69,7 +69,8 @@
bool isRoundConstant() const { return (isRoundOperation()) && !m_children.size(); }
bool isHypotNode() const { return m_operator == CalcOperator::Hypot; }
bool isPowOrSqrtNode() const { return m_operator == CalcOperator::Pow || m_operator == CalcOperator::Sqrt; }
- bool shouldPreserveFunction() const { return isTrigNode() || isExpNode() || isInverseTrigNode() || isAtan2Node() || isSignNode() || isSignNode() || isSteppedNode() || isRoundOperation() || isPowOrSqrtNode(); }
+ bool shouldPreserveFunction() const { return isTrigNode() || isExpNode() || isInverseTrigNode() || isAtan2Node() || isSignNode() || isSignNode() || isSteppedNode() || isRoundOperation() || isPowOrSqrtNode() || isClampNode(); }
+ bool isClampNode() const { return m_operator == CalcOperator::Clamp; }
void hoistChildrenWithOperator(CalcOperator);
void combineChildren();
Modified: trunk/Source/WebCore/css/calc/CSSCalcPrimitiveValueNode.cpp (292731 => 292732)
--- trunk/Source/WebCore/css/calc/CSSCalcPrimitiveValueNode.cpp 2022-04-11 22:56:48 UTC (rev 292731)
+++ trunk/Source/WebCore/css/calc/CSSCalcPrimitiveValueNode.cpp 2022-04-11 23:05:22 UTC (rev 292732)
@@ -85,11 +85,6 @@
void CSSCalcPrimitiveValueNode::invert()
{
ASSERT(isNumericValue());
- if (!m_value->doubleValue()) {
- m_value = CSSPrimitiveValue::create(std::copysign(std::numeric_limits<double>::infinity(), m_value->doubleValue()), m_value->primitiveType());
- return;
- }
-
m_value = CSSPrimitiveValue::create(1.0 / m_value->doubleValue(), m_value->primitiveType());
}