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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGPoint.cpp

Issue 1588993005: Extended error reporting for SVG attribute parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add PLATFORM_EXPORT 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 { 77 {
78 double newX, newY; 78 double newX, newY;
79 transform.map(static_cast<double>(x()), static_cast<double>(y()), newX, newY ); 79 transform.map(static_cast<double>(x()), static_cast<double>(y()), newX, newY );
80 return FloatPoint::narrowPrecision(newX, newY); 80 return FloatPoint::narrowPrecision(newX, newY);
81 } 81 }
82 82
83 SVGParsingError SVGPoint::setValueAsString(const String& string) 83 SVGParsingError SVGPoint::setValueAsString(const String& string)
84 { 84 {
85 if (string.isEmpty()) { 85 if (string.isEmpty()) {
86 m_value = FloatPoint(0.0f, 0.0f); 86 m_value = FloatPoint(0.0f, 0.0f);
87 return NoError; 87 return SVGParseStatus::NoError;
88 } 88 }
89 89
90 bool valid; 90 bool valid;
91 if (string.is8Bit()) { 91 if (string.is8Bit()) {
92 const LChar* ptr = string.characters8(); 92 const LChar* ptr = string.characters8();
93 const LChar* end = ptr + string.length(); 93 const LChar* end = ptr + string.length();
94 valid = parse(ptr, end); 94 valid = parse(ptr, end);
95 } else { 95 } else {
96 const UChar* ptr = string.characters16(); 96 const UChar* ptr = string.characters16();
97 const UChar* end = ptr + string.length(); 97 const UChar* end = ptr + string.length();
98 valid = parse(ptr, end); 98 valid = parse(ptr, end);
99 } 99 }
100 return valid ? NoError : ParsingAttributeFailedError; 100 return valid ? SVGParseStatus::NoError : SVGParseStatus::ParsingFailed;
101 } 101 }
102 102
103 String SVGPoint::valueAsString() const 103 String SVGPoint::valueAsString() const
104 { 104 {
105 StringBuilder builder; 105 StringBuilder builder;
106 builder.appendNumber(x()); 106 builder.appendNumber(x());
107 builder.append(' '); 107 builder.append(' ');
108 builder.appendNumber(y()); 108 builder.appendNumber(y());
109 return builder.toString(); 109 return builder.toString();
110 } 110 }
(...skipping 11 matching lines...) Expand all
122 } 122 }
123 123
124 float SVGPoint::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SV GElement* contextElement) 124 float SVGPoint::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SV GElement* contextElement)
125 { 125 {
126 // SVGPoint is not animated by itself 126 // SVGPoint is not animated by itself
127 ASSERT_NOT_REACHED(); 127 ASSERT_NOT_REACHED();
128 return 0.0f; 128 return 0.0f;
129 } 129 }
130 130
131 } 131 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGPathElement.cpp ('k') | third_party/WebKit/Source/core/svg/SVGPointList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698