[webkit-changes] [WebKit/WebKit] 15a8c3: [CSS Math Functions] Correctly serialize sin/cos/t...

Tim Nguyen noreply at github.com
Sat Jul 8 13:08:53 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 15a8c32776708f07ae1c3b9539640cb00ae1e6a8
      https://github.com/WebKit/WebKit/commit/15a8c32776708f07ae1c3b9539640cb00ae1e6a8
  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/sin-cos-tan-serialize-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-values/sin-cos-tan-serialize.html
    M Source/WebCore/css/calc/CSSCalcOperationNode.cpp
    M Source/WebCore/css/calc/CSSCalcOperationNode.h
    M Source/WebCore/platform/calc/CalcExpressionOperation.cpp

  Log Message:
  -----------
  [CSS Math Functions] Correctly serialize sin/cos/tan functions
https://bugs.webkit.org/show_bug.cgi?id=259011
rdar://111947212

Reviewed by Darin Adler.

There are 2 main changes:

- We now always try to resolve top level sin/cos/tan functions, cos(0) will serialize as calc(1) instead of cos(0) for instance. This is consistent with how calc(cos(0)) is serialized.

>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.

- tan(90deg) & tan(-90deg) now return respectively calc(infinity) & calc(-infinity)

* LayoutTests/imported/w3c/web-platform-tests/css/css-values/sin-cos-tan-serialize-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-values/sin-cos-tan-serialize.html:

Update these tests from upstream WPT.

* Source/WebCore/css/calc/CSSCalcOperationNode.cpp:
(WebCore::CSSCalcOperationNode::evaluateOperator):
* Source/WebCore/css/calc/CSSCalcOperationNode.h:
* Source/WebCore/platform/calc/CalcExpressionOperation.cpp:
(WebCore::CalcExpressionOperation::evaluate const):

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




More information about the webkit-changes mailing list