Changeset 128309 in webkit


Ignore:
Timestamp:
Sep 12, 2012 7:36:26 AM (12 years ago)
Author:
fmalita@chromium.org
Message:

getScreenCTM returns different values depending on zoom
https://bugs.webkit.org/show_bug.cgi?id=96361

Reviewed by Dirk Schulze.

Source/WebCore:

SVGSVGElement::localCoordinateSpaceTransform() needs to adjust for the
zoom level (which is already factored into CSS coordinates) at the
SVG/HTML boundary.

Test: svg/zoom/page/zoom-get-screen-ctm.html

  • svg/SVGSVGElement.cpp:

(WebCore::SVGSVGElement::localCoordinateSpaceTransform):

LayoutTests:

  • svg/zoom/page/zoom-get-screen-ctm-expected.txt: Added.
  • svg/zoom/page/zoom-get-screen-ctm.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r128306 r128309  
     12012-09-12  Florin Malita  <fmalita@chromium.org>
     2
     3        getScreenCTM returns different values depending on zoom
     4        https://bugs.webkit.org/show_bug.cgi?id=96361
     5
     6        Reviewed by Dirk Schulze.
     7
     8        * svg/zoom/page/zoom-get-screen-ctm-expected.txt: Added.
     9        * svg/zoom/page/zoom-get-screen-ctm.html: Added.
     10
    1112012-09-12  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r128307 r128309  
     12012-09-12  Florin Malita  <fmalita@chromium.org>
     2
     3        getScreenCTM returns different values depending on zoom
     4        https://bugs.webkit.org/show_bug.cgi?id=96361
     5
     6        Reviewed by Dirk Schulze.
     7
     8        SVGSVGElement::localCoordinateSpaceTransform() needs to adjust for the
     9        zoom level (which is already factored into CSS coordinates) at the
     10        SVG/HTML boundary.
     11
     12        Test: svg/zoom/page/zoom-get-screen-ctm.html
     13
     14        * svg/SVGSVGElement.cpp:
     15        (WebCore::SVGSVGElement::localCoordinateSpaceTransform):
     16
    1172012-09-12  Simon Hausmann  <simon.hausmann@nokia.com>
    218
  • trunk/Source/WebCore/svg/SVGSVGElement.cpp

    r127474 r128309  
    439439        if (RenderObject* renderer = this->renderer()) {
    440440            FloatPoint location;
    441            
     441            float zoomFactor = 1;
     442
    442443            // At the SVG/HTML boundary (aka RenderSVGRoot), we apply the localToBorderBoxTransform
    443444            // to map an element from SVG viewport coordinates to CSS box coordinates.
    444445            // RenderSVGRoot's localToAbsolute method expects CSS box coordinates.
    445             if (renderer->isSVGRoot())
     446            // We also need to adjust for the zoom level factored into CSS coordinates (bug #96361).
     447            if (renderer->isSVGRoot()) {
    446448                location = toRenderSVGRoot(renderer)->localToBorderBoxTransform().mapPoint(location);
    447            
     449                zoomFactor = 1 / renderer->style()->effectiveZoom();
     450            }
     451
    448452            // Translate in our CSS parent coordinate space
    449453            // FIXME: This doesn't work correctly with CSS transforms.
    450454            location = renderer->localToAbsolute(location, false, true);
     455            location.scale(zoomFactor, zoomFactor);
    451456
    452457            // Be careful here! localToBorderBoxTransform() included the x/y offset coming from the viewBoxToViewTransform(),
     
    457462            if (FrameView* view = document()->view()) {
    458463                LayoutSize scrollOffset = view->scrollOffset();
     464                scrollOffset.scale(zoomFactor);
    459465                transform.translate(-scrollOffset.width(), -scrollOffset.height());
    460466            }
Note: See TracChangeset for help on using the changeset viewer.