Bug 96361 - getScreenCTM returns different values depending on zoom
Summary: getScreenCTM returns different values depending on zoom
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Major
Assignee: Florin Malita
URL: http://jsfiddle.net/sqfzD/
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-11 00:32 PDT by Hannes
Modified: 2012-09-14 18:23 PDT (History)
9 users (show)

See Also:


Attachments
Patch (6.44 KB, patch)
2012-09-11 09:32 PDT, Florin Malita
no flags Details | Formatted Diff | Diff
Patch for landing (6.39 KB, patch)
2012-09-12 06:59 PDT, Florin Malita
no flags Details | Formatted Diff | Diff
Patch for landing (6.39 KB, patch)
2012-09-12 07:07 PDT, Florin Malita
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hannes 2012-09-11 00:32:36 PDT
Zooming in the browser, ctr and (+/- button) affects how getScreenCTM returns diffrent values on svg.

I made a jsfiddle to show you how. 

1. Go to http://jsfiddle.net/sqfzD/
2. Move the mouse. Se that everything works well.
3. Zoom in the browser.
4. Move the mouse. 
5. Se that the box is not at the same place when you did not zoom.

What is the expected result?
Box should be at the mouse position.

What happens instead?
The box is offset from the mouse position depending on the zoom.

Please provide any additional information below. Attach a screenshot if
possible.
http://jsfiddle.net/sqfzD/
Comment 1 Hannes 2012-09-11 00:33:49 PDT
Firefox works fine. Safari, Chrome have problems.
Comment 2 Florin Malita 2012-09-11 08:10:59 PDT
Looks like SVGSVGElement::localCoordinateSpaceTransform() does not adjust for the zoom level factored into localToAbsolute().

Patch to follow.
Comment 3 Florin Malita 2012-09-11 09:32:30 PDT
Created attachment 163384 [details]
Patch
Comment 4 Dirk Schulze 2012-09-11 20:21:49 PDT
Comment on attachment 163384 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=163384&action=review

> Source/WebCore/svg/SVGSVGElement.cpp:441
> +            float zoomFactor = 1.0f;

just 1?
Comment 5 Hannes 2012-09-12 03:32:50 PDT
You guys are fast. Thanks. When will it work for everybody in the whole world?
Comment 6 Florin Malita 2012-09-12 06:59:08 PDT
Created attachment 163618 [details]
Patch for landing
Comment 7 Florin Malita 2012-09-12 07:07:16 PDT
Created attachment 163619 [details]
Patch for landing
Comment 8 Florin Malita 2012-09-12 07:33:22 PDT
(In reply to comment #4)
> > Source/WebCore/svg/SVGSVGElement.cpp:441
> > +            float zoomFactor = 1.0f;
> 
> just 1?

Done, thanks for reviewing.


(In reply to comment #5)
> You guys are fast. Thanks. When will it work for everybody in the whole world?

This will probably be in Chrome 23 (dev channel after a few days, stable channel 1-2 months). Don't know about Safari.
Comment 9 WebKit Review Bot 2012-09-12 07:36:03 PDT
Comment on attachment 163619 [details]
Patch for landing

Clearing flags on attachment: 163619

Committed r128309: <http://trac.webkit.org/changeset/128309>
Comment 10 WebKit Review Bot 2012-09-12 07:36:07 PDT
All reviewed patches have been landed.  Closing bug.
Comment 11 Philip Rogers 2012-09-14 18:23:27 PDT
I think this change caused a 2% regression in our hit testing benchmark:
http://webkit-perf.appspot.com/graph.html#tests=[[5167282,2001,173262]]&sel=none&displayrange=30&datatype=running

I looked at the profile and I don't think there is much we can do to avoid this, so I'll just note it here for posterity.