Issue metadata
Sign in to add a comment
|
A range covering the first character after a soft-wrap under white-space: pre-wrap has an over-sized bounding rect
Reported by
rom...@gmail.com,
Apr 27 2016
|
||||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.86 Safari/537.36 Example URL: http://jsfiddle.net/egLp23xL/1/ Steps to reproduce the problem: Reposting here – my original comment was on Issue 456282 . The recent Chrome auto-update (50.0.2661.86) has a bug that has caused some extreme breakage in an app I work on that depends heavily on the behaviour of range.getBoundingClientRect(). I've included a fiddle (based on previous fiddles in this thread) that replicates the bug - in short, a single-character range that covers the first soft-wrapped character in a line has *two* clientRects; one for the typographic character, and one for the implicit position of the character pre-soft-wrap. With the boundingRect becoming always equal to the union of all clientRects, this means that a single soft-wrapped character has a boundingRect that spans two lines and [nearly] the entire width of the text node. Here is the fiddle showing this behaviour: http://jsfiddle.net/egLp23xL/1/ n.b. that this behaviour is only apparent on elements with "white-space: pre-wrap" set. The behaviour in other browsers (I only have a Mac at hand, so all are OS X): Safari (11601.5.17.1): Includes both clientRects, but boundingRect is as I'd expect, just the typographic 'a' Firefox (46.0): Only includes the expected boundingRect for the typographic 'a' Chrome Canary & Chromium (52.0.2717.0, 52.0.2716.0), same behaviour as Chrome above. What is the expected behavior? The range's boundingRect should be solely the typographic character, not the rect that spans both the pre-soft-wrap position and the typographic character. However, having both rects returned via getClientRects() is very useful. What went wrong? My app broke. ;-) We depend on correct boundingrects in order to compute text positions. Does it occur on multiple sites: N/A Is it a problem with a plugin? No Did this work before? Yes Chrome 49 (before the fix implemented for 456282) Does this work in other browsers? Yes Chrome version: 50.0.2661.86 Channel: stable OS Version: OS X 10.11.4 Flash Version: Shockwave Flash 21.0 r0
,
Apr 28 2016
|
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by kojii@chromium.org
, Apr 27 2016Owner: kojii@chromium.org
Status: Assigned (was: Unconfirmed)