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

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

Issue 1588993005: Extended error reporting for SVG attribute parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: TestExpectations 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 { 151 {
152 if (isImmutable()) { 152 if (isImmutable()) {
153 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only."); 153 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only.");
154 return; 154 return;
155 } 155 }
156 156
157 String oldValue = target()->valueAsString(); 157 String oldValue = target()->valueAsString();
158 158
159 SVGParsingError status = target()->setValueAsString(str); 159 SVGParsingError status = target()->setValueAsString(str);
160 160
161 if (status == NoError && !hasExposedLengthUnit()) { 161 if (status == SVGStatus::NoError && !hasExposedLengthUnit()) {
162 target()->setValueAsString(oldValue); // rollback to old value 162 target()->setValueAsString(oldValue); // rollback to old value
163 status = ParsingAttributeFailedError; 163 status = SVGStatus::ParsingFailed;
164 } 164 }
165 if (status != NoError) { 165 if (status != SVGStatus::NoError) {
166 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + str + "') is invalid."); 166 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + str + "') is invalid.");
167 return; 167 return;
168 } 168 }
169 169
170 commitChange(); 170 commitChange();
171 } 171 }
172 172
173 void SVGLengthTearOff::newValueSpecifiedUnits(unsigned short unitType, float val ueInSpecifiedUnits, ExceptionState& exceptionState) 173 void SVGLengthTearOff::newValueSpecifiedUnits(unsigned short unitType, float val ueInSpecifiedUnits, ExceptionState& exceptionState)
174 { 174 {
175 if (isImmutable()) { 175 if (isImmutable()) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 target()->convertToSpecifiedUnits(toCSSUnitType(unitType), lengthContext); 208 target()->convertToSpecifiedUnits(toCSSUnitType(unitType), lengthContext);
209 commitChange(); 209 commitChange();
210 } 210 }
211 211
212 SVGLengthTearOff::SVGLengthTearOff(PassRefPtrWillBeRawPtr<SVGLength> target, SVG Element* contextElement, PropertyIsAnimValType propertyIsAnimVal, const Qualifie dName& attributeName) 212 SVGLengthTearOff::SVGLengthTearOff(PassRefPtrWillBeRawPtr<SVGLength> target, SVG Element* contextElement, PropertyIsAnimValType propertyIsAnimVal, const Qualifie dName& attributeName)
213 : SVGPropertyTearOff<SVGLength>(target, contextElement, propertyIsAnimVal, a ttributeName) 213 : SVGPropertyTearOff<SVGLength>(target, contextElement, propertyIsAnimVal, a ttributeName)
214 { 214 {
215 } 215 }
216 216
217 } 217 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698