Skip to content

Commit

Permalink
Change parentheses condition for css math serialization
Browse files Browse the repository at this point in the history
Previously the condition for adding parentheses for serialization
was vast and caused every arithmetic operation to be in parentheses.

With time a lot of simplifications were added and now the only case
where we can end up with parentheses is when either operand
of the multiplication/division is unsimplified add/sub node:
(lhs as unsimplified add/sub) [* or /] rhs
or
lhs [* or /] (rhs as unsimplified add/sub).

Change-Id: I7a4d881357205b8c317029cb2c65548a2a39a80f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5062788
Commit-Queue: Daniil Sakhapov <[email protected]>
Reviewed-by: Anders Hartvoll Ruud <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1230040}
  • Loading branch information
danielsakhapov authored and chromium-wpt-export-bot committed Nov 28, 2023
1 parent 176f0a7 commit fa5ecc7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions css/css-values/minmax-length-percent-serialize.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,11 @@
'calc(25% + 2em + 30px)',
'calc(25% + 62px)',
'87px');

test_serialization(
'max((min(10%, 30px) + 10px) * 2 + 10px, 5em + 5%)',
'max(10px + (10px + min(10%, 30px)) * 2, 5% + 5em)',
'max(10px + (10px + min(10%, 30px)) * 2, 5% + 80px)',
'85px',
prop='width');
</script>

0 comments on commit fa5ecc7

Please sign in to comment.