[webkit-changes] [WebKit/WebKit] 70fc9b: [CSS Math Functions] min/max() with one argument s...

Tim Nguyen noreply at github.com
Sun Jul 9 20:44:54 PDT 2023


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

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/css/css-values/minmax-length-percent-serialize-expected.txt
    M Source/WebCore/css/calc/CSSCalcOperationNode.cpp

  Log Message:
  -----------
  [CSS Math Functions] min/max() with one argument should always collapse to calc()
https://bugs.webkit.org/show_bug.cgi?id=259037
rdar://111986569

Reviewed by Darin Adler.

`min(10px + 10%)` & `max(10px + 10%)` currently don't collapse to `calc(10px + 10%)` because (10px + 10%) does not generate a
`CSSCalcPrimitiveValueNode` but a `CSSCalcOperationNode` due to the sum of pixels and percentages that can't be simplified.
Add an identity check (min/max with 1 argument) to collapse them.

In the identity case, we also want to try and combine the parent with the child when relevant to avoid getting `calc((10px + 10%))`
(with the double parentheses) when serializing, so we don't return false early from the lambda.

* LayoutTests/imported/w3c/web-platform-tests/css/css-values/minmax-length-percent-serialize-expected.txt:
* Source/WebCore/css/calc/CSSCalcOperationNode.cpp:
(WebCore::CSSCalcOperationNode::simplifyNode):

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




More information about the webkit-changes mailing list