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 25 matching lines...) Expand all Loading... |
36 #include "V8Comment.h" | 36 #include "V8Comment.h" |
37 #include "V8Document.h" | 37 #include "V8Document.h" |
38 #include "V8DocumentFragment.h" | 38 #include "V8DocumentFragment.h" |
39 #include "V8DocumentType.h" | 39 #include "V8DocumentType.h" |
40 #include "V8Element.h" | 40 #include "V8Element.h" |
41 #include "V8Entity.h" | 41 #include "V8Entity.h" |
42 #include "V8HTMLElement.h" | 42 #include "V8HTMLElement.h" |
43 #include "V8Node.h" | 43 #include "V8Node.h" |
44 #include "V8Notation.h" | 44 #include "V8Notation.h" |
45 #include "V8ProcessingInstruction.h" | 45 #include "V8ProcessingInstruction.h" |
| 46 #include "V8SVGElement.h" |
46 #include "V8ShadowRoot.h" | 47 #include "V8ShadowRoot.h" |
47 #include "V8Text.h" | 48 #include "V8Text.h" |
48 #include "bindings/v8/V8AbstractEventListener.h" | 49 #include "bindings/v8/V8AbstractEventListener.h" |
49 #include "bindings/v8/V8Binding.h" | 50 #include "bindings/v8/V8Binding.h" |
50 #include "bindings/v8/V8EventListener.h" | 51 #include "bindings/v8/V8EventListener.h" |
51 #include "core/dom/Document.h" | 52 #include "core/dom/Document.h" |
52 #include "core/dom/EventListener.h" | 53 #include "core/dom/EventListener.h" |
53 #include "core/dom/shadow/ShadowRoot.h" | 54 #include "core/dom/shadow/ShadowRoot.h" |
54 #include "wtf/RefPtr.h" | 55 #include "wtf/RefPtr.h" |
55 | 56 |
56 #if ENABLE(SVG) | |
57 #include "V8SVGElement.h" | |
58 #endif | |
59 | |
60 namespace WebCore { | 57 namespace WebCore { |
61 | 58 |
62 // This function is customized to take advantage of the optional 4th argument: A
ttachBehavior | 59 // This function is customized to take advantage of the optional 4th argument: A
ttachBehavior |
63 v8::Handle<v8::Value> V8Node::insertBeforeMethodCustom(const v8::Arguments& args
) | 60 v8::Handle<v8::Value> V8Node::insertBeforeMethodCustom(const v8::Arguments& args
) |
64 { | 61 { |
65 v8::Handle<v8::Object> holder = args.Holder(); | 62 v8::Handle<v8::Object> holder = args.Holder(); |
66 Node* imp = V8Node::toNative(holder); | 63 Node* imp = V8Node::toNative(holder); |
67 ExceptionCode ec = 0; | 64 ExceptionCode ec = 0; |
68 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a
rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0
; | 65 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a
rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0
; |
69 Node* refChild = V8Node::HasInstance(args[1], args.GetIsolate(), worldType(a
rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0
; | 66 Node* refChild = V8Node::HasInstance(args[1], args.GetIsolate(), worldType(a
rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0
; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 } | 118 } |
122 | 119 |
123 v8::Handle<v8::Object> wrap(Node* impl, v8::Handle<v8::Object> creationContext,
v8::Isolate* isolate) | 120 v8::Handle<v8::Object> wrap(Node* impl, v8::Handle<v8::Object> creationContext,
v8::Isolate* isolate) |
124 { | 121 { |
125 ASSERT(impl); | 122 ASSERT(impl); |
126 switch (impl->nodeType()) { | 123 switch (impl->nodeType()) { |
127 case Node::ELEMENT_NODE: | 124 case Node::ELEMENT_NODE: |
128 // For performance reasons, this is inlined from V8Element::wrap and mus
t remain in sync. | 125 // For performance reasons, this is inlined from V8Element::wrap and mus
t remain in sync. |
129 if (impl->isHTMLElement()) | 126 if (impl->isHTMLElement()) |
130 return wrap(toHTMLElement(impl), creationContext, isolate); | 127 return wrap(toHTMLElement(impl), creationContext, isolate); |
131 #if ENABLE(SVG) | |
132 if (impl->isSVGElement()) | 128 if (impl->isSVGElement()) |
133 return wrap(toSVGElement(impl), creationContext, isolate); | 129 return wrap(toSVGElement(impl), creationContext, isolate); |
134 #endif | |
135 return V8Element::createWrapper(toElement(impl), creationContext, isolat
e); | 130 return V8Element::createWrapper(toElement(impl), creationContext, isolat
e); |
136 case Node::ATTRIBUTE_NODE: | 131 case Node::ATTRIBUTE_NODE: |
137 return wrap(static_cast<Attr*>(impl), creationContext, isolate); | 132 return wrap(static_cast<Attr*>(impl), creationContext, isolate); |
138 case Node::TEXT_NODE: | 133 case Node::TEXT_NODE: |
139 return wrap(toText(impl), creationContext, isolate); | 134 return wrap(toText(impl), creationContext, isolate); |
140 case Node::CDATA_SECTION_NODE: | 135 case Node::CDATA_SECTION_NODE: |
141 return wrap(static_cast<CDATASection*>(impl), creationContext, isolate); | 136 return wrap(static_cast<CDATASection*>(impl), creationContext, isolate); |
142 case Node::ENTITY_NODE: | 137 case Node::ENTITY_NODE: |
143 return wrap(static_cast<Entity*>(impl), creationContext, isolate); | 138 return wrap(static_cast<Entity*>(impl), creationContext, isolate); |
144 case Node::PROCESSING_INSTRUCTION_NODE: | 139 case Node::PROCESSING_INSTRUCTION_NODE: |
145 return wrap(static_cast<ProcessingInstruction*>(impl), creationContext,
isolate); | 140 return wrap(static_cast<ProcessingInstruction*>(impl), creationContext,
isolate); |
146 case Node::COMMENT_NODE: | 141 case Node::COMMENT_NODE: |
147 return wrap(static_cast<Comment*>(impl), creationContext, isolate); | 142 return wrap(static_cast<Comment*>(impl), creationContext, isolate); |
148 case Node::DOCUMENT_NODE: | 143 case Node::DOCUMENT_NODE: |
149 return wrap(toDocument(impl), creationContext, isolate); | 144 return wrap(toDocument(impl), creationContext, isolate); |
150 case Node::DOCUMENT_TYPE_NODE: | 145 case Node::DOCUMENT_TYPE_NODE: |
151 return wrap(static_cast<DocumentType*>(impl), creationContext, isolate); | 146 return wrap(static_cast<DocumentType*>(impl), creationContext, isolate); |
152 case Node::DOCUMENT_FRAGMENT_NODE: | 147 case Node::DOCUMENT_FRAGMENT_NODE: |
153 if (impl->isShadowRoot()) | 148 if (impl->isShadowRoot()) |
154 return wrap(toShadowRoot(impl), creationContext, isolate); | 149 return wrap(toShadowRoot(impl), creationContext, isolate); |
155 return wrap(static_cast<DocumentFragment*>(impl), creationContext, isola
te); | 150 return wrap(static_cast<DocumentFragment*>(impl), creationContext, isola
te); |
156 case Node::NOTATION_NODE: | 151 case Node::NOTATION_NODE: |
157 return wrap(static_cast<Notation*>(impl), creationContext, isolate); | 152 return wrap(static_cast<Notation*>(impl), creationContext, isolate); |
158 default: | 153 default: |
159 break; // ENTITY_REFERENCE_NODE or XPATH_NAMESPACE_NODE | 154 break; // ENTITY_REFERENCE_NODE or XPATH_NAMESPACE_NODE |
160 } | 155 } |
161 return V8Node::createWrapper(impl, creationContext, isolate); | 156 return V8Node::createWrapper(impl, creationContext, isolate); |
162 } | 157 } |
163 } // namespace WebCore | 158 } // namespace WebCore |
OLD | NEW |