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

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

Issue 1544673003: Refactor propagation of parsing errors for SVG attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 void SVGAngleTearOff::setValueAsString(const String& value, ExceptionState& exce ptionState) 108 void SVGAngleTearOff::setValueAsString(const String& value, ExceptionState& exce ptionState)
109 { 109 {
110 if (isImmutable()) { 110 if (isImmutable()) {
111 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only."); 111 exceptionState.throwDOMException(NoModificationAllowedError, "The attrib ute is read-only.");
112 return; 112 return;
113 } 113 }
114 114
115 String oldValue = target()->valueAsString(); 115 String oldValue = target()->valueAsString();
116 116
117 target()->setValueAsString(value, exceptionState); 117 SVGParsingError status = target()->setValueAsString(value);
118 118
119 if (!exceptionState.hadException() && !hasExposedAngleUnit()) { 119 if (status == NoError && !hasExposedAngleUnit()) {
120 target()->setValueAsString(oldValue, ASSERT_NO_EXCEPTION); // rollback t o old value 120 target()->setValueAsString(oldValue); // rollback to old value
pdr. 2015/12/23 04:00:08 Is this rollback behavior spec'd? Not a big deal e
fs 2015/12/23 10:04:17 As I recall this was subject of discussion in the
fs 2015/12/23 12:54:47 After some mild digging I found: http://www.w3.or
121 status = ParsingAttributeFailedError;
122 }
123 if (status != NoError) {
121 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + value + "') is invalid."); 124 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + value + "') is invalid.");
122 return; 125 return;
123 } 126 }
124 127
125 commitChange(); 128 commitChange();
126 } 129 }
127 130
128 } 131 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698