Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CSS Math Functions] Correctly serialize sin/cos/tan functions #15664

Commits on Jul 8, 2023

  1. [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
    nt1m committed Jul 8, 2023
    Configuration menu
    Copy the full SHA
    15a8c32 View commit details
    Browse the repository at this point in the history