| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007-2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2007-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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include "core/dom/Document.h" | 52 #include "core/dom/Document.h" |
| 53 #include "core/dom/custom/CustomElementCallbackDispatcher.h" | 53 #include "core/dom/custom/CustomElementCallbackDispatcher.h" |
| 54 #include "core/events/EventListener.h" | 54 #include "core/events/EventListener.h" |
| 55 #include "core/dom/shadow/ShadowRoot.h" | 55 #include "core/dom/shadow/ShadowRoot.h" |
| 56 #include "wtf/RefPtr.h" | 56 #include "wtf/RefPtr.h" |
| 57 | 57 |
| 58 namespace WebCore { | 58 namespace WebCore { |
| 59 | 59 |
| 60 // These functions are custom to prevent a wrapper lookup of the return value wh
ich is always | 60 // These functions are custom to prevent a wrapper lookup of the return value wh
ich is always |
| 61 // part of the arguments. | 61 // part of the arguments. |
| 62 void V8Node::insertBeforeMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
args) | 62 void V8Node::insertBeforeMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 63 { | 63 { |
| 64 v8::Handle<v8::Object> holder = args.Holder(); | 64 v8::Handle<v8::Object> holder = info.Holder(); |
| 65 Node* imp = V8Node::toNative(holder); | 65 Node* imp = V8Node::toNative(holder); |
| 66 | 66 |
| 67 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; | 67 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; |
| 68 | 68 |
| 69 ExceptionState es(args.GetIsolate()); | 69 ExceptionState es(info.GetIsolate()); |
| 70 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a
rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0
; | 70 Node* newChild = V8Node::HasInstance(info[0], info.GetIsolate(), worldType(i
nfo.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0
; |
| 71 Node* refChild = V8Node::HasInstance(args[1], args.GetIsolate(), worldType(a
rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0
; | 71 Node* refChild = V8Node::HasInstance(info[1], info.GetIsolate(), worldType(i
nfo.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(info[1])) : 0
; |
| 72 imp->insertBefore(newChild, refChild, es); | 72 imp->insertBefore(newChild, refChild, es); |
| 73 if (es.throwIfNeeded()) | 73 if (es.throwIfNeeded()) |
| 74 return; | 74 return; |
| 75 v8SetReturnValue(args, args[0]); | 75 v8SetReturnValue(info, info[0]); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void V8Node::replaceChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
args) | 78 void V8Node::replaceChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 79 { | 79 { |
| 80 v8::Handle<v8::Object> holder = args.Holder(); | 80 v8::Handle<v8::Object> holder = info.Holder(); |
| 81 Node* imp = V8Node::toNative(holder); | 81 Node* imp = V8Node::toNative(holder); |
| 82 | 82 |
| 83 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; | 83 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; |
| 84 | 84 |
| 85 ExceptionState es(args.GetIsolate()); | 85 ExceptionState es(info.GetIsolate()); |
| 86 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a
rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0
; | 86 Node* newChild = V8Node::HasInstance(info[0], info.GetIsolate(), worldType(i
nfo.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0
; |
| 87 Node* oldChild = V8Node::HasInstance(args[1], args.GetIsolate(), worldType(a
rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0
; | 87 Node* oldChild = V8Node::HasInstance(info[1], info.GetIsolate(), worldType(i
nfo.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(info[1])) : 0
; |
| 88 imp->replaceChild(newChild, oldChild, es); | 88 imp->replaceChild(newChild, oldChild, es); |
| 89 if (es.throwIfNeeded()) | 89 if (es.throwIfNeeded()) |
| 90 return; | 90 return; |
| 91 v8SetReturnValue(args, args[1]); | 91 v8SetReturnValue(info, info[1]); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void V8Node::removeChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
args) | 94 void V8Node::removeChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 95 { | 95 { |
| 96 v8::Handle<v8::Object> holder = args.Holder(); | 96 v8::Handle<v8::Object> holder = info.Holder(); |
| 97 Node* imp = V8Node::toNative(holder); | 97 Node* imp = V8Node::toNative(holder); |
| 98 | 98 |
| 99 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; | 99 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; |
| 100 | 100 |
| 101 ExceptionState es(args.GetIsolate()); | 101 ExceptionState es(info.GetIsolate()); |
| 102 Node* oldChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a
rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0
; | 102 Node* oldChild = V8Node::HasInstance(info[0], info.GetIsolate(), worldType(i
nfo.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0
; |
| 103 imp->removeChild(oldChild, es); | 103 imp->removeChild(oldChild, es); |
| 104 if (es.throwIfNeeded()) | 104 if (es.throwIfNeeded()) |
| 105 return; | 105 return; |
| 106 v8SetReturnValue(args, args[0]); | 106 v8SetReturnValue(info, info[0]); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void V8Node::appendChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
args) | 109 void V8Node::appendChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 110 { | 110 { |
| 111 v8::Handle<v8::Object> holder = args.Holder(); | 111 v8::Handle<v8::Object> holder = info.Holder(); |
| 112 Node* imp = V8Node::toNative(holder); | 112 Node* imp = V8Node::toNative(holder); |
| 113 | 113 |
| 114 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; | 114 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; |
| 115 | 115 |
| 116 ExceptionState es(args.GetIsolate()); | 116 ExceptionState es(info.GetIsolate()); |
| 117 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a
rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0
; | 117 Node* newChild = V8Node::HasInstance(info[0], info.GetIsolate(), worldType(i
nfo.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0
; |
| 118 imp->appendChild(newChild, es); | 118 imp->appendChild(newChild, es); |
| 119 if (es.throwIfNeeded()) | 119 if (es.throwIfNeeded()) |
| 120 return; | 120 return; |
| 121 v8SetReturnValue(args, args[0]); | 121 v8SetReturnValue(info, info[0]); |
| 122 } | 122 } |
| 123 | 123 |
| 124 v8::Handle<v8::Object> wrap(Node* impl, v8::Handle<v8::Object> creationContext,
v8::Isolate* isolate) | 124 v8::Handle<v8::Object> wrap(Node* impl, v8::Handle<v8::Object> creationContext,
v8::Isolate* isolate) |
| 125 { | 125 { |
| 126 ASSERT(impl); | 126 ASSERT(impl); |
| 127 switch (impl->nodeType()) { | 127 switch (impl->nodeType()) { |
| 128 case Node::ELEMENT_NODE: | 128 case Node::ELEMENT_NODE: |
| 129 // For performance reasons, this is inlined from V8Element::wrap and mus
t remain in sync. | 129 // For performance reasons, this is inlined from V8Element::wrap and mus
t remain in sync. |
| 130 if (impl->isHTMLElement()) | 130 if (impl->isHTMLElement()) |
| 131 return wrap(toHTMLElement(impl), creationContext, isolate); | 131 return wrap(toHTMLElement(impl), creationContext, isolate); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 154 case Node::NOTATION_NODE: | 154 case Node::NOTATION_NODE: |
| 155 // We never create objects of Entity and Notation. | 155 // We never create objects of Entity and Notation. |
| 156 ASSERT_NOT_REACHED(); | 156 ASSERT_NOT_REACHED(); |
| 157 break; | 157 break; |
| 158 default: | 158 default: |
| 159 break; // ENTITY_REFERENCE_NODE or XPATH_NAMESPACE_NODE | 159 break; // ENTITY_REFERENCE_NODE or XPATH_NAMESPACE_NODE |
| 160 } | 160 } |
| 161 return V8Node::createWrapper(impl, creationContext, isolate); | 161 return V8Node::createWrapper(impl, creationContext, isolate); |
| 162 } | 162 } |
| 163 } // namespace WebCore | 163 } // namespace WebCore |
| OLD | NEW |