[Webkit-unassigned] [Bug 86010] . getTransformToElement doesn’t work correctly across embedded svg elements

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 10 00:07:46 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=86010





--- Comment #2 from Nikolas Zimmermann <zimmermann at kde.org>  2012-05-10 00:06:50 PST ---
(In reply to comment #1)
> CC'ing some Google/SVG folks who might be interested - this bug should be easy to fix.

I couldn't resist:

AffineTransform SVGLocatable::getTransformToElement(SVGElement* target, ExceptionCode& ec, StyleUpdateStrategy styleUpdateStrategy)
{
    AffineTransform ctm = getCTM(styleUpdateStrategy);

    if (target && target->isStyledLocatable()) {
        AffineTransform targetCTM = static_cast<SVGStyledLocatableElement*>(target)->getCTM(styleUpdateStrategy);
        if (!targetCTM.isInvertible()) {
            ec = SVGException::SVG_MATRIX_NOT_INVERTABLE;
            return ctm;
        }
        ctm = targetCTM.inverse() * ctm;
    }

    return ctm;
}

We're calling getCTM() from getTransformTlElement, which uses SVGLocatable::computeCTM, with NearestViewportScope (aka. stop at the nearest viewport) - this is obviously wrong.

AffineTransform SVGStyledLocatableElement::getCTM(StyleUpdateStrategy styleUpdateStrategy)
{
    return SVGLocatable::computeCTM(this, SVGLocatable::NearestViewportScope, styleUpdateStrategy);
}

The fix is to use getScreenCTM in getTransformToElement, when computing the targetCTM - so it won't stop at the nearest viewport element. Obviously this needs more testing, in different scenarios of multiple nested inner <svgs>, including <use> on <svg>, etc. Anyone feels tempted? :-)

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list