Changeset 21636 in webkit


Ignore:
Timestamp:
May 21, 2007 8:10:06 PM (17 years ago)
Author:
oliver
Message:

2007-05-21 Oliver Hunt <oliver@apple.com>

LayoutTests:

Reviewed by Sam.


Layout test for http://bugs.webkit.org/show_bug.cgi?id=13789

  • svg/custom/getscreenctm-in-mixed-content-expected.checksum: Added.
  • svg/custom/getscreenctm-in-mixed-content-expected.png: Added.
  • svg/custom/getscreenctm-in-mixed-content-expected.txt: Added.
  • svg/custom/getscreenctm-in-mixed-content.xhtml: Added.

WebCore:

Reviewed by Sam.


Fix for http://bugs.webkit.org/show_bug.cgi?id=13789
-- SVGLocatable::getScreenCTM() faulty


Needed to update SVGLength to handle the case where the SVGElement is
not the root document element -- we do this by falling back on the
renderer for the context.


For <svg> elements embedded as mixed content in xhtml we consider the
absolutePosition of the parent to be the origin for the <svg> element.

  • ksvg2/svg/SVGLength.cpp: (WebCore::SVGLength::PercentageOfViewport):
  • ksvg2/svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::getScreenCTM):
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r21633 r21636  
     12007-05-21  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Sam.
     4       
     5        Layout test for http://bugs.webkit.org/show_bug.cgi?id=13789
     6
     7        * svg/custom/getscreenctm-in-mixed-content-expected.checksum: Added.
     8        * svg/custom/getscreenctm-in-mixed-content-expected.png: Added.
     9        * svg/custom/getscreenctm-in-mixed-content-expected.txt: Added.
     10        * svg/custom/getscreenctm-in-mixed-content.xhtml: Added.
     11
    1122007-05-21  Sam Weinig  <sam@webkit.org>
    213
  • trunk/WebCore/ChangeLog

    r21635 r21636  
     12007-05-21  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Sam.
     4       
     5        Fix for http://bugs.webkit.org/show_bug.cgi?id=13789
     6        -- SVGLocatable::getScreenCTM() faulty
     7       
     8        Needed to update SVGLength to handle the case where the SVGElement is
     9        not the root document element -- we do this by falling back on the
     10        renderer for the context.
     11       
     12        For <svg> elements embedded as mixed content in xhtml we consider the
     13        absolutePosition of the parent to be the origin for the <svg> element.
     14
     15        * ksvg2/svg/SVGLength.cpp:
     16        (WebCore::SVGLength::PercentageOfViewport):
     17        * ksvg2/svg/SVGSVGElement.cpp:
     18        (WebCore::SVGSVGElement::getScreenCTM):
     19
    1202007-05-21  Timothy Hatcher  <timothy@apple.com>
    221
  • trunk/WebCore/ksvg2/svg/SVGLength.cpp

    r19855 r21636  
    22    Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
    33                  2004, 2005, 2006 Rob Buis <buis@kde.org>
     4                  2007 Apple Inc.  All rights reserved.
    45
    56    This file is part of the KDE project
     
    294295            height = svg->height().value();
    295296        }
     297    } else if (context->parent() && !context->parent()->isSVGElement()) {
     298        if (RenderObject* renderer = context->renderer()) {
     299            width = renderer->width();
     300            height = renderer->height();
     301        }
    296302    }
    297303
  • trunk/WebCore/ksvg2/svg/SVGSVGElement.cpp

    r21272 r21636  
    22    Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
    33                  2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
     4                  2007 Apple Inc.  All rights reserved.
    45
    56    This file is part of the KDE project
     
    336337AffineTransform SVGSVGElement::getScreenCTM() const
    337338{
     339    // FIXME: This assumes that any <svg> element not immediately descending from another SVGElement
     340    // has *no* svg ancestors
     341    document()->updateLayoutIgnorePendingStylesheets();
     342    float rootX = x().value();
     343    float rootY = y().value();
     344   
     345    if (RenderObject* renderer = this->renderer()) {
     346        renderer = renderer->parent();
     347        if (renderer && !(renderer->element() && renderer->element()->isSVGElement())) {
     348            int tx = 0;
     349            int ty = 0;
     350            renderer->absolutePosition(tx, ty, true);
     351            rootX += tx;
     352            rootY += ty;
     353        }
     354    }
     355   
    338356    AffineTransform mat = SVGStyledLocatableElement::getScreenCTM();
    339     mat.translate(x().value(), y().value());
     357    mat.translate(rootX, rootY);
    340358
    341359    if (attributes()->getNamedItem(SVGNames::viewBoxAttr)) {
Note: See TracChangeset for help on using the changeset viewer.