| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 #include "bindings/v8/ExceptionMessages.h" | 34 #include "bindings/v8/ExceptionMessages.h" |
| 35 #include "bindings/v8/V8Binding.h" | 35 #include "bindings/v8/V8Binding.h" |
| 36 #include "bindings/v8/V8DOMWrapper.h" | 36 #include "bindings/v8/V8DOMWrapper.h" |
| 37 #include "bindings/v8/V8MutationCallback.h" | 37 #include "bindings/v8/V8MutationCallback.h" |
| 38 #include "bindings/v8/V8Utilities.h" | 38 #include "bindings/v8/V8Utilities.h" |
| 39 #include "core/dom/MutationObserver.h" | 39 #include "core/dom/MutationObserver.h" |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 void V8MutationObserver::constructorCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& args) | 43 void V8MutationObserver::constructorCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& info) |
| 44 { | 44 { |
| 45 if (args.Length() < 1) { | 45 if (info.Length() < 1) { |
| 46 throwTypeError(ExceptionMessages::failedToConstruct("MutationObserver",
ExceptionMessages::notEnoughArguments(1, args.Length())), args.GetIsolate()); | 46 throwTypeError(ExceptionMessages::failedToConstruct("MutationObserver",
ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); |
| 47 return; | 47 return; |
| 48 } | 48 } |
| 49 | 49 |
| 50 v8::Local<v8::Value> arg = args[0]; | 50 v8::Local<v8::Value> arg = info[0]; |
| 51 if (!arg->IsFunction()) { | 51 if (!arg->IsFunction()) { |
| 52 throwTypeError("Callback argument must be a function", args.GetIsolate()
); | 52 throwTypeError("Callback argument must be a function", info.GetIsolate()
); |
| 53 return; | 53 return; |
| 54 } | 54 } |
| 55 | 55 |
| 56 ExecutionContext* context = getExecutionContext(); | 56 ExecutionContext* context = getExecutionContext(); |
| 57 v8::Handle<v8::Object> wrapper = args.Holder(); | 57 v8::Handle<v8::Object> wrapper = info.Holder(); |
| 58 | 58 |
| 59 RefPtr<MutationCallback> callback = V8MutationCallback::create(v8::Handle<v8
::Function>::Cast(arg), context, wrapper, args.GetIsolate()); | 59 RefPtr<MutationCallback> callback = V8MutationCallback::create(v8::Handle<v8
::Function>::Cast(arg), context, wrapper, info.GetIsolate()); |
| 60 RefPtr<MutationObserver> observer = MutationObserver::create(callback.releas
e()); | 60 RefPtr<MutationObserver> observer = MutationObserver::create(callback.releas
e()); |
| 61 | 61 |
| 62 V8DOMWrapper::associateObjectWithWrapper<V8MutationObserver>(observer.releas
e(), &wrapperTypeInfo, wrapper, args.GetIsolate(), WrapperConfiguration::Depende
nt); | 62 V8DOMWrapper::associateObjectWithWrapper<V8MutationObserver>(observer.releas
e(), &wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Depende
nt); |
| 63 args.GetReturnValue().Set(wrapper); | 63 info.GetReturnValue().Set(wrapper); |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace WebCore | 66 } // namespace WebCore |
| OLD | NEW |