diff options
Diffstat (limited to 'WebCore/svg')
-rw-r--r-- | WebCore/svg/SVGElement.cpp | 11 | ||||
-rw-r--r-- | WebCore/svg/SVGFEImageElement.cpp | 5 | ||||
-rw-r--r-- | WebCore/svg/SVGLength.cpp | 3 | ||||
-rw-r--r-- | WebCore/svg/SVGLocatable.cpp | 16 | ||||
-rw-r--r-- | WebCore/svg/SVGLocatable.h | 14 | ||||
-rw-r--r-- | WebCore/svg/SVGPathBuilder.cpp | 2 | ||||
-rw-r--r-- | WebCore/svg/SVGSVGElement.cpp | 3 | ||||
-rw-r--r-- | WebCore/svg/SVGStyledElement.cpp | 2 | ||||
-rw-r--r-- | WebCore/svg/SVGStyledLocatableElement.cpp | 12 | ||||
-rw-r--r-- | WebCore/svg/SVGStyledLocatableElement.h | 6 | ||||
-rw-r--r-- | WebCore/svg/SVGStyledTransformableElement.cpp | 12 | ||||
-rw-r--r-- | WebCore/svg/SVGStyledTransformableElement.h | 6 | ||||
-rw-r--r-- | WebCore/svg/SVGTextElement.cpp | 12 | ||||
-rw-r--r-- | WebCore/svg/SVGTextElement.h | 6 |
14 files changed, 60 insertions, 50 deletions
diff --git a/WebCore/svg/SVGElement.cpp b/WebCore/svg/SVGElement.cpp index 055efcc..37e4930 100644 --- a/WebCore/svg/SVGElement.cpp +++ b/WebCore/svg/SVGElement.cpp @@ -312,7 +312,10 @@ void SVGElement::attributeChanged(Attribute* attr, bool preserveDecls) if (isSynchronizingSVGAttributes()) return; - svgAttributeChanged(attr->name()); + // Changes to the style attribute are processed lazily (see Element::getAttribute() and related methods), + // so we don't want changes to the style attribute to result in extra work here. + if (attr->name() != HTMLNames::styleAttr) + svgAttributeChanged(attr->name()); } void SVGElement::updateAnimatedSVGAttribute(const QualifiedName& name) const @@ -331,10 +334,8 @@ void SVGElement::updateAnimatedSVGAttribute(const QualifiedName& name) const ContainerNode* SVGElement::eventParentNode() { - if (Node* shadowParent = shadowParentNode()) { - ASSERT(shadowParent->isContainerNode()); - return static_cast<ContainerNode*>(shadowParent); - } + if (ContainerNode* shadowParent = shadowParentNode()) + return shadowParent; return StyledElement::eventParentNode(); } diff --git a/WebCore/svg/SVGFEImageElement.cpp b/WebCore/svg/SVGFEImageElement.cpp index 92534e8..eb024f6 100644 --- a/WebCore/svg/SVGFEImageElement.cpp +++ b/WebCore/svg/SVGFEImageElement.cpp @@ -30,10 +30,10 @@ #include "Document.h" #include "RenderObject.h" #include "RenderSVGResource.h" +#include "SVGImageBufferTools.h" #include "SVGLength.h" #include "SVGNames.h" #include "SVGPreserveAspectRatio.h" -#include "SVGRenderSupport.h" namespace WebCore { @@ -134,7 +134,8 @@ PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*) IntRect targetRect = enclosingIntRect(renderer->objectBoundingBox()); m_targetImage = ImageBuffer::create(targetRect.size(), LinearRGB); - SVGRenderSupport::renderSubtreeToImage(m_targetImage.get(), renderer); + AffineTransform contentTransformation; + SVGImageBufferTools::renderSubtreeToImageBuffer(m_targetImage.get(), renderer, contentTransformation); } return FEImage::create(m_targetImage ? m_targetImage->copyImage() : m_cachedImage->image(), preserveAspectRatio()); diff --git a/WebCore/svg/SVGLength.cpp b/WebCore/svg/SVGLength.cpp index 415dc79..bdd5b27 100644 --- a/WebCore/svg/SVGLength.cpp +++ b/WebCore/svg/SVGLength.cpp @@ -27,6 +27,7 @@ #include "CSSHelper.h" #include "FloatConversion.h" #include "FrameView.h" +#include "NotImplemented.h" #include "RenderObject.h" #include "RenderView.h" #include "SVGParserUtilities.h" @@ -203,7 +204,7 @@ void SVGLength::setValue(float value) case LengthTypePercentage: case LengthTypeEMS: case LengthTypeEXS: - ASSERT_NOT_REACHED(); + notImplemented(); break; case LengthTypePX: m_valueInSpecifiedUnits = value; diff --git a/WebCore/svg/SVGLocatable.cpp b/WebCore/svg/SVGLocatable.cpp index 8147a88..b7b4440 100644 --- a/WebCore/svg/SVGLocatable.cpp +++ b/WebCore/svg/SVGLocatable.cpp @@ -71,10 +71,11 @@ SVGElement* SVGLocatable::farthestViewportElement(const SVGElement* element) return farthest; } -FloatRect SVGLocatable::getBBox(const SVGElement* element) +FloatRect SVGLocatable::getBBox(const SVGElement* element, StyleUpdateStrategy styleUpdateStrategy) { ASSERT(element); - element->document()->updateLayoutIgnorePendingStylesheets(); + if (styleUpdateStrategy == AllowStyleUpdate) + element->document()->updateLayoutIgnorePendingStylesheets(); // FIXME: Eventually we should support getBBox for detached elements. if (!element->renderer()) @@ -83,10 +84,11 @@ FloatRect SVGLocatable::getBBox(const SVGElement* element) return element->renderer()->objectBoundingBox(); } -AffineTransform SVGLocatable::computeCTM(const SVGElement* element, CTMScope mode) +AffineTransform SVGLocatable::computeCTM(const SVGElement* element, CTMScope mode, StyleUpdateStrategy styleUpdateStrategy) { ASSERT(element); - element->document()->updateLayoutIgnorePendingStylesheets(); + if (styleUpdateStrategy == AllowStyleUpdate) + element->document()->updateLayoutIgnorePendingStylesheets(); AffineTransform ctm; @@ -108,12 +110,12 @@ AffineTransform SVGLocatable::computeCTM(const SVGElement* element, CTMScope mod return ctm; } -AffineTransform SVGLocatable::getTransformToElement(SVGElement* target, ExceptionCode& ec) const +AffineTransform SVGLocatable::getTransformToElement(SVGElement* target, ExceptionCode& ec, StyleUpdateStrategy styleUpdateStrategy) const { - AffineTransform ctm = getCTM(); + AffineTransform ctm = getCTM(styleUpdateStrategy); if (target && target->isStyledLocatable()) { - AffineTransform targetCTM = static_cast<SVGStyledLocatableElement*>(target)->getCTM(); + AffineTransform targetCTM = static_cast<SVGStyledLocatableElement*>(target)->getCTM(styleUpdateStrategy); if (!targetCTM.isInvertible()) { ec = SVGException::SVG_MATRIX_NOT_INVERTABLE; return ctm; diff --git a/WebCore/svg/SVGLocatable.h b/WebCore/svg/SVGLocatable.h index 28df512..2e51dc5 100644 --- a/WebCore/svg/SVGLocatable.h +++ b/WebCore/svg/SVGLocatable.h @@ -40,10 +40,12 @@ public: virtual SVGElement* nearestViewportElement() const = 0; virtual SVGElement* farthestViewportElement() const = 0; - virtual FloatRect getBBox() const = 0; - virtual AffineTransform getCTM() const = 0; - virtual AffineTransform getScreenCTM() const = 0; - AffineTransform getTransformToElement(SVGElement*, ExceptionCode&) const; + enum StyleUpdateStrategy { AllowStyleUpdate, DisallowStyleUpdate }; + + virtual FloatRect getBBox(StyleUpdateStrategy) const = 0; + virtual AffineTransform getCTM(StyleUpdateStrategy) const = 0; + virtual AffineTransform getScreenCTM(StyleUpdateStrategy) const = 0; + AffineTransform getTransformToElement(SVGElement*, ExceptionCode&, StyleUpdateStrategy = AllowStyleUpdate) const; static SVGElement* nearestViewportElement(const SVGElement*); static SVGElement* farthestViewportElement(const SVGElement*); @@ -56,8 +58,8 @@ public: protected: virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const { return AffineTransform(); } - static FloatRect getBBox(const SVGElement*); - static AffineTransform computeCTM(const SVGElement*, CTMScope); + static FloatRect getBBox(const SVGElement*, StyleUpdateStrategy); + static AffineTransform computeCTM(const SVGElement*, CTMScope, StyleUpdateStrategy); }; } // namespace WebCore diff --git a/WebCore/svg/SVGPathBuilder.cpp b/WebCore/svg/SVGPathBuilder.cpp index 85fbd65..6687edf 100644 --- a/WebCore/svg/SVGPathBuilder.cpp +++ b/WebCore/svg/SVGPathBuilder.cpp @@ -37,7 +37,7 @@ void SVGPathBuilder::moveTo(const FloatPoint& targetPoint, bool closed, PathCoor { ASSERT(m_path); m_current = mode == AbsoluteCoordinates ? targetPoint : m_current + targetPoint; - if (closed) + if (closed && !m_path->isEmpty()) m_path->closeSubpath(); m_path->moveTo(m_current); } diff --git a/WebCore/svg/SVGSVGElement.cpp b/WebCore/svg/SVGSVGElement.cpp index 5193e2a..b7f9717 100644 --- a/WebCore/svg/SVGSVGElement.cpp +++ b/WebCore/svg/SVGSVGElement.cpp @@ -217,6 +217,9 @@ FloatPoint SVGSVGElement::currentTranslate() const void SVGSVGElement::setCurrentTranslate(const FloatPoint &translation) { m_translation = translation; + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); + if (parentNode() == document() && document()->renderer()) document()->renderer()->repaint(); } diff --git a/WebCore/svg/SVGStyledElement.cpp b/WebCore/svg/SVGStyledElement.cpp index 4b073a0..6f04382 100644 --- a/WebCore/svg/SVGStyledElement.cpp +++ b/WebCore/svg/SVGStyledElement.cpp @@ -80,7 +80,7 @@ String SVGStyledElement::title() const } // Get the <use> element. - Node* shadowParent = parent->shadowParentNode(); + ContainerNode* shadowParent = parent->shadowParentNode(); if (shadowParent && shadowParent->isSVGElement() && shadowParent->hasTagName(SVGNames::useTag)) { SVGUseElement* useElement = static_cast<SVGUseElement*>(shadowParent); // If the <use> title is not empty we found the title to use. diff --git a/WebCore/svg/SVGStyledLocatableElement.cpp b/WebCore/svg/SVGStyledLocatableElement.cpp index 3d87da4..6b49542 100644 --- a/WebCore/svg/SVGStyledLocatableElement.cpp +++ b/WebCore/svg/SVGStyledLocatableElement.cpp @@ -50,19 +50,19 @@ SVGElement* SVGStyledLocatableElement::farthestViewportElement() const return SVGLocatable::farthestViewportElement(this); } -FloatRect SVGStyledLocatableElement::getBBox() const +FloatRect SVGStyledLocatableElement::getBBox(StyleUpdateStrategy styleUpdateStrategy) const { - return SVGLocatable::getBBox(this); + return SVGLocatable::getBBox(this, styleUpdateStrategy); } -AffineTransform SVGStyledLocatableElement::getCTM() const +AffineTransform SVGStyledLocatableElement::getCTM(StyleUpdateStrategy styleUpdateStrategy) const { - return SVGLocatable::computeCTM(this, SVGLocatable::NearestViewportScope); + return SVGLocatable::computeCTM(this, SVGLocatable::NearestViewportScope, styleUpdateStrategy); } -AffineTransform SVGStyledLocatableElement::getScreenCTM() const +AffineTransform SVGStyledLocatableElement::getScreenCTM(StyleUpdateStrategy styleUpdateStrategy) const { - return SVGLocatable::computeCTM(this, SVGLocatable::ScreenScope); + return SVGLocatable::computeCTM(this, SVGLocatable::ScreenScope, styleUpdateStrategy); } } diff --git a/WebCore/svg/SVGStyledLocatableElement.h b/WebCore/svg/SVGStyledLocatableElement.h index ef1c454..6eab7b0 100644 --- a/WebCore/svg/SVGStyledLocatableElement.h +++ b/WebCore/svg/SVGStyledLocatableElement.h @@ -40,9 +40,9 @@ namespace WebCore { virtual SVGElement* nearestViewportElement() const; virtual SVGElement* farthestViewportElement() const; - virtual FloatRect getBBox() const; - virtual AffineTransform getCTM() const; - virtual AffineTransform getScreenCTM() const; + virtual FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate) const; + virtual AffineTransform getCTM(StyleUpdateStrategy = AllowStyleUpdate) const; + virtual AffineTransform getScreenCTM(StyleUpdateStrategy = AllowStyleUpdate) const; virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const { return SVGLocatable::localCoordinateSpaceTransform(mode); } }; diff --git a/WebCore/svg/SVGStyledTransformableElement.cpp b/WebCore/svg/SVGStyledTransformableElement.cpp index 84af351..279f437 100644 --- a/WebCore/svg/SVGStyledTransformableElement.cpp +++ b/WebCore/svg/SVGStyledTransformableElement.cpp @@ -43,14 +43,14 @@ SVGStyledTransformableElement::~SVGStyledTransformableElement() { } -AffineTransform SVGStyledTransformableElement::getCTM() const +AffineTransform SVGStyledTransformableElement::getCTM(StyleUpdateStrategy styleUpdateStrategy) const { - return SVGLocatable::computeCTM(this, SVGLocatable::NearestViewportScope); + return SVGLocatable::computeCTM(this, SVGLocatable::NearestViewportScope, styleUpdateStrategy); } -AffineTransform SVGStyledTransformableElement::getScreenCTM() const +AffineTransform SVGStyledTransformableElement::getScreenCTM(StyleUpdateStrategy styleUpdateStrategy) const { - return SVGLocatable::computeCTM(this, SVGLocatable::ScreenScope); + return SVGLocatable::computeCTM(this, SVGLocatable::ScreenScope, styleUpdateStrategy); } AffineTransform SVGStyledTransformableElement::animatedLocalTransform() const @@ -101,9 +101,9 @@ SVGElement* SVGStyledTransformableElement::farthestViewportElement() const return SVGTransformable::farthestViewportElement(this); } -FloatRect SVGStyledTransformableElement::getBBox() const +FloatRect SVGStyledTransformableElement::getBBox(StyleUpdateStrategy styleUpdateStrategy) const { - return SVGTransformable::getBBox(this); + return SVGTransformable::getBBox(this, styleUpdateStrategy); } RenderObject* SVGStyledTransformableElement::createRenderer(RenderArena* arena, RenderStyle*) diff --git a/WebCore/svg/SVGStyledTransformableElement.h b/WebCore/svg/SVGStyledTransformableElement.h index f020c89..1d7b197 100644 --- a/WebCore/svg/SVGStyledTransformableElement.h +++ b/WebCore/svg/SVGStyledTransformableElement.h @@ -38,8 +38,8 @@ public: virtual bool isStyledTransformable() const { return true; } - virtual AffineTransform getCTM() const; - virtual AffineTransform getScreenCTM() const; + virtual AffineTransform getCTM(StyleUpdateStrategy = AllowStyleUpdate) const; + virtual AffineTransform getScreenCTM(StyleUpdateStrategy = AllowStyleUpdate) const; virtual SVGElement* nearestViewportElement() const; virtual SVGElement* farthestViewportElement() const; @@ -47,7 +47,7 @@ public: virtual AffineTransform animatedLocalTransform() const; virtual AffineTransform* supplementalTransform(); - virtual FloatRect getBBox() const; + virtual FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate) const; virtual void parseMappedAttribute(Attribute*); virtual void synchronizeProperty(const QualifiedName&); diff --git a/WebCore/svg/SVGTextElement.cpp b/WebCore/svg/SVGTextElement.cpp index 57774cd..e13e611 100644 --- a/WebCore/svg/SVGTextElement.cpp +++ b/WebCore/svg/SVGTextElement.cpp @@ -68,19 +68,19 @@ SVGElement* SVGTextElement::farthestViewportElement() const return SVGTransformable::farthestViewportElement(this); } -FloatRect SVGTextElement::getBBox() const +FloatRect SVGTextElement::getBBox(StyleUpdateStrategy styleUpdateStrategy) const { - return SVGTransformable::getBBox(this); + return SVGTransformable::getBBox(this, styleUpdateStrategy); } -AffineTransform SVGTextElement::getCTM() const +AffineTransform SVGTextElement::getCTM(StyleUpdateStrategy styleUpdateStrategy) const { - return SVGLocatable::computeCTM(this, SVGLocatable::NearestViewportScope); + return SVGLocatable::computeCTM(this, SVGLocatable::NearestViewportScope, styleUpdateStrategy); } -AffineTransform SVGTextElement::getScreenCTM() const +AffineTransform SVGTextElement::getScreenCTM(StyleUpdateStrategy styleUpdateStrategy) const { - return SVGLocatable::computeCTM(this, SVGLocatable::ScreenScope); + return SVGLocatable::computeCTM(this, SVGLocatable::ScreenScope, styleUpdateStrategy); } AffineTransform SVGTextElement::animatedLocalTransform() const diff --git a/WebCore/svg/SVGTextElement.h b/WebCore/svg/SVGTextElement.h index b954835..1788ea9 100644 --- a/WebCore/svg/SVGTextElement.h +++ b/WebCore/svg/SVGTextElement.h @@ -38,9 +38,9 @@ namespace WebCore { virtual SVGElement* nearestViewportElement() const; virtual SVGElement* farthestViewportElement() const; - virtual FloatRect getBBox() const; - virtual AffineTransform getCTM() const; - virtual AffineTransform getScreenCTM() const; + virtual FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate) const; + virtual AffineTransform getCTM(StyleUpdateStrategy = AllowStyleUpdate) const; + virtual AffineTransform getScreenCTM(StyleUpdateStrategy = AllowStyleUpdate) const; virtual AffineTransform animatedLocalTransform() const; virtual AffineTransform* supplementalTransform(); virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const { return SVGTransformable::localCoordinateSpaceTransform(mode); } |