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

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

Issue 18328007: Move SVGTests attributes parsing to SVGGraphicsElement (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master 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/SVGSVGElement.h ('k') | Source/core/svg/SVGTextContentElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGSVGElement.cpp
diff --git a/Source/core/svg/SVGSVGElement.cpp b/Source/core/svg/SVGSVGElement.cpp
index 1c7674368b69727cb7867a65be7fc98513ab5c72..03e2f41b0a1d789ac862cfe6532e06bb89805b51 100644
--- a/Source/core/svg/SVGSVGElement.cpp
+++ b/Source/core/svg/SVGSVGElement.cpp
@@ -221,8 +221,35 @@ void SVGSVGElement::updateCurrentTranslate()
document()->renderer()->repaint();
}
+bool SVGSVGElement::isSupportedAttribute(const QualifiedName& attrName)
do-not-use 2013/07/02 19:47:30 This is actually not needed, sorry. The real issue
+{
+ DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
+ if (supportedAttributes.isEmpty()) {
+ SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
+ SVGFitToViewBox::addSupportedAttributes(supportedAttributes);
+ SVGLangSpace::addSupportedAttributes(supportedAttributes);
+ SVGZoomAndPan::addSupportedAttributes(supportedAttributes);
+ supportedAttributes.add(SVGNames::xAttr);
+ supportedAttributes.add(SVGNames::yAttr);
+ supportedAttributes.add(SVGNames::widthAttr);
+ supportedAttributes.add(SVGNames::heightAttr);
+ supportedAttributes.add(SVGNames::onzoomAttr);
+ supportedAttributes.add(HTMLNames::onabortAttr);
+ supportedAttributes.add(HTMLNames::onerrorAttr);
+ supportedAttributes.add(HTMLNames::onunloadAttr);
+ supportedAttributes.add(HTMLNames::onresizeAttr);
+ supportedAttributes.add(HTMLNames::onscrollAttr);
+ }
+ return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
+}
+
void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
+ if (!isSupportedAttribute(name)) {
+ SVGGraphicsElement::parseAttribute(name, value);
+ return;
+ }
+
SVGParsingError parseError = NoError;
if (!nearestViewportElement()) {
@@ -256,8 +283,7 @@ void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString
setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
else if (name == SVGNames::heightAttr)
setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
- else if (SVGTests::parseAttribute(name, value)
- || SVGLangSpace::parseAttribute(name, value)
+ else if (SVGLangSpace::parseAttribute(name, value)
|| SVGExternalResourcesRequired::parseAttribute(name, value)
|| SVGFitToViewBox::parseAttribute(this, name, value)
|| SVGZoomAndPan::parseAttribute(this, name, value)) {
@@ -269,6 +295,11 @@ void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString
void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName)
{
+ if (!isSupportedAttribute(attrName)) {
+ SVGGraphicsElement::svgAttributeChanged(attrName);
+ return;
+ }
+
bool updateRelativeLengthsOrViewBox = false;
bool widthChanged = attrName == SVGNames::widthAttr;
if (widthChanged
@@ -294,8 +325,6 @@ void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName)
}
SVGElementInstance::InvalidationGuard invalidationGuard(this);
- if (SVGTests::handleAttributeChange(this, attrName))
- return;
if (updateRelativeLengthsOrViewBox
|| SVGLangSpace::isKnownAttribute(attrName)
« no previous file with comments | « Source/core/svg/SVGSVGElement.h ('k') | Source/core/svg/SVGTextContentElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698