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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGRect.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) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2007 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 m_value = FloatRect(x, y, width, height); 66 m_value = FloatRect(x, y, width, height);
67 m_isValid = true; 67 m_isValid = true;
68 return true; 68 return true;
69 } 69 }
70 70
71 SVGParsingError SVGRect::setValueAsString(const String& string) 71 SVGParsingError SVGRect::setValueAsString(const String& string)
72 { 72 {
73 setInvalid(); 73 setInvalid();
74 74
75 if (string.isNull()) 75 if (string.isNull())
76 return NoError; 76 return SVGParseStatus::NoError;
77 77
78 if (string.isEmpty()) { 78 if (string.isEmpty()) {
79 m_value = FloatRect(0.0f, 0.0f, 0.0f, 0.0f); 79 m_value = FloatRect(0.0f, 0.0f, 0.0f, 0.0f);
80 m_isValid = true; 80 m_isValid = true;
81 return NoError; 81 return SVGParseStatus::NoError;
82 } 82 }
83 83
84 bool valid; 84 bool valid;
85 if (string.is8Bit()) { 85 if (string.is8Bit()) {
86 const LChar* ptr = string.characters8(); 86 const LChar* ptr = string.characters8();
87 const LChar* end = ptr + string.length(); 87 const LChar* end = ptr + string.length();
88 valid = parse(ptr, end); 88 valid = parse(ptr, end);
89 } else { 89 } else {
90 const UChar* ptr = string.characters16(); 90 const UChar* ptr = string.characters16();
91 const UChar* end = ptr + string.length(); 91 const UChar* end = ptr + string.length();
92 valid = parse(ptr, end); 92 valid = parse(ptr, end);
93 } 93 }
94 return valid ? NoError : ParsingAttributeFailedError; 94 return valid ? SVGParseStatus::NoError : SVGParseStatus::ParsingFailed;
95 } 95 }
96 96
97 String SVGRect::valueAsString() const 97 String SVGRect::valueAsString() const
98 { 98 {
99 StringBuilder builder; 99 StringBuilder builder;
100 builder.appendNumber(x()); 100 builder.appendNumber(x());
101 builder.append(' '); 101 builder.append(' ');
102 builder.appendNumber(y()); 102 builder.appendNumber(y());
103 builder.append(' '); 103 builder.append(' ');
104 builder.appendNumber(width()); 104 builder.appendNumber(width());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 return -1; 137 return -1;
138 } 138 }
139 139
140 void SVGRect::setInvalid() 140 void SVGRect::setInvalid()
141 { 141 {
142 m_value = FloatRect(0.0f, 0.0f, 0.0f, 0.0f); 142 m_value = FloatRect(0.0f, 0.0f, 0.0f, 0.0f);
143 m_isValid = false; 143 m_isValid = false;
144 } 144 }
145 145
146 } 146 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGPreserveAspectRatio.cpp ('k') | third_party/WebKit/Source/core/svg/SVGString.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698