Closed Bug 999454 Opened 10 years ago Closed 10 years ago

getBoundingClientRect on selection range is not working after applying a scale transform.

Categories

(Core :: DOM: Core & HTML, defect)

28 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 863618

People

(Reporter: stefan.neculai, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14

Steps to reproduce:

1) Create a div and set its width, height, left and top.

2) Apply a scale transform on it from JS. For example: transform: scale(4).

3) Select a portion of text from that div.

4) Look at document.getSelection().getRangeAt(0).getBoundingClientRect()


Actual results:

document.getSelection().getRangeAt(0).getBoundingClientRect() doesn't take into consideration the scale transform.


Expected results:

document.getSelection().getRangeAt(0).getBoundingClientRect() should take into consideration the scale transform.
Could you attach a testcase showing the issue, please.
Flags: needinfo?(stefan.neculai)
Here is a JSFiddle for it http://jsfiddle.net/8TK3w/12/. Follow the following steps:

1) Select a part of the text.

2) Click on "Height from bounding rect" button. The result will be 16.

3) Clock the Scale button.

4) Click on "Height from bounding rect" button. The result will be 16. It should be 32.
Flags: needinfo?(stefan.neculai)
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.