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

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

Issue 2037573002: Empty SVG viewbox should be treated invalid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added parsingError Created 4 years, 6 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
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/custom/empty-viewbox-attr-expected.svg ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 return SVGParseStatus::NoError; 68 return SVGParseStatus::NoError;
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 SVGParseStatus::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 return SVGParsingError(SVGParseStatus::ExpectedNumber, 0);
80 m_isValid = true;
81 return SVGParseStatus::NoError;
82 }
83 80
84 if (string.is8Bit()) { 81 if (string.is8Bit()) {
85 const LChar* ptr = string.characters8(); 82 const LChar* ptr = string.characters8();
86 const LChar* end = ptr + string.length(); 83 const LChar* end = ptr + string.length();
87 return parse(ptr, end); 84 return parse(ptr, end);
88 } 85 }
89 const UChar* ptr = string.characters16(); 86 const UChar* ptr = string.characters16();
90 const UChar* end = ptr + string.length(); 87 const UChar* end = ptr + string.length();
91 return parse(ptr, end); 88 return parse(ptr, end);
92 } 89 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 return -1; 131 return -1;
135 } 132 }
136 133
137 void SVGRect::setInvalid() 134 void SVGRect::setInvalid()
138 { 135 {
139 m_value = FloatRect(0.0f, 0.0f, 0.0f, 0.0f); 136 m_value = FloatRect(0.0f, 0.0f, 0.0f, 0.0f);
140 m_isValid = false; 137 m_isValid = false;
141 } 138 }
142 139
143 } // namespace blink 140 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/custom/empty-viewbox-attr-expected.svg ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698