Bug 96361

Summary: getScreenCTM returns different values depending on zoom
Product: WebKit Reporter: Hannes <bug>
Component: SVGAssignee: Florin Malita <fmalita>
Status: RESOLVED FIXED    
Severity: Major CC: abarth, bdakin, darin, fmalita, krit, pdr, simon.fraser, webkit.review.bot, zimmermann
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
URL: http://jsfiddle.net/sqfzD/
Attachments:
Description Flags
Patch
none
Patch for landing
none
Patch for landing none

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.