Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Add support for CSSNumericValue.parse()
https://bugs.webkit.org/show_bug.cgi?id=246775 Reviewed by Geoffrey Garen. Add support for CSSNumericValue.parse(): - https://drafts.css-houdini.org/css-typed-om/#dom-cssnumericvalue-parse * LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-numeric.tentative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/numeric-objects/parse.tentative-expected.txt: Rebaseline WPT tests now that more checks are passing. * Source/WebCore/css/calc/CSSCalcPrimitiveValueNode.h: * Source/WebCore/css/typedom/CSSNumericValue.cpp: (WebCore::canonicalOperator): (WebCore::canCombineNodes): (WebCore::negateOrInvertIfRequired): (WebCore::convertToExceptionOrNumericValue): (WebCore::reifyMathExpression): (WebCore::reifyMathExpressions): (WebCore::CSSNumericValue::addInternal): (WebCore::CSSNumericValue::multiplyInternal): (WebCore::CSSNumericValue::div): (WebCore::CSSNumericValue::min): (WebCore::CSSNumericValue::max): (WebCore::CSSNumericValue::parse): Canonical link: https://commits.webkit.org/255791@main
- Loading branch information
Showing
6 changed files
with
199 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
|
||
FAIL Normalizing a <number> returns a number CSSUnitValue Not implemented Error | ||
FAIL Normalizing a <percentage> returns a percent CSSUnitValue Not implemented Error | ||
FAIL Normalizing a <dimension> returns a CSSUnitValue with the correct unit Not implemented Error | ||
FAIL Normalizing a <number> with a unitless zero returns 0 Not implemented Error | ||
FAIL Normalizing a <calc> returns simplified expression Not implemented Error | ||
PASS Normalizing a <number> returns a number CSSUnitValue | ||
PASS Normalizing a <percentage> returns a percent CSSUnitValue | ||
PASS Normalizing a <dimension> returns a CSSUnitValue with the correct unit | ||
PASS Normalizing a <number> with a unitless zero returns 0 | ||
FAIL Normalizing a <calc> returns simplified expression assert_approx_equals: expected 4 +/- 0.000001 but got 1 | ||
PASS Normalizing a <dimension> with a unitless zero returns 0px | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
|
||
FAIL Parsing an invalid string throws SyntaxError assert_throws_dom: function "() => CSSNumericValue.parse('%#(')" threw object "NotSupportedError: Not implemented Error" that is not a DOMException SyntaxError: property "code" is equal to 9, expected 12 | ||
FAIL Parsing a string with a non numeric token throws SyntaxError assert_throws_dom: function "() => CSSNumericValue.parse('auto')" threw object "NotSupportedError: Not implemented Error" that is not a DOMException SyntaxError: property "code" is equal to 9, expected 12 | ||
FAIL Parsing a string with left over numeric tokens throws SyntaxError assert_throws_dom: function "() => CSSNumericValue.parse('1 2')" threw object "NotSupportedError: Not implemented Error" that is not a DOMException SyntaxError: property "code" is equal to 9, expected 12 | ||
FAIL Parsing a calc with incompatible units throws a SyntaxError assert_throws_dom: function "() => CSSNumericValue.parse('calc(calc(1px * 2s) + 3%)')" threw object "NotSupportedError: Not implemented Error" that is not a DOMException SyntaxError: property "code" is equal to 9, expected 12 | ||
FAIL Parsing a <dimension-token> with invalid units throws a SyntaxError assert_throws_dom: function "() => CSSNumericValue.parse('1xyz')" threw object "NotSupportedError: Not implemented Error" that is not a DOMException SyntaxError: property "code" is equal to 9, expected 12 | ||
FAIL Parsing ignores surrounding spaces Not implemented Error | ||
FAIL Parsing min() is successful Not implemented Error | ||
FAIL Parsing max() is successful Not implemented Error | ||
FAIL Parsing clamp() is successful Not implemented Error | ||
PASS Parsing an invalid string throws SyntaxError | ||
PASS Parsing a string with a non numeric token throws SyntaxError | ||
PASS Parsing a string with left over numeric tokens throws SyntaxError | ||
PASS Parsing a calc with incompatible units throws a SyntaxError | ||
PASS Parsing a <dimension-token> with invalid units throws a SyntaxError | ||
PASS Parsing ignores surrounding spaces | ||
PASS Parsing min() is successful | ||
PASS Parsing max() is successful | ||
PASS Parsing clamp() is successful | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters