| 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 26 matching lines...) Expand all Loading... |
| 37 #include "core/dom/ExceptionCode.h" | 37 #include "core/dom/ExceptionCode.h" |
| 38 #include "core/svg/SVGLengthContext.h" | 38 #include "core/svg/SVGLengthContext.h" |
| 39 #include "core/svg/properties/SVGPropertyTearOff.h" | 39 #include "core/svg/properties/SVGPropertyTearOff.h" |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 void V8SVGLength::valueAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::
Value>& info) | 43 void V8SVGLength::valueAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::
Value>& info) |
| 44 { | 44 { |
| 45 SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder()
); | 45 SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder()
); |
| 46 SVGLength& imp = wrapper->propertyReference(); | 46 SVGLength& imp = wrapper->propertyReference(); |
| 47 ExceptionState es(info.GetIsolate()); | 47 ExceptionState es(info.Holder(), info.GetIsolate()); |
| 48 SVGLengthContext lengthContext(wrapper->contextElement()); | 48 SVGLengthContext lengthContext(wrapper->contextElement()); |
| 49 float value = imp.value(lengthContext, es); | 49 float value = imp.value(lengthContext, es); |
| 50 if (es.throwIfNeeded()) | 50 if (es.throwIfNeeded()) |
| 51 return; | 51 return; |
| 52 v8SetReturnValue(info, value); | 52 v8SetReturnValue(info, value); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void V8SVGLength::valueAttributeSetterCustom(v8::Local<v8::Value> value, const v
8::PropertyCallbackInfo<void>& info) | 55 void V8SVGLength::valueAttributeSetterCustom(v8::Local<v8::Value> value, const v
8::PropertyCallbackInfo<void>& info) |
| 56 { | 56 { |
| 57 SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder()
); | 57 SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(info.Holder()
); |
| 58 if (wrapper->isReadOnly()) { | 58 if (wrapper->isReadOnly()) { |
| 59 setDOMException(NoModificationAllowedError, info.GetIsolate()); | 59 setDOMException(NoModificationAllowedError, info.GetIsolate()); |
| 60 return; | 60 return; |
| 61 } | 61 } |
| 62 | 62 |
| 63 if (!isUndefinedOrNull(value) && !value->IsNumber() && !value->IsBoolean())
{ | 63 if (!isUndefinedOrNull(value) && !value->IsNumber() && !value->IsBoolean())
{ |
| 64 throwUninformativeAndGenericTypeError(info.GetIsolate()); | 64 throwUninformativeAndGenericTypeError(info.GetIsolate()); |
| 65 return; | 65 return; |
| 66 } | 66 } |
| 67 | 67 |
| 68 SVGLength& imp = wrapper->propertyReference(); | 68 SVGLength& imp = wrapper->propertyReference(); |
| 69 ExceptionState es(info.GetIsolate()); | 69 ExceptionState es(info.Holder(), info.GetIsolate()); |
| 70 SVGLengthContext lengthContext(wrapper->contextElement()); | 70 SVGLengthContext lengthContext(wrapper->contextElement()); |
| 71 imp.setValue(static_cast<float>(value->NumberValue()), lengthContext, es); | 71 imp.setValue(static_cast<float>(value->NumberValue()), lengthContext, es); |
| 72 if (es.throwIfNeeded()) | 72 if (es.throwIfNeeded()) |
| 73 return; | 73 return; |
| 74 wrapper->commitChange(); | 74 wrapper->commitChange(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void V8SVGLength::convertToSpecifiedUnitsMethodCustom(const v8::FunctionCallback
Info<v8::Value>& info) | 77 void V8SVGLength::convertToSpecifiedUnitsMethodCustom(const v8::FunctionCallback
Info<v8::Value>& info) |
| 78 { | 78 { |
| 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 setDOMException(NoModificationAllowedError, info.GetIsolate()); |
| 82 return; | 82 return; |
| 83 } | 83 } |
| 84 | 84 |
| 85 if (info.Length() < 1) { | 85 if (info.Length() < 1) { |
| 86 throwTypeError(ExceptionMessages::failedToExecute("convertToSpecifiedUni
ts", "SVGLength", ExceptionMessages::notEnoughArguments(1, info.Length())), info
.GetIsolate()); | 86 throwTypeError(ExceptionMessages::failedToExecute("convertToSpecifiedUni
ts", "SVGLength", ExceptionMessages::notEnoughArguments(1, info.Length())), info
.GetIsolate()); |
| 87 return; | 87 return; |
| 88 } | 88 } |
| 89 | 89 |
| 90 SVGLength& imp = wrapper->propertyReference(); | 90 SVGLength& imp = wrapper->propertyReference(); |
| 91 ExceptionState es(info.GetIsolate()); | 91 ExceptionState es(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, es); | 94 imp.convertToSpecifiedUnits(unitType, lengthContext, es); |
| 95 if (es.throwIfNeeded()) | 95 if (es.throwIfNeeded()) |
| 96 return; | 96 return; |
| 97 wrapper->commitChange(); | 97 wrapper->commitChange(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace WebCore | 100 } // namespace WebCore |
| OLD | NEW |