diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-24 16:36:50 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-24 16:36:50 +0100 |
commit | ad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (patch) | |
tree | b34b0daceb7c8e7fdde4b4ec43650ab7caadb0a9 /Source/WebCore/svg/SVGSVGElement.cpp | |
parent | 03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (diff) | |
download | qtwebkit-ad0d549d4cc13433f77c1ac8f0ab379c83d93f28.tar.gz |
Imported WebKit commit bb52bf3c0119e8a128cd93afe5572413a8617de9 (http://svn.webkit.org/repository/webkit/trunk@108790)
Diffstat (limited to 'Source/WebCore/svg/SVGSVGElement.cpp')
-rw-r--r-- | Source/WebCore/svg/SVGSVGElement.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/Source/WebCore/svg/SVGSVGElement.cpp b/Source/WebCore/svg/SVGSVGElement.cpp index 8d6f1b03a..d381603ae 100644 --- a/Source/WebCore/svg/SVGSVGElement.cpp +++ b/Source/WebCore/svg/SVGSVGElement.cpp @@ -37,6 +37,7 @@ #include "FrameTree.h" #include "FrameView.h" #include "HTMLNames.h" +#include "RenderObject.h" #include "RenderPart.h" #include "RenderSVGResource.h" #include "RenderSVGModelObject.h" @@ -286,25 +287,29 @@ void SVGSVGElement::parseAttribute(Attribute* attr) void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName) { - bool updateRelativeLengths = false; + bool updateRelativeLengthsOrViewBox = false; if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr || attrName == SVGNames::xAttr - || attrName == SVGNames::yAttr - || SVGFitToViewBox::isKnownAttribute(attrName)) { - updateRelativeLengths = true; + || attrName == SVGNames::yAttr) { + updateRelativeLengthsOrViewBox = true; updateRelativeLengthsInformation(); } + if (SVGFitToViewBox::isKnownAttribute(attrName)) { + updateRelativeLengthsOrViewBox = true; + if (RenderObject* object = renderer()) + object->setNeedsTransformUpdate(); + } + SVGElementInstance::InvalidationGuard invalidationGuard(this); if (SVGTests::handleAttributeChange(this, attrName)) return; - if (updateRelativeLengths + if (updateRelativeLengthsOrViewBox || SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) - || SVGZoomAndPan::isKnownAttribute(attrName) - || attrName == SVGNames::viewBoxAttr) { + || SVGZoomAndPan::isKnownAttribute(attrName)) { if (renderer()) RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer()); return; @@ -550,12 +555,12 @@ FloatSize SVGSVGElement::currentViewportSize() const return FloatSize(); if (renderer()->isSVGRoot()) { - LayoutRect frameRect = toRenderSVGRoot(renderer())->frameRect(); - return FloatSize(frameRect.width() / renderer()->style()->effectiveZoom(), frameRect.height() / renderer()->style()->effectiveZoom()); + LayoutRect contentBoxRect = toRenderSVGRoot(renderer())->contentBoxRect(); + return FloatSize(contentBoxRect.width() / renderer()->style()->effectiveZoom(), contentBoxRect.height() / renderer()->style()->effectiveZoom()); } - FloatRect frameRect = toRenderSVGViewportContainer(renderer())->viewport(); - return FloatSize(frameRect.width() / renderer()->style()->effectiveZoom(), frameRect.height() / renderer()->style()->effectiveZoom()); + FloatRect viewportRect = toRenderSVGViewportContainer(renderer())->viewport(); + return FloatSize(viewportRect.width() / renderer()->style()->effectiveZoom(), viewportRect.height() / renderer()->style()->effectiveZoom()); } bool SVGSVGElement::widthAttributeEstablishesViewport() const @@ -726,7 +731,7 @@ Element* SVGSVGElement::getElementById(const AtomicString& id) const continue; Element* element = static_cast<Element*>(node); - if (element->hasID() && element->getIdAttribute() == id) + if (element->getIdAttribute() == id) return element; } return 0; |