[webkit-changes] [WebKit/WebKit] e3fb29: Add support for CSSNumericValue.toSum()

Chris Dumez noreply at github.com
Tue Oct 18 10:14:55 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e3fb2936dcb722b7844f67bb955012b62777be8d
      https://github.com/WebKit/WebKit/commit/e3fb2936dcb722b7844f67bb955012b62777be8d
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2022-10-18 (Tue, 18 Oct 2022)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssTransformComponent-toMatrix-relative-units-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/numeric-objects/toSum.tentative-expected.txt
    M Source/WebCore/css/CSSUnits.cpp
    M Source/WebCore/css/CSSUnits.h
    M Source/WebCore/css/typedom/CSSNumericValue.cpp
    M Source/WebCore/css/typedom/CSSUnitValue.cpp
    M Source/WebCore/css/typedom/numeric/CSSNumericType.cpp

  Log Message:
  -----------
  Add support for CSSNumericValue.toSum()
https://bugs.webkit.org/show_bug.cgi?id=246673

Reviewed by Geoffrey Garen.

Add support for CSSNumericValue.toSum():
- https://drafts.css-houdini.org/css-typed-om/#dom-cssnumericvalue-tosum

* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssTransformComponent-toMatrix-relative-units-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/numeric-objects/toSum.tentative-expected.txt:
Rebaseline WPT tests now that more checks are passing.

* Source/WebCore/css/CSSUnits.cpp:
(WebCore::unitCategory):
Match the categories more closely with the specification. It is particularly important to
split the different types of lengths. "em" for example is a font-relative length. We used
to have it with the absolute lengths and would thus incorrectly convert it to "px" which
is the canonical unit for absolute lengths.

(WebCore::canonicalUnitTypeForCategory):
(WebCore::operator<<):
* Source/WebCore/css/CSSUnits.h:

* Source/WebCore/css/typedom/CSSNumericValue.cpp:
(WebCore::createCSSUnitValueFromAddend):
Properly implement:
- https://drafts.css-houdini.org/css-typed-om/#create-a-cssunitvalue-from-a-sum-value-item
and factor to its own function for reuse. In particular, we were supposed to fail if the
unit exponent is not 1.

(WebCore::CSSNumericValue::to):
Factor out some code to createCSSUnitValueFromAddend().

(WebCore::CSSNumericValue::toSum):
Implement as per:
- - https://drafts.css-houdini.org/css-typed-om/#dom-cssnumericvalue-tosum

* Source/WebCore/css/typedom/CSSUnitValue.cpp:
(WebCore::CSSUnitValue::toSumValue const):
* Source/WebCore/css/typedom/numeric/CSSNumericType.cpp:
(WebCore::CSSNumericType::create):

Canonical link: https://commits.webkit.org/255679@main




More information about the webkit-changes mailing list