New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 612459 link

Starred by 4 users

Issue metadata

Status: Available
Merged: issue 426017
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug



Sign in to add a comment

Range.getClientRects returns multiple rectangles for text in one line

Reported by mihai.ba...@gmail.com, May 17 2016

Issue description

UserAgent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0

Steps to reproduce the problem:
Demo here: http://lisperator.net/@file/126/41036607fcafbd99e1aa1dfe2f79b3d66636ae9d/getClientRects.html

There are these erroneous cases that I suspect might be caused by the same root problem:

1. Selection at the start of a line, when line breaking occurred at a dash character, includes a 3-4px rectangle on the previous line (expands the bounding client rect):

http://lisperator.net/@file/130/d5f88998831e8b3fa34d9a048c78dfe3dbe7a1fb/getClientRects-1.png

2. Selecting a whole line including the dash will generate 3 client rects, with the bounding client rect expanding to contain only two (probably because the last one has width zero):

http://lisperator.net/@file/129/84f48e926fb5073bdaf5dc0452961ed5ea768b66/getClientRects-2.png

3. Selecting at the start of a line in a node with white-space: pre also generates a client rect on the previous line (as wide as a character):

http://lisperator.net/@file/128/f3d5a1f128e3f1f8283861f0ed059044b226d9e6/getClientRects-3.png

4. Sometimes multiple client rects are returned on a single line:

http://lisperator.net/@file/127/bd39d2a7d502bde535f8be95bf18d79b29dee33f/getClientRects-4.png

What is the expected behavior?
getClientRects should return only the rectangle for the actually selected text.

What went wrong?
getClientRects returns additional rectangles that have nothing to do with the caret/selection location.

Did this work before? N/A 

Chrome version: Version 50.0.2661.94 (64-bit)  Channel: stable
OS Version: 
Flash Version: Shockwave Flash 11.0 r1
 
This issue is possibly related: https://bugs.chromium.org/p/chromium/issues/detail?id=426017
Just got confirmation that this can be reproduced on Windows as well, including in Chrome Canary.
Components: -Blink Blink>Editing
Cc: tkonch...@chromium.org
Mergedinto: 426017
Status: Duplicate (was: Unconfirmed)
Tested the same on win8.1 chrome version 50.0.2661.102 and 52.0.2740.0 - getClientRects returns additional rectangles irrespectve of selection

This issue looks similar to  Issue 426017 . Hence duping into it. 

Please undupe if both are not similar
I thought they are similar, but that one is about getting the cursor position, rather than selection.  OTOH, it's been reported for a good while now and there is no resolution.  It's a pretty show-stopper bug IMO, making this API rather useless.
Status: Available (was: Duplicate)
Reverse merging  issue 426017  to this one, since this one has a concrete test case and reports more issues.
 Issue 426017  has been merged into this issue.
Can no longer reproduce the first three issues with latest Stable M60 or Canary M62. See attached screenshots.

The last issue, "multiple client rects are returned on a single line", still repros. It's due to that Blink collects client rects from InlineTextBoxes, while InlineTextBoxes are constrained to the parts of text nodes without whitespace collapsing and line breaks. In other words, if a line of text contains collapsed spaces, the rect of this line will be broken at those collapsed spaces.
Summary: Range.getClientRects returns multiple rectangles for text in one line (was: Range.getClientRects includes rectangles on previous / next line)
Forgot attachments...
getClientRects-1.png
153 KB View Download
getClientRects-2.png
153 KB View Download
getClientRects-3.png
153 KB View Download
Labels: Pri-3
Project Member

Comment 11 by sheriffbot@chromium.org, Oct 4

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: Available (was: Untriaged)

Sign in to add a comment