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

Unified Diff: Source/core/svg/SVGUseElement.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/SVGUseElement.cpp
diff --git a/Source/core/svg/SVGUseElement.cpp b/Source/core/svg/SVGUseElement.cpp
index 82cd6e5d1529534f7b7103a9f1dbb35322a7eef1..a8749e2d8bbd4151207774d7dc46644390c1676a 100644
--- a/Source/core/svg/SVGUseElement.cpp
+++ b/Source/core/svg/SVGUseElement.cpp
@@ -89,19 +89,6 @@ DEFINE_TRACE(SVGUseElement)
SVGURIReference::trace(visitor);
}
-bool SVGUseElement::isSupportedAttribute(const QualifiedName& attrName)
-{
- DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
- if (supportedAttributes.isEmpty()) {
- SVGURIReference::addSupportedAttributes(supportedAttributes);
- supportedAttributes.add(SVGNames::xAttr);
- supportedAttributes.add(SVGNames::yAttr);
- supportedAttributes.add(SVGNames::widthAttr);
- supportedAttributes.add(SVGNames::heightAttr);
- }
- return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
-}
-
#if ENABLE(ASSERT)
static inline bool isWellFormedDocument(Document* document)
{
@@ -203,36 +190,33 @@ void SVGUseElement::collectStyleForPresentationAttribute(const QualifiedName& na
void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName)
{
- if (!isSupportedAttribute(attrName)) {
- SVGGraphicsElement::svgAttributeChanged(attrName);
- return;
- }
-
- SVGElement::InvalidationGuard invalidationGuard(this);
-
- if (attrName == SVGNames::xAttr
- || attrName == SVGNames::yAttr) {
- invalidateSVGPresentationAttributeStyle();
- setNeedsStyleRecalc(LocalStyleChange,
- StyleChangeReasonForTracing::fromAttribute(attrName));
- }
-
- LayoutObject* renderer = this->layoutObject();
if (attrName == SVGNames::xAttr
|| attrName == SVGNames::yAttr
|| attrName == SVGNames::widthAttr
|| attrName == SVGNames::heightAttr) {
+ SVGElement::InvalidationGuard invalidationGuard(this);
+
+ if (attrName == SVGNames::xAttr
+ || attrName == SVGNames::yAttr) {
+ invalidateSVGPresentationAttributeStyle();
+ setNeedsStyleRecalc(LocalStyleChange,
+ StyleChangeReasonForTracing::fromAttribute(attrName));
+ }
+
updateRelativeLengthsInformation();
if (m_targetElementInstance) {
ASSERT(m_targetElementInstance->correspondingElement());
transferUseWidthAndHeightIfNeeded(*this, m_targetElementInstance.get(), *m_targetElementInstance->correspondingElement());
}
- if (renderer)
- markForLayoutAndParentResourceInvalidation(renderer);
+
+ LayoutObject* object = this->layoutObject();
+ if (object)
+ markForLayoutAndParentResourceInvalidation(object);
return;
}
if (SVGURIReference::isKnownAttribute(attrName)) {
+ SVGElement::InvalidationGuard invalidationGuard(this);
bool isExternalReference = isExternalURIReference(hrefString(), document());
if (isExternalReference) {
KURL url = document().completeURL(hrefString());
@@ -249,10 +233,7 @@ void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName)
return;
}
- if (!renderer)
- return;
-
- ASSERT_NOT_REACHED();
+ SVGGraphicsElement::svgAttributeChanged(attrName);
}
static bool isDisallowedElement(Node* node)

Powered by Google App Engine
This is Rietveld 408576698