Bug 201637
Summary: | WebKit incorrectly ignores percentages during calc() serialization | ||
---|---|---|---|
Product: | WebKit | Reporter: | Emilio Cobos Álvarez (:emilio) <emilio> |
Component: | CSS | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED CONFIGURATION CHANGED | ||
Severity: | Normal | CC: | bfulgham |
Priority: | P2 | ||
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Emilio Cobos Álvarez (:emilio)
Chrome also has this bug, see https://bugs.chromium.org/p/chromium/issues/detail?id=1002430
1. Open data:text/html,<div style="background-position: calc(0% + 0px) calc(0% + 0px)"></div>
2. Run on the terminal: getComputedStyle(document.querySelector("div")).backgroundPosition
Expected: calc(0% + 0px) calc(0% + 0px)
Actual: 0px 0px
Per https://drafts.csswg.org/css-values-4/#calc-computed-value:
> Where percentages are not resolved at computed-value time, they are not resolved in math functions, e.g. calc(100% - 100% + 1px) resolves to calc(0% + 1px), not to 1px. If there are special rules for computing percentages in a value (e.g. the height property), they apply whenever a math function contains percentages.
See also https://github.com/w3c/csswg-drafts/issues/3482, and https://bugzilla.mozilla.org/show_bug.cgi?id=1574913 which is where this came up.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Brent Fulgham
Safari, Chrome, and Firefox all agree on the output:
"0% 0%"
I believe this now works properly. Please REOPEN if I am misunderstanding the issue.