Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1279)

Unified Diff: Source/core/svg/SVGTextElement.cpp

Issue 18503004: Have SVGTextContentElement inherit SVGGraphicsElement (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Really remove SVGLocatable IDL interface Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/svg/SVGTextElement.h ('k') | Source/core/svg/SVGTextElement.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGTextElement.cpp
diff --git a/Source/core/svg/SVGTextElement.cpp b/Source/core/svg/SVGTextElement.cpp
index 07ef41b0f375b700b2bf50d77ec55c6464f1c893..ff7288337f2f40af142a662d8951829789902a96 100644
--- a/Source/core/svg/SVGTextElement.cpp
+++ b/Source/core/svg/SVGTextElement.cpp
@@ -24,28 +24,17 @@
#include "SVGNames.h"
#include "core/dom/NodeRenderingContext.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
#include "core/rendering/svg/RenderSVGResource.h"
#include "core/rendering/svg/RenderSVGText.h"
#include "core/svg/SVGElementInstance.h"
namespace WebCore {
-// Animated property definitions
-DEFINE_ANIMATED_TRANSFORM_LIST(SVGTextElement, SVGNames::transformAttr, Transform, transform)
-
-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextElement)
- REGISTER_LOCAL_ANIMATED_PROPERTY(transform)
- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextPositioningElement)
-END_REGISTER_ANIMATED_PROPERTIES
-
inline SVGTextElement::SVGTextElement(const QualifiedName& tagName, Document* doc)
: SVGTextPositioningElement(tagName, doc)
{
ASSERT(hasTagName(SVGNames::textTag));
ScriptWrappable::init(this);
- registerAnimatedPropertiesForSVGTextElement();
}
PassRefPtr<SVGTextElement> SVGTextElement::create(const QualifiedName& tagName, Document* document)
@@ -53,57 +42,8 @@ PassRefPtr<SVGTextElement> SVGTextElement::create(const QualifiedName& tagName,
return adoptRef(new SVGTextElement(tagName, document));
}
-bool SVGTextElement::isSupportedAttribute(const QualifiedName& attrName)
-{
- DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
- if (supportedAttributes.isEmpty())
- supportedAttributes.add(SVGNames::transformAttr);
- return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
-}
-
-void SVGTextElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
-{
- if (!isSupportedAttribute(name)) {
- SVGTextPositioningElement::parseAttribute(name, value);
- return;
- }
-
- if (name == SVGNames::transformAttr) {
- SVGTransformList newList;
- newList.parse(value);
- detachAnimatedTransformListWrappers(newList.size());
- setTransformBaseValue(newList);
- return;
- }
-
- ASSERT_NOT_REACHED();
-}
-
-SVGElement* SVGTextElement::nearestViewportElement() const
-{
- return SVGTransformable::nearestViewportElement(this);
-}
-
-SVGElement* SVGTextElement::farthestViewportElement() const
-{
- return SVGTransformable::farthestViewportElement(this);
-}
-
-FloatRect SVGTextElement::getBBox(StyleUpdateStrategy styleUpdateStrategy)
-{
- return SVGTransformable::getBBox(this, styleUpdateStrategy);
-}
-
-AffineTransform SVGTextElement::getCTM(StyleUpdateStrategy styleUpdateStrategy)
-{
- return SVGLocatable::computeCTM(this, SVGLocatable::NearestViewportScope, styleUpdateStrategy);
-}
-
-AffineTransform SVGTextElement::getScreenCTM(StyleUpdateStrategy styleUpdateStrategy)
-{
- return SVGLocatable::computeCTM(this, SVGLocatable::ScreenScope, styleUpdateStrategy);
-}
-
+// We override SVGGraphics::animatedLocalTransform() so that the transform-origin
+// is not taken into account.
AffineTransform SVGTextElement::animatedLocalTransform() const
{
AffineTransform matrix;
@@ -120,18 +60,12 @@ AffineTransform SVGTextElement::animatedLocalTransform() const
} else
transform().concatenate(matrix);
- if (m_supplementalTransform)
- return *m_supplementalTransform * matrix;
+ const AffineTransform* transform = const_cast<SVGTextElement*>(this)->supplementalTransform();
+ if (transform)
+ return *transform * matrix;
return matrix;
}
-AffineTransform* SVGTextElement::supplementalTransform()
-{
- if (!m_supplementalTransform)
- m_supplementalTransform = adoptPtr(new AffineTransform);
- return m_supplementalTransform.get();
-}
-
RenderObject* SVGTextElement::createRenderer(RenderStyle*)
{
return new (document()->renderArena()) RenderSVGText(this);
@@ -152,26 +86,4 @@ bool SVGTextElement::childShouldCreateRenderer(const NodeRenderingContext& child
return false;
}
-void SVGTextElement::svgAttributeChanged(const QualifiedName& attrName)
-{
- if (!isSupportedAttribute(attrName)) {
- SVGTextPositioningElement::svgAttributeChanged(attrName);
- return;
- }
-
- SVGElementInstance::InvalidationGuard invalidationGuard(this);
-
- RenderObject* renderer = this->renderer();
- if (!renderer)
- return;
-
- if (attrName == SVGNames::transformAttr) {
- renderer->setNeedsTransformUpdate();
- RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
- return;
- }
-
- ASSERT_NOT_REACHED();
-}
-
}
« no previous file with comments | « Source/core/svg/SVGTextElement.h ('k') | Source/core/svg/SVGTextElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698