OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 10 matching lines...) Expand all Loading... |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "JSEventTarget.h" | 27 #include "JSEventTarget.h" |
28 | 28 |
29 #include "Document.h" | 29 #include "Document.h" |
30 #include "JSEventListener.h" | 30 #include "JSEventListener.h" |
| 31 #include "JSEventTargetNode.h" |
31 #include "JSMessagePort.h" | 32 #include "JSMessagePort.h" |
32 #include "JSNode.h" | 33 #include "JSWorker.h" |
33 #include "JSXMLHttpRequest.h" | 34 #include "JSWorkerContext.h" |
34 #include "JSXMLHttpRequestUpload.h" | 35 #include "JSXMLHttpRequestUpload.h" |
35 #include "MessagePort.h" | 36 #include "Worker.h" |
36 #include "XMLHttpRequest.h" | 37 #include "WorkerContext.h" |
37 #include "XMLHttpRequestUpload.h" | |
38 | |
39 #if ENABLE(OFFLINE_WEB_APPLICATIONS) | |
40 #include "DOMApplicationCache.h" | |
41 #include "JSDOMApplicationCache.h" | |
42 #endif | |
43 | 38 |
44 #if ENABLE(SVG) | 39 #if ENABLE(SVG) |
45 #include "SVGElementInstance.h" | 40 #include "SVGElementInstance.h" |
46 #include "JSSVGElementInstance.h" | 41 #include "JSSVGElementInstance.h" |
47 #endif | 42 #endif |
48 | 43 |
49 #if ENABLE(WORKERS) | |
50 #include "JSWorker.h" | |
51 #include "JSWorkerContext.h" | |
52 #include "Worker.h" | |
53 #include "WorkerContext.h" | |
54 #endif | |
55 | |
56 using namespace JSC; | 44 using namespace JSC; |
57 | 45 |
58 namespace WebCore { | 46 namespace WebCore { |
59 | 47 |
60 JSValuePtr toJS(ExecState* exec, EventTarget* target) | 48 JSValuePtr toJS(ExecState* exec, EventTarget* target) |
61 { | 49 { |
62 if (!target) | 50 if (!target) |
63 return jsNull(); | 51 return jsNull(); |
64 | 52 |
65 #if ENABLE(SVG) | 53 #if ENABLE(SVG) |
(...skipping 26 matching lines...) Expand all Loading... |
92 return toJS(exec, worker); | 80 return toJS(exec, worker); |
93 | 81 |
94 if (WorkerContext* workerContext = target->toWorkerContext()) | 82 if (WorkerContext* workerContext = target->toWorkerContext()) |
95 return toJSDOMGlobalObject(workerContext); | 83 return toJSDOMGlobalObject(workerContext); |
96 #endif | 84 #endif |
97 | 85 |
98 ASSERT_NOT_REACHED(); | 86 ASSERT_NOT_REACHED(); |
99 return jsNull(); | 87 return jsNull(); |
100 } | 88 } |
101 | 89 |
102 EventTarget* toEventTarget(JSC::JSValuePtr value) | |
103 { | |
104 #define CONVERT_TO_EVENT_TARGET(type) \ | |
105 if (value.isObject(&JS##type::s_info)) \ | |
106 return static_cast<JS##type*>(asObject(value))->impl(); | |
107 | |
108 CONVERT_TO_EVENT_TARGET(Node) | |
109 CONVERT_TO_EVENT_TARGET(XMLHttpRequest) | |
110 CONVERT_TO_EVENT_TARGET(XMLHttpRequestUpload) | |
111 CONVERT_TO_EVENT_TARGET(MessagePort) | |
112 | |
113 #if ENABLE(OFFLINE_WEB_APPLICATIONS) | |
114 CONVERT_TO_EVENT_TARGET(DOMApplicationCache) | |
115 #endif | |
116 | |
117 #if ENABLE(SVG) | |
118 CONVERT_TO_EVENT_TARGET(SVGElementInstance) | |
119 #endif | |
120 | |
121 #if ENABLE(WORKERS) | |
122 CONVERT_TO_EVENT_TARGET(Worker) | |
123 CONVERT_TO_EVENT_TARGET(WorkerContext) | |
124 #endif | |
125 | |
126 return 0; | |
127 } | |
128 | |
129 } // namespace WebCore | 90 } // namespace WebCore |
130 | 91 |
131 | 92 |
OLD | NEW |