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

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

Issue 1620203002: Extended error reporting for SVGNumber/Point/Rect and related types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Blind is blind. 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
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGPoint.h ('k') | third_party/WebKit/Source/core/svg/SVGPointList.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/svg/SVGPoint.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGPoint.cpp b/third_party/WebKit/Source/core/svg/SVGPoint.cpp
index b0fc684866242e770b359c89e570fe01013c8a0c..6916dc6099e786194c0d66a2e58fc2b3dcdcd9b8 100644
--- a/third_party/WebKit/Source/core/svg/SVGPoint.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGPoint.cpp
@@ -53,24 +53,21 @@ PassRefPtrWillBeRawPtr<SVGPoint> SVGPoint::clone() const
}
template<typename CharType>
-bool SVGPoint::parse(const CharType*& ptr, const CharType* end)
+SVGParsingError SVGPoint::parse(const CharType*& ptr, const CharType* end)
{
- skipOptionalSVGSpaces(ptr, end);
-
- float x = 0.0f;
- float y = 0.0f;
- bool valid = parseNumber(ptr, end, x) && parseNumber(ptr, end, y, DisallowWhitespace);
-
- if (!valid)
- return false;
+ float x = 0;
+ float y = 0;
+ if (!parseNumber(ptr, end, x)
+ || !parseNumber(ptr, end, y, DisallowWhitespace))
+ return SVGParseStatus::ExpectedNumber;
if (skipOptionalSVGSpaces(ptr, end)) {
// Nothing should come after the second number.
- return false;
+ return SVGParseStatus::TrailingGarbage;
}
m_value = FloatPoint(x, y);
- return true;
+ return SVGParseStatus::NoError;
}
FloatPoint SVGPoint::matrixTransform(const AffineTransform& transform) const
@@ -87,17 +84,14 @@ SVGParsingError SVGPoint::setValueAsString(const String& string)
return SVGParseStatus::NoError;
}
- bool valid;
if (string.is8Bit()) {
const LChar* ptr = string.characters8();
const LChar* end = ptr + string.length();
- valid = parse(ptr, end);
- } else {
- const UChar* ptr = string.characters16();
- const UChar* end = ptr + string.length();
- valid = parse(ptr, end);
+ return parse(ptr, end);
}
- return valid ? SVGParseStatus::NoError : SVGParseStatus::ParsingFailed;
+ const UChar* ptr = string.characters16();
+ const UChar* end = ptr + string.length();
+ return parse(ptr, end);
}
String SVGPoint::valueAsString() const
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGPoint.h ('k') | third_party/WebKit/Source/core/svg/SVGPointList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698