summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering/RenderSVGTransformableContainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/rendering/RenderSVGTransformableContainer.cpp')
-rw-r--r--WebCore/rendering/RenderSVGTransformableContainer.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/WebCore/rendering/RenderSVGTransformableContainer.cpp b/WebCore/rendering/RenderSVGTransformableContainer.cpp
index 4bec7a7..94b9eea 100644
--- a/WebCore/rendering/RenderSVGTransformableContainer.cpp
+++ b/WebCore/rendering/RenderSVGTransformableContainer.cpp
@@ -31,29 +31,31 @@ namespace WebCore {
RenderSVGTransformableContainer::RenderSVGTransformableContainer(SVGStyledTransformableElement* node)
: RenderSVGContainer(node)
+ , m_needsTransformUpdate(true)
{
}
-const AffineTransform& RenderSVGTransformableContainer::localToParentTransform() const
+void RenderSVGTransformableContainer::calculateLocalTransform()
{
- return m_localTransform;
-}
+ SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(node());
-AffineTransform RenderSVGTransformableContainer::localTransform() const
-{
- return m_localTransform;
-}
+ bool needsUpdate = m_needsTransformUpdate;
+ if (needsUpdate) {
+ m_localTransform = element->animatedLocalTransform();
+ m_needsTransformUpdate = false;
+ }
-void RenderSVGTransformableContainer::calculateLocalTransform()
-{
- m_localTransform = static_cast<SVGStyledTransformableElement*>(node())->animatedLocalTransform();
- if (!node()->hasTagName(SVGNames::gTag) || !static_cast<SVGGElement*>(node())->isShadowTreeContainerElement())
+ if (!element->hasTagName(SVGNames::gTag) || !static_cast<SVGGElement*>(element)->isShadowTreeContainerElement())
return;
- FloatSize translation = static_cast<SVGShadowTreeContainerElement*>(node())->containerTranslation();
+ FloatSize translation = static_cast<SVGShadowTreeContainerElement*>(element)->containerTranslation();
if (translation.width() == 0 && translation.height() == 0)
return;
+ // FIXME: Could optimize this case for use to avoid refetching the animatedLocalTransform() here, if only the containerTranslation() changed.
+ if (!needsUpdate)
+ m_localTransform = element->animatedLocalTransform();
+
m_localTransform.translate(translation.width(), translation.height());
}