Closed Bug 863618 Opened 9 years ago Closed 7 years ago

getBoundingClientRect on range with scaled (transformed) element returns wrong offsets

Categories

(Core :: Layout, defect)

20 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla34

People

(Reporter: disroden, Assigned: roc)

References

Details

Attachments

(3 files)

Attached file test.html
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:20.0) Gecko/20100101 Firefox/20.0
Build ID: 20130329030352

Steps to reproduce:

I created a div with:
transform: matrix(2, 0, 0, 2, 0, 0);
transform-origin: 0 100%;

And some text in it. Selected a part of text with Range and called getBoundingClientRect. (See file attached)


Actual results:

It returns wrong ClientRect. As if transform wouldn't be applied.


Expected results:

getBoundingClientRect should return the correct ClientRect that counts transform.
Attachment #739466 - Attachment mime type: text/plain → text/html
Component: Untriaged → Layout
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Ever confirmed: true
Looks like nsRange needs some RECTS_ACCOUNT_FOR_TRANSFORMS for it's GetAllInFlowRects calls, but it's not that simple as there is some custom code for when the range only includes part of a text frame. Those could probably be handled by using TransformFrameRectToAncestor.
Duplicate of this bug: 908697
Duplicate of this bug: 999454
Summary: getBoundingClientRect on range with scaled element returns wrong offsets → getBoundingClientRect on range with scaled (transformed) element returns wrong offsets
Attached file reduced-testcase.html
Added a test case. The issue also applies to all kinds of transforms.
Assignee: nobody → roc
Status: NEW → ASSIGNED
Attachment #8455925 - Flags: review?(tnikkel) → review+
https://hg.mozilla.org/mozilla-central/rev/53d464f0f4cd
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
You need to log in before you can comment on or make changes to this bug.