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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 #include "core/dom/shadow/ShadowRoot.h" | 54 #include "core/dom/shadow/ShadowRoot.h" |
55 #include "wtf/RefPtr.h" | 55 #include "wtf/RefPtr.h" |
56 | 56 |
57 namespace WebCore { | 57 namespace WebCore { |
58 | 58 |
59 // These functions are custom to prevent a wrapper lookup of the return value wh
ich is always | 59 // These functions are custom to prevent a wrapper lookup of the return value wh
ich is always |
60 // part of the arguments. | 60 // part of the arguments. |
61 void V8Node::insertBeforeMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) | 61 void V8Node::insertBeforeMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) |
62 { | 62 { |
63 v8::Handle<v8::Object> holder = info.Holder(); | 63 v8::Handle<v8::Object> holder = info.Holder(); |
64 Node* imp = V8Node::toNative(holder); | 64 Node* impl = V8Node::toNative(holder); |
65 | 65 |
66 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; | 66 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; |
67 | 67 |
68 ExceptionState exceptionState(ExceptionState::ExecutionContext, "insertBefor
e", "Node", info.Holder(), info.GetIsolate()); | 68 ExceptionState exceptionState(ExceptionState::ExecutionContext, "insertBefor
e", "Node", info.Holder(), info.GetIsolate()); |
69 Node* newChild = V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[0]); | 69 Node* newChild = V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[0]); |
70 Node* refChild = V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[1]); | 70 Node* refChild = V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[1]); |
71 imp->insertBefore(newChild, refChild, exceptionState); | 71 impl->insertBefore(newChild, refChild, exceptionState); |
72 if (exceptionState.throwIfNeeded()) | 72 if (exceptionState.throwIfNeeded()) |
73 return; | 73 return; |
74 v8SetReturnValue(info, info[0]); | 74 v8SetReturnValue(info, info[0]); |
75 } | 75 } |
76 | 76 |
77 void V8Node::replaceChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) | 77 void V8Node::replaceChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) |
78 { | 78 { |
79 v8::Handle<v8::Object> holder = info.Holder(); | 79 v8::Handle<v8::Object> holder = info.Holder(); |
80 Node* imp = V8Node::toNative(holder); | 80 Node* impl = V8Node::toNative(holder); |
81 | 81 |
82 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; | 82 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; |
83 | 83 |
84 ExceptionState exceptionState(ExceptionState::ExecutionContext, "replaceChil
d", "Node", info.Holder(), info.GetIsolate()); | 84 ExceptionState exceptionState(ExceptionState::ExecutionContext, "replaceChil
d", "Node", info.Holder(), info.GetIsolate()); |
85 Node* newChild = V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[0]); | 85 Node* newChild = V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[0]); |
86 Node* oldChild = V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[1]); | 86 Node* oldChild = V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[1]); |
87 imp->replaceChild(newChild, oldChild, exceptionState); | 87 impl->replaceChild(newChild, oldChild, exceptionState); |
88 if (exceptionState.throwIfNeeded()) | 88 if (exceptionState.throwIfNeeded()) |
89 return; | 89 return; |
90 v8SetReturnValue(info, info[1]); | 90 v8SetReturnValue(info, info[1]); |
91 } | 91 } |
92 | 92 |
93 void V8Node::removeChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) | 93 void V8Node::removeChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) |
94 { | 94 { |
95 v8::Handle<v8::Object> holder = info.Holder(); | 95 v8::Handle<v8::Object> holder = info.Holder(); |
96 Node* imp = V8Node::toNative(holder); | 96 Node* impl = V8Node::toNative(holder); |
97 | 97 |
98 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; | 98 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; |
99 | 99 |
100 ExceptionState exceptionState(ExceptionState::ExecutionContext, "removeChild
", "Node", info.Holder(), info.GetIsolate()); | 100 ExceptionState exceptionState(ExceptionState::ExecutionContext, "removeChild
", "Node", info.Holder(), info.GetIsolate()); |
101 Node* oldChild = V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[0]); | 101 Node* oldChild = V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[0]); |
102 imp->removeChild(oldChild, exceptionState); | 102 impl->removeChild(oldChild, exceptionState); |
103 if (exceptionState.throwIfNeeded()) | 103 if (exceptionState.throwIfNeeded()) |
104 return; | 104 return; |
105 v8SetReturnValue(info, info[0]); | 105 v8SetReturnValue(info, info[0]); |
106 } | 106 } |
107 | 107 |
108 void V8Node::appendChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) | 108 void V8Node::appendChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) |
109 { | 109 { |
110 v8::Handle<v8::Object> holder = info.Holder(); | 110 v8::Handle<v8::Object> holder = info.Holder(); |
111 Node* imp = V8Node::toNative(holder); | 111 Node* impl = V8Node::toNative(holder); |
112 | 112 |
113 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; | 113 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; |
114 | 114 |
115 ExceptionState exceptionState(ExceptionState::ExecutionContext, "appendChild
", "Node", info.Holder(), info.GetIsolate()); | 115 ExceptionState exceptionState(ExceptionState::ExecutionContext, "appendChild
", "Node", info.Holder(), info.GetIsolate()); |
116 Node* newChild = V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[0]); | 116 Node* newChild = V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[0]); |
117 imp->appendChild(newChild, exceptionState); | 117 impl->appendChild(newChild, exceptionState); |
118 if (exceptionState.throwIfNeeded()) | 118 if (exceptionState.throwIfNeeded()) |
119 return; | 119 return; |
120 v8SetReturnValue(info, info[0]); | 120 v8SetReturnValue(info, info[0]); |
121 } | 121 } |
122 | 122 |
123 v8::Handle<v8::Object> wrap(Node* impl, v8::Handle<v8::Object> creationContext,
v8::Isolate* isolate) | 123 v8::Handle<v8::Object> wrap(Node* impl, v8::Handle<v8::Object> creationContext,
v8::Isolate* isolate) |
124 { | 124 { |
125 ASSERT(impl); | 125 ASSERT(impl); |
126 switch (impl->nodeType()) { | 126 switch (impl->nodeType()) { |
127 case Node::ELEMENT_NODE: | 127 case Node::ELEMENT_NODE: |
(...skipping 19 matching lines...) Expand all Loading... |
147 return wrap(toDocumentType(impl), creationContext, isolate); | 147 return wrap(toDocumentType(impl), creationContext, isolate); |
148 case Node::DOCUMENT_FRAGMENT_NODE: | 148 case Node::DOCUMENT_FRAGMENT_NODE: |
149 if (impl->isShadowRoot()) | 149 if (impl->isShadowRoot()) |
150 return wrap(toShadowRoot(impl), creationContext, isolate); | 150 return wrap(toShadowRoot(impl), creationContext, isolate); |
151 return wrap(toDocumentFragment(impl), creationContext, isolate); | 151 return wrap(toDocumentFragment(impl), creationContext, isolate); |
152 } | 152 } |
153 ASSERT_NOT_REACHED(); | 153 ASSERT_NOT_REACHED(); |
154 return V8Node::createWrapper(impl, creationContext, isolate); | 154 return V8Node::createWrapper(impl, creationContext, isolate); |
155 } | 155 } |
156 } // namespace WebCore | 156 } // namespace WebCore |
OLD | NEW |