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

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

Issue 1901673003: Improve default value handling for SVGSVGElement.width/height (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move to parseAttribute Created 4 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
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/custom/disallow-non-lengths-in-attrs-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/svg/SVGSVGElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp b/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp
index 02cf93023e5964c7648ed33075fa3e7c88e1c4aa..ae6b0e1f278582355a097b4ca14b1e7450665c9b 100644
--- a/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp
@@ -193,6 +193,14 @@ void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString
} else if (name == HTMLNames::onerrorAttr) {
document().setWindowAttributeEventListener(EventTypeNames::error, createAttributeEventListener(document().frame(), name, value, eventParameterName()));
} else if (SVGZoomAndPan::parseAttribute(name, value)) {
+ } else if (name == SVGNames::widthAttr || name == SVGNames::heightAttr) {
+ SVGAnimatedLength* property = name == SVGNames::widthAttr ? m_width : m_height;
+ SVGParsingError parseError;
+ if (!value.isNull())
+ parseError = property->setBaseValueAsString(value);
+ if (parseError != SVGParseStatus::NoError || value.isNull())
+ property->setDefaultValueAsString("100%");
+ reportAttributeParsingError(parseError, name, value);
} else {
SVGElement::parseAttribute(name, oldValue, value);
}
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/custom/disallow-non-lengths-in-attrs-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698