RenderSVGTransformableContainer.cpp [plain text]
#include "config.h"
#if ENABLE(SVG)
#include "RenderSVGTransformableContainer.h"
#include "SVGShadowTreeElements.h"
#include "SVGStyledTransformableElement.h"
namespace WebCore {
RenderSVGTransformableContainer::RenderSVGTransformableContainer(SVGStyledTransformableElement* node)
: RenderSVGContainer(node)
, m_needsTransformUpdate(true)
{
}
void RenderSVGTransformableContainer::calculateLocalTransform()
{
SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(node());
bool needsUpdate = m_needsTransformUpdate;
if (needsUpdate) {
m_localTransform = element->animatedLocalTransform();
m_needsTransformUpdate = false;
}
if (!element->hasTagName(SVGNames::gTag) || !static_cast<SVGGElement*>(element)->isShadowTreeContainerElement())
return;
FloatSize translation = static_cast<SVGShadowTreeContainerElement*>(element)->containerTranslation();
if (translation.width() == 0 && translation.height() == 0)
return;
if (!needsUpdate)
m_localTransform = element->animatedLocalTransform();
m_localTransform.translate(translation.width(), translation.height());
}
}
#endif // ENABLE(SVG)