No subject


Tue May 3 15:05:30 PDT 2016


void SVGSVGElement::setCurrentScale(float scale)
{
    if (Frame* frame = frameForCurrentScale())
        frame->setPageZoomFactor(scale);
}

void SVGSVGElement::setCurrentTranslate(const FloatPoint& translation)
{
    if (m_currentTranslate == translation)
        return;
    m_currentTranslate = translation;
    updateCurrentTranslate();
}

SVGSVGElement::setCurrentScale() changes the Frame zoomFactor while SVGSVGElement::setCurrentTranslate(() sets a local variable which is returned by currentTranslate() and then is used by RenderSVGRoot::buildLocalToBorderBoxTransform(). This later function builds the transform from SVG coordinates to CSS coordinate. 

void RenderSVGRoot::buildLocalToBorderBoxTransform()
{
    float scale = style().effectiveZoom();
    SVGPoint translate = svgSVGElement().currentTranslate();
    LayoutSize borderAndPadding(borderLeft() + paddingLeft(), borderTop() + paddingTop());
    m_localToBorderBoxTransform = svgSVGElement().viewBoxToViewTransform(contentWidth() / scale, contentHeight() / scale);
    if (borderAndPadding.isEmpty() && scale == 1 && translate == SVGPoint::zero())
        return;
    m_localToBorderBoxTransform = AffineTransform(scale, 0, 0, scale, borderAndPadding.width() + translate.x(), borderAndPadding.height() + translate.y()) * m_localToBorderBoxTransform;
}

In this function, currentScale() is not called since the Frame itself has its zoomFactor changed  with it.

-- 
You are receiving this mail because:
You are the assignee for the bug.
--1463161185.aB5d6.14035
Date: Fri, 13 May 2016 10:39:45 -0700
MIME-Version: 1.0
Content-Type: text/html

<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - outermost SVG currentScale should only scale SVG Element"
   href="https://bugs.webkit.org/show_bug.cgi?id=157567#c9">Comment # 9</a>
              on <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - outermost SVG currentScale should only scale SVG Element"
   href="https://bugs.webkit.org/show_bug.cgi?id=157567">bug 157567</a>
              from <span class="vcard"><a class="email" href="mailto:sabouhallawa&#64;apple.com" title="Said Abou-Hallawa &lt;sabouhallawa&#64;apple.com&gt;"> <span class="fn">Said Abou-Hallawa</span></a>
</span></b>
        <pre>From looking at the code the difference between currentScale and currentTranslate is obvious. Setting these properties are done by the following code:

void SVGSVGElement::setCurrentScale(float scale)
{
    if (Frame* frame = frameForCurrentScale())
        frame-&gt;setPageZoomFactor(scale);
}

void SVGSVGElement::setCurrentTranslate(const FloatPoint&amp; translation)
{
    if (m_currentTranslate == translation)
        return;
    m_currentTranslate = translation;
    updateCurrentTranslate();
}

SVGSVGElement::setCurrentScale() changes the Frame zoomFactor while SVGSVGElement::setCurrentTranslate(() sets a local variable which is returned by currentTranslate() and then is used by RenderSVGRoot::buildLocalToBorderBoxTransform(). This later function builds the transform from SVG coordinates to CSS coordinate. 

void RenderSVGRoot::buildLocalToBorderBoxTransform()
{
    float scale = style().effectiveZoom();
    SVGPoint translate = svgSVGElement().currentTranslate();
    LayoutSize borderAndPadding(borderLeft() + paddingLeft(), borderTop() + paddingTop());
    m_localToBorderBoxTransform = svgSVGElement().viewBoxToViewTransform(contentWidth() / scale, contentHeight() / scale);
    if (borderAndPadding.isEmpty() &amp;&amp; scale == 1 &amp;&amp; translate == SVGPoint::zero())
        return;
    m_localToBorderBoxTransform = AffineTransform(scale, 0, 0, scale, borderAndPadding.width() + translate.x(), borderAndPadding.height() + translate.y()) * m_localToBorderBoxTransform;
}

In this function, currentScale() is not called since the Frame itself has its zoomFactor changed  with it.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>
--1463161185.aB5d6.14035--


More information about the webkit-unassigned mailing list