| Summary: | getComputedStyle(img).height returns string of a rounded int not a float | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | cathiechen <cathiechen> | ||||||||||||
| Component: | CSS | Assignee: | Sammy Gill <sgill26> | ||||||||||||
| Status: | RESOLVED FIXED | ||||||||||||||
| Severity: | Normal | CC: | bfulgham, emilio, esprehn+autocc, ews-watchlist, fred.wang, glenn, kondapallykalyan, pdr, sabouhallawa, simon.fraser, webkit-bug-importer, yurys, zalan | ||||||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||||||
| Version: | WebKit Nightly Build | ||||||||||||||
| Hardware: | Unspecified | ||||||||||||||
| OS: | Unspecified | ||||||||||||||
| Bug Depends on: | |||||||||||||||
| Bug Blocks: | 201641, 242079 | ||||||||||||||
| Attachments: |
|
||||||||||||||
|
Description
cathiechen
2020-01-12 21:04:34 PST
These are the relevant spec definitions: getComputedStyle(): https://drafts.csswg.org/cssom/#extensions-to-the-window-interface CSS declaration block: https://drafts.csswg.org/cssom/#css-declaration-block CSS declaration: https://drafts.csswg.org/cssom/#css-declaration Serialize a CSS declaration: https://drafts.csswg.org/cssom/#serialize-a-css-declaration Serialize a CSS value: https://drafts.csswg.org/cssom/#serialize-a-css-value Serialize a CSS component value: https://drafts.csswg.org/cssom/#serialize-a-css-component-value <length> The <number> component serialized as per <number> followed by the unit in its canonical form as defined in its respective specification. ISSUE 12: Probably should distinguish between specified and computed / resolved values. <number> A base-ten number using digits 0-9 (U+0030 to U+0039) in the shortest form possible, using "." to separate decimals (if any), rounding the value if necessary to not produce more than 6 decimals, preceded by "-" (U+002D) if it is negative. Note: scientific notation is not used. <percentage> The <number> component serialized as per <number> followed by the literal string "%" (U+0025). Created attachment 387638 [details]
testcase
Serialization seems to happen as expected in Gecko/Blink/WebKit with the attached testcase.
Created attachment 387639 [details]
testcase
Created attachment 387775 [details]
Add_img_test_cases
Hi Fred,
This issue seems only related to RenderReplaced, i.e, use intrinsic aspect-ratio to compute width / height. In RenderReplaced::computeReplacedLogicalWidth and RenderReplaced::computeReplacedLogicalHeight, roundToInt is called.
PS: Append <img> test to your case.
Created attachment 387784 [details]
Add_img_test_cases
Created attachment 388035 [details]
Patch
Pull request: https://github.com/WebKit/WebKit/pull/1191 Committed r295701 (251706@main): <https://commits.webkit.org/251706@main> Reviewed commits have been landed. Closing PR #1191 and removing active labels. Re-opening for pull request https://github.com/WebKit/WebKit/pull/1902 Committed 251955@main (5d047d546dd9): <https://commits.webkit.org/251955@main> Reviewed commits have been landed. Closing PR #1902 and removing active labels. Patch has been reverted due to regression reported in 242079. Reopening. Pull request: https://github.com/WebKit/WebKit/pull/2138 Committed 252583@main (e2c4f937d459): <https://commits.webkit.org/252583@main> Reviewed commits have been landed. Closing PR #2138 and removing active labels. |