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

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: Align with review comments 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
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 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() || string.isEmpty())
fs 2016/06/03 10:42:51 isEmpty() would be an error, so probably not retur
Shanmuga Pandi 2016/06/03 13:09:31 Done.
76 return SVGParseStatus::NoError; 76 return SVGParseStatus::NoError;
77 77
78 if (string.isEmpty()) {
79 m_value = FloatRect(0.0f, 0.0f, 0.0f, 0.0f);
80 m_isValid = true;
81 return SVGParseStatus::NoError;
82 }
83
84 if (string.is8Bit()) { 78 if (string.is8Bit()) {
85 const LChar* ptr = string.characters8(); 79 const LChar* ptr = string.characters8();
86 const LChar* end = ptr + string.length(); 80 const LChar* end = ptr + string.length();
87 return parse(ptr, end); 81 return parse(ptr, end);
88 } 82 }
89 const UChar* ptr = string.characters16(); 83 const UChar* ptr = string.characters16();
90 const UChar* end = ptr + string.length(); 84 const UChar* end = ptr + string.length();
91 return parse(ptr, end); 85 return parse(ptr, end);
92 } 86 }
93 87
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 return -1; 128 return -1;
135 } 129 }
136 130
137 void SVGRect::setInvalid() 131 void SVGRect::setInvalid()
138 { 132 {
139 m_value = FloatRect(0.0f, 0.0f, 0.0f, 0.0f); 133 m_value = FloatRect(0.0f, 0.0f, 0.0f, 0.0f);
140 m_isValid = false; 134 m_isValid = false;
141 } 135 }
142 136
143 } // namespace blink 137 } // 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