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

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

Issue 1074813002: Remove isSupportedAttribute in svg (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: invalidation guard tweaks Created 5 years, 8 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
Index: Source/core/svg/SVGTextPositioningElement.cpp
diff --git a/Source/core/svg/SVGTextPositioningElement.cpp b/Source/core/svg/SVGTextPositioningElement.cpp
index 4c6a02e2c2692266a242d9d0db090b52fd0ac793..49d2778fd58dd3e6a2bd4333b73aae5676423911 100644
--- a/Source/core/svg/SVGTextPositioningElement.cpp
+++ b/Source/core/svg/SVGTextPositioningElement.cpp
@@ -54,28 +54,8 @@ DEFINE_TRACE(SVGTextPositioningElement)
SVGTextContentElement::trace(visitor);
}
-bool SVGTextPositioningElement::isSupportedAttribute(const QualifiedName& attrName)
-{
- DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
- if (supportedAttributes.isEmpty()) {
- supportedAttributes.add(SVGNames::xAttr);
- supportedAttributes.add(SVGNames::yAttr);
- supportedAttributes.add(SVGNames::dxAttr);
- supportedAttributes.add(SVGNames::dyAttr);
- supportedAttributes.add(SVGNames::rotateAttr);
- }
- return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
-}
-
void SVGTextPositioningElement::svgAttributeChanged(const QualifiedName& attrName)
{
- if (!isSupportedAttribute(attrName)) {
- SVGTextContentElement::svgAttributeChanged(attrName);
- return;
- }
-
- SVGElement::InvalidationGuard invalidationGuard(this);
-
bool updateRelativeLengths = attrName == SVGNames::xAttr
|| attrName == SVGNames::yAttr
|| attrName == SVGNames::dxAttr
@@ -84,15 +64,20 @@ void SVGTextPositioningElement::svgAttributeChanged(const QualifiedName& attrNam
if (updateRelativeLengths)
updateRelativeLengthsInformation();
- LayoutObject* renderer = this->layoutObject();
- if (!renderer)
- return;
+ if (updateRelativeLengths || attrName == SVGNames::rotateAttr) {
+ SVGElement::InvalidationGuard invalidationGuard(this);
- ASSERT(updateRelativeLengths || attrName == SVGNames::rotateAttr);
+ LayoutObject* renderer = this->layoutObject();
+ if (!renderer)
+ return;
+
+ if (LayoutSVGText* textRenderer = LayoutSVGText::locateLayoutSVGTextAncestor(renderer))
+ textRenderer->setNeedsPositioningValuesUpdate();
+ markForLayoutAndParentResourceInvalidation(renderer);
+ return;
+ }
- if (LayoutSVGText* textRenderer = LayoutSVGText::locateLayoutSVGTextAncestor(renderer))
- textRenderer->setNeedsPositioningValuesUpdate();
- markForLayoutAndParentResourceInvalidation(renderer);
+ SVGTextContentElement::svgAttributeChanged(attrName);
}
SVGTextPositioningElement* SVGTextPositioningElement::elementFromRenderer(LayoutObject& renderer)

Powered by Google App Engine
This is Rietveld 408576698