Closed Bug 849203 Opened 11 years ago Closed 11 years ago

getScreenCTM() doesn't work correctly with parent container positioned with transform:translate

Categories

(Core :: SVG, defect)

16 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: tero.t.koskinen, Unassigned)

References

Details

(Keywords: regression, testcase)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.152 Safari/537.22

Steps to reproduce:

Seems that getScreenCTM() has problems if parent container is positioned in CSS with transform:translate property.

I made example in jsfiddle what should show the problem:
http://jsfiddle.net/RrCee/2/

Example works correctly in Chrome.

If transform:translate(100px, 100px) is replaced with traditional position:absolute; top: 100px; left: 100px; everything works correctly.
It regressed many times in the past.

1st regression:
good=2012-02-17
bad1=2012-02-18 (increasing gap between cursor position and SVG position)
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=2271cb92cc05&tochange=550779e6bab4
Regressed by:
Jonathan Watt — Bug 660216, part 3 - getBBox and getCTM on foreignObject should/should not include 'x'/'y' offsets respectively. r=heycam.

2nd regression:
bad1=2012-06-13 (gap increasing between cursor position and SVG position)
good=2012-06-14
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=964b11fea7f1&tochange=3f408698a03f
Fixed by:
Robert Longson — Bug 762411 - getScreenCTM scaling broken on inline outer svg elements. r=jwatt

3th regression:
good=2012-07-01
bad2=2012-07-02 (static gap between cursor position and SVG position)
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=d9d61d199b11&tochange=a31fc9052840
Suspected:
Jonathan Watt — Bug 769902 - Avoid unnecessary precision issues in nsSVGUtils::ObjectSpace. r=longsonr.
Blocks: 769902
Status: UNCONFIRMED → NEW
Component: Untriaged → SVG
Ever confirmed: true
Keywords: regression, testcase
Product: Firefox → Core
Version: 19 Branch → 16 Branch
Is it possible to add some tests to avoid these regressions in the future?
Not sure of the offending bug in the 3rd regression, it could be:

Ms2ger — Bug 745523 - Part b: Unprefix transforms; r=dbaron This patch introduces unprefixed 'transform', 'transform-origin', 'perspective', 'perspective-origin', 'transform-style' and 'backface-visibility' properties, and updates the mochitests in layout/style to use them.
In local build
Last Good: d8edf6858553
First Bad: 4004407a1f49
Triggered by:
4004407a1f49	Ms2ger — Bug 745523 - Part b: Unprefix transforms; r=dbaron This patch introduces unprefixed 'transform', 'transform-origin', 'perspective', 'perspective-origin', 'transform-style' and 'backface-visibility' properties, and updates the mochitests in layout/style to use them.
Blocks: 745523
No longer blocks: 769902
The testcase is invalid and it's Chrome that's giving the wrong results.

The outer <svg> co-ordinate space is different to the follow <rect> co-ordinate space because the <svg> element has a viewBox. viewBox transforms only apply to children so the <rect> is transformed but the testcase assumes it isn't.

This did not in fact "regress" instead it got fixed and there are tests to show it!
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
OS: Windows 7 → All
Hardware: x86_64 → All
(In reply to Robert Longson from comment #5)
> The testcase is invalid and it's Chrome that's giving the wrong results.
> 
> The outer <svg> co-ordinate space is different to the follow <rect>
> co-ordinate space because the <svg> element has a viewBox. viewBox
> transforms only apply to children so the <rect> is transformed but the
> testcase assumes it isn't.
> 
> This did not in fact "regress" instead it got fixed and there are tests to
> show it!

Why does un-prefixing affect the result?

Opera12.15(Presto) is also same behavior of Chrome.
Status: RESOLVED → REOPENED
Flags: needinfo?(longsonr)
Resolution: INVALID → ---
sorry spam
Status: REOPENED → RESOLVED
Closed: 11 years ago11 years ago
Flags: needinfo?(longsonr)
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.