Changeset 291911 in webkit
- Timestamp:
- Mar 25, 2022 6:45:25 PM (4 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-infinity-nan-computed-expected.txt (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-infinity-nan-computed.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/round-function-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/round-function.html (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/calc/CSSCalcOperationNode.cpp (modified) (1 diff)
-
Source/WebCore/css/calc/CSSCalcOperationNode.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r291888 r291911 1 2022-03-25 Nikolaos Mouchtaris <nmouchtaris@apple.com> 2 3 Incorrect handling of NaN inside calc() for top-level calculation 4 https://bugs.webkit.org/show_bug.cgi?id=234176 5 6 Reviewed by Simon Fraser. 7 8 * web-platform-tests/css/css-values/calc-infinity-nan-computed-expected.txt: Added. 9 * web-platform-tests/css/css-values/calc-infinity-nan-computed.html: Added. 10 * web-platform-tests/css/css-values/round-function-expected.txt: 11 * web-platform-tests/css/css-values/round-function.html: 12 1 13 2022-03-25 Youenn Fablet <youenn@apple.com> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/round-function-expected.txt
r291841 r291911 36 36 PASS round(-13px, -10px) should be used-value-equivalent to -10px 37 37 PASS round(-18px, -10px) should be used-value-equivalent to -20px 38 PASS round(5, 0) should be used-value-equivalent to calc(NaN) 39 PASS calc(-1 * round(5, 0)) should be used-value-equivalent to calc(NaN) 40 PASS round(infinity, infinity) should be used-value-equivalent to calc(NaN) 41 PASS calc(-1 * round(infinity, infinity)) should be used-value-equivalent to calc(NaN) 42 PASS round(infinity, -infinity) should be used-value-equivalent to calc(NaN) 43 PASS calc(-1 * round(infinity, -infinity)) should be used-value-equivalent to calc(NaN) 44 PASS round(-infinity, infinity) should be used-value-equivalent to calc(NaN) 45 PASS calc(-1 * round(-infinity, infinity)) should be used-value-equivalent to calc(NaN) 46 PASS round(-infinity, -infinity) should be used-value-equivalent to calc(NaN) 47 PASS calc(-1 * round(-infinity, -infinity)) should be used-value-equivalent to calc(NaN) 38 PASS round(5, 0) should be used-value-equivalent to calc(infinity) 39 PASS round(infinity, infinity) should be used-value-equivalent to calc(infinity) 40 PASS round(infinity, -infinity) should be used-value-equivalent to calc(infinity) 41 PASS round(-infinity, infinity) should be used-value-equivalent to calc(infinity) 42 PASS round(-infinity, -infinity) should be used-value-equivalent to calc(infinity) 48 43 PASS round(infinity, 5) should be used-value-equivalent to calc(infinity) 49 44 PASS round(infinity, -5) should be used-value-equivalent to calc(infinity) -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/round-function.html
r264522 r291911 62 62 63 63 // 0 step is NaN 64 test_ nan("round(5, 0)");64 test_plus_infinity("round(5, 0)"); 65 65 // both infinite is NaN 66 test_ nan("round(infinity, infinity)");67 test_ nan("round(infinity, -infinity)");68 test_ nan("round(-infinity, infinity)");69 test_ nan("round(-infinity, -infinity)");66 test_plus_infinity("round(infinity, infinity)"); 67 test_plus_infinity("round(infinity, -infinity)"); 68 test_plus_infinity("round(-infinity, infinity)"); 69 test_plus_infinity("round(-infinity, -infinity)"); 70 70 71 71 // infinite value with finite step is the same infinity -
trunk/Source/WebCore/ChangeLog
r291902 r291911 1 2022-03-25 Nikolaos Mouchtaris <nmouchtaris@apple.com> 2 3 Incorrect handling of NaN inside calc() for top-level calculation 4 https://bugs.webkit.org/show_bug.cgi?id=234176 5 6 Reviewed by Simon Fraser. 7 8 Add function to convert any top level NaN values to infinity values as per the spec. 9 This only affects the computed value of the calc expression, not its serialization. 10 11 Test: imported/w3c/web-platform-tests/css/css-values/calc-infinity-nan-computed.html 12 13 * css/calc/CSSCalcOperationNode.cpp: 14 (WebCore::CSSCalcOperationNode::combineChildren): 15 (WebCore::convertToTopLevelValue): 16 (WebCore::CSSCalcOperationNode::evaluateOperator): 17 * css/calc/CSSCalcOperationNode.h: 18 1 19 2022-03-25 Chris Dumez <cdumez@apple.com> 2 20 -
trunk/Source/WebCore/css/calc/CSSCalcOperationNode.cpp
r291841 r291911 624 624 if (isIdentity() || !m_children.size()) 625 625 return; 626 626 m_isRoot = IsRoot::No; 627 627 628 if (m_children.size() < 2) { 628 629 if (m_children.size() == 1 && isTrigNode()) { -
trunk/Source/WebCore/css/calc/CSSCalcOperationNode.h
r291516 r291911 34 34 WTF_MAKE_FAST_ALLOCATED; 35 35 public: 36 enum class IsRoot : bool { No, Yes }; 37 36 38 static RefPtr<CSSCalcOperationNode> create(CalcOperator, RefPtr<CSSCalcExpressionNode>&& leftSide, RefPtr<CSSCalcExpressionNode>&& rightSide); 37 39 static RefPtr<CSSCalcOperationNode> createSum(Vector<Ref<CSSCalcExpressionNode>>&& values); … … 126 128 return nullptr; 127 129 } 128 130 131 static double convertToTopLevelValue(double value) 132 { 133 if (isnan(value)) 134 value = std::numeric_limits<double>::infinity(); 135 return value; 136 } 137 129 138 double evaluate(const Vector<double>& children) const 130 139 { 131 return evaluateOperator(m_operator, children); 140 auto result = evaluateOperator(m_operator, children); 141 return m_isRoot == IsRoot::No ? result : convertToTopLevelValue(result); 132 142 } 133 143 … … 145 155 Vector<Ref<CSSCalcExpressionNode>> m_children; 146 156 bool m_allowsNegativePercentageReference = false; 157 IsRoot m_isRoot = IsRoot::Yes; 147 158 }; 148 159
Note: See TracChangeset
for help on using the changeset viewer.