| Summary: | ::first-letter styles cause Range clientRect miscalculations | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Joseph Pearson <j> | ||||
| Component: | Layout and Rendering | Assignee: | Nobody <webkit-unassigned> | ||||
| Status: | NEW --- | ||||||
| Severity: | Minor | CC: | ahmad.saleem792, bfulgham, simon.fraser, smoley, webkit-bug-importer, wenson_hsieh, zalan | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | Safari Technology Preview | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=43830 | ||||||
| Attachments: |
|
||||||
Thanks for filing. I can reproduce this with the test case on Safari 13.1.3 as well as STP 115 (14.1). I am able to reproduce this bug in Safari Technology Preview 154 using attached test case and both Example 2 and 3 doe snot highlight "troublemakers" like Expected Results while both Firefox Nightly 107 and Chrome Canary 108 show expected results in all cases / example. Thanks! |
Created attachment 414449 [details] Example showing expected result and miscalcs If an element has a ::first-letter style rule, creating a Range within that element and measuring its client rectangles (Range#getClientRects or Range#getBoundingClientRects) will produce incorrect dimensions. The range itself is fine: Range#toString() shows that the correct characters have been selected. But the resulting rectangles are wrong, at least on the x axis (left, width). Note that *any* ::first-letter declaration on the element produces the bug, even if the styles are not layout-affecting, and even if they're invalid style values. See a quick reduction in the attached file. I don't think this is a new bug — I have observed it for years, but only got around to the reduction today.