OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "V8SVGLength.h" | 32 #include "V8SVGLength.h" |
33 | 33 |
34 #include "bindings/v8/ExceptionMessages.h" | |
35 #include "bindings/v8/ExceptionState.h" | 34 #include "bindings/v8/ExceptionState.h" |
36 #include "bindings/v8/V8Binding.h" | 35 #include "bindings/v8/V8Binding.h" |
37 #include "core/dom/ExceptionCode.h" | 36 #include "core/dom/ExceptionCode.h" |
38 #include "core/svg/SVGLengthContext.h" | 37 #include "core/svg/SVGLengthContext.h" |
39 #include "core/svg/properties/SVGPropertyTearOff.h" | 38 #include "core/svg/properties/SVGPropertyTearOff.h" |
40 | 39 |
41 namespace WebCore { | 40 namespace WebCore { |
42 | 41 |
43 void V8SVGLength::valueAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::
Value>& info) | 42 void V8SVGLength::valueAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::
Value>& info) |
44 { | 43 { |
(...skipping 24 matching lines...) Expand all Loading... |
69 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 68 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
70 SVGLengthContext lengthContext(wrapper->contextElement()); | 69 SVGLengthContext lengthContext(wrapper->contextElement()); |
71 imp.setValue(static_cast<float>(value->NumberValue()), lengthContext, except
ionState); | 70 imp.setValue(static_cast<float>(value->NumberValue()), lengthContext, except
ionState); |
72 if (exceptionState.throwIfNeeded()) | 71 if (exceptionState.throwIfNeeded()) |
73 return; | 72 return; |
74 wrapper->commitChange(); | 73 wrapper->commitChange(); |
75 } | 74 } |
76 | 75 |
77 void V8SVGLength::convertToSpecifiedUnitsMethodCustom(const v8::FunctionCallback
Info<v8::Value>& info) | 76 void V8SVGLength::convertToSpecifiedUnitsMethodCustom(const v8::FunctionCallback
Info<v8::Value>& info) |
78 { | 77 { |
| 78 ExceptionState exceptionState(ExceptionState::ExecutionContext, "convertToSp
ecifiedUnits", "SVGLength", info.Holder(), info.GetIsolate()); |
79 SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder()
); | 79 SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder()
); |
80 if (wrapper->isReadOnly()) { | 80 if (wrapper->isReadOnly()) { |
81 setDOMException(NoModificationAllowedError, info.GetIsolate()); | 81 exceptionState.throwDOMException(NoModificationAllowedError, "The length
is read only."); |
| 82 exceptionState.throwIfNeeded(); |
82 return; | 83 return; |
83 } | 84 } |
84 | 85 |
85 if (info.Length() < 1) { | 86 if (info.Length() < 1) { |
86 throwTypeError(ExceptionMessages::failedToExecute("convertToSpecifiedUni
ts", "SVGLength", ExceptionMessages::notEnoughArguments(1, info.Length())), info
.GetIsolate()); | 87 exceptionState.notEnoughArguments(1, info.Length()); |
87 return; | 88 return; |
88 } | 89 } |
89 | 90 |
90 SVGLength& imp = wrapper->propertyReference(); | 91 SVGLength& imp = wrapper->propertyReference(); |
91 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | |
92 V8TRYCATCH_VOID(int, unitType, toUInt32(info[0])); | 92 V8TRYCATCH_VOID(int, unitType, toUInt32(info[0])); |
93 SVGLengthContext lengthContext(wrapper->contextElement()); | 93 SVGLengthContext lengthContext(wrapper->contextElement()); |
94 imp.convertToSpecifiedUnits(unitType, lengthContext, exceptionState); | 94 imp.convertToSpecifiedUnits(unitType, lengthContext, exceptionState); |
95 if (exceptionState.throwIfNeeded()) | 95 if (exceptionState.throwIfNeeded()) |
96 return; | 96 return; |
97 wrapper->commitChange(); | 97 wrapper->commitChange(); |
98 } | 98 } |
99 | 99 |
100 } // namespace WebCore | 100 } // namespace WebCore |
OLD | NEW |