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

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

Issue 1644293003: Error reporting for SVGInteger and SVGIntegerOptionalInteger (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: TestExpectations; Drop redundant test. Created 4 years, 11 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: third_party/WebKit/Source/core/svg/SVGInteger.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGInteger.cpp b/third_party/WebKit/Source/core/svg/SVGInteger.cpp
index efb998050f82cc85c88c72c7cf10f2ee771ae59c..4586c976779ebb67dc39a958b6390fbb871b2b7b 100644
--- a/third_party/WebKit/Source/core/svg/SVGInteger.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGInteger.cpp
@@ -52,19 +52,15 @@ String SVGInteger::valueAsString() const
SVGParsingError SVGInteger::setValueAsString(const String& string)
{
- if (string.isEmpty()) {
- m_value = 0;
+ m_value = 0;
+
+ if (string.isEmpty())
return SVGParseStatus::NoError;
- }
bool valid = true;
m_value = stripLeadingAndTrailingHTMLSpaces(string).toIntStrict(&valid);
-
- if (!valid) {
- m_value = 0;
- return SVGParseStatus::ParsingFailed;
- }
- return SVGParseStatus::NoError;
+ // toIntStrict returns 0 if valid == false.
+ return valid ? SVGParseStatus::NoError : SVGParseStatus::ExpectedInteger;
}
void SVGInteger::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement*)

Powered by Google App Engine
This is Rietveld 408576698