getBoundingClientRect computes wrong height for cross-element selections
Reported by
rafalpi...@gmail.com,
Mar 19 2016
|
||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36 Steps to reproduce the problem: 1. Go to http://rafalp.github.io/TextSelect/ 2. Select text starting from middle of one paragraph's height and ending in middle of next paragraph. 3. The getBoundingClientRect will return invalid dimensions causing bounding box to wrap around whole last paragraph What is the expected behavior? getBoundingClientRect returned height should should match bottom of selection's rect, like on FF: https://github.com/rafalp/TextSelect/issues/1#issuecomment-198775305 What went wrong? getBoundingClientRect computes wrong height for cross-element selections, rounding it to the bottom boundary of last element. Did this work before? N/A Chrome version: 49.0.2623.87 Channel: stable OS Version: OS X 10.9.5 Flash Version: Shockwave Flash 21.0 r0
,
Mar 22 2016
Remove Blink>Layout, since root cause is we iterator over nodes in range in
Range::getBoundingClientRect().
Range::getBoundingClientRect()
Node* startContainer = m_start.container();
Node* endContainer = m_end.container();
Node* stopNode = pastLastNode();
WillBeHeapHashSet<RawPtrWillBeMember<Node>> nodeSet;
for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next(*node)) {
if (node->isElementNode())
nodeSet.add(node);
}
In #c1 sample, we have Text, P, Text when selecting start from middle of P and to middle of another P.
,
Jun 29 2016
This issue affects the bounding rect's height as well. In the following JSFiddle, select `lo Wo` in latest Chrome (53.0.2782.5 Canary). The resulting `getBoundingClientRect()` will not equal the selection. https://jsfiddle.net/b1kd0fcp/
,
Oct 12 2016
,
Apr 24 2017
I see this all the time on GitHub code and other places. The highlight never extends to the top of the text.
,
Apr 25 2017
I can confirm this bug is gone as of Chrome 58.0.3029.81
,
Aug 11 2017
Closing the issue as neither of the test cases (in #0 and #3) reproduces in the latest Stable M60. |
||||
►
Sign in to add a comment |
||||
Comment 1 by cbiesin...@chromium.org
, Mar 21 2016