[webkit-changes] [WebKit/WebKit] ea2246: [CSS Math Functions] Correctly serialize abs/sign/...

Tim Nguyen noreply at github.com
Sat Jul 8 11:14:52 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ea22468da561b39617b387235d52c2cc0c012dd1
      https://github.com/WebKit/WebKit/commit/ea22468da561b39617b387235d52c2cc0c012dd1
  Author: Tim Nguyen <ntim at apple.com>
  Date:   2023-07-08 (Sat, 08 Jul 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/css/css-values/exp-log-serialize-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-values/exp-log-serialize.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-invalid-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-invalid.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-serialize-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-serialize.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-values/signs-abs-serialize-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-values/signs-abs-serialize.html
    M Source/WebCore/css/calc/CSSCalcOperationNode.cpp
    M Source/WebCore/css/calc/CSSCalcOperationNode.h

  Log Message:
  -----------
  [CSS Math Functions] Correctly serialize abs/sign/exp/log/pow/sqrt root nodes
https://bugs.webkit.org/show_bug.cgi?id=259012
rdar://111948465

Reviewed by Darin Adler.

>From the spec https://drafts.csswg.org/css-values-4/#calc-simplification:

> If root is an operator node that’s not one of the calc-operator nodes, and all of its calculation children are numeric values with enough information to compute the operation root represents, return the result of running root’s operation using its children, expressed in the result’s canonical unit.

We now always try to resolve the top-level abs/sign/exp/log/pow/sqrt functions, e.g. abs(-1) now becomes calc(1) instead of staying abs(-1).
This is consistent with calc(abs(-1)) being serialized as calc(1).

* LayoutTests/imported/w3c/web-platform-tests/css/css-values/exp-log-serialize-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-values/exp-log-serialize.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-invalid-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-invalid.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-serialize-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-serialize.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-values/signs-abs-serialize-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-values/signs-abs-serialize.html:

Re-import WPT with fixes from upstream.

* Source/WebCore/css/calc/CSSCalcOperationNode.cpp:
(WebCore::CSSCalcOperationNode::simplifyNode):
* Source/WebCore/css/calc/CSSCalcOperationNode.h:

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




More information about the webkit-changes mailing list