OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 return m_private->isContentEditable(); | 173 return m_private->isContentEditable(); |
174 } | 174 } |
175 | 175 |
176 bool WebNode::isElementNode() const | 176 bool WebNode::isElementNode() const |
177 { | 177 { |
178 return m_private->isElementNode(); | 178 return m_private->isElementNode(); |
179 } | 179 } |
180 | 180 |
181 bool WebNode::hasEventListeners(const WebString& eventType) const | 181 bool WebNode::hasEventListeners(const WebString& eventType) const |
182 { | 182 { |
| 183 // FIXME: "permissionrequest" seems like an implementation detail of the |
| 184 // the browser plug-in. Perhaps the browser plug-in should have |
| 185 // a more special-purpose mechanism? |
| 186 // See http://code.google.com/p/chromium/issues/detail?id=189561 |
| 187 |
| 188 // Please do not add more eventTypes to this list without an API review. |
| 189 RELEASE_ASSERT(eventType == "permissionrequest"); |
183 return m_private->hasEventListeners(eventType); | 190 return m_private->hasEventListeners(eventType); |
184 } | 191 } |
185 | 192 |
186 void WebNode::addEventListener(const WebString& eventType, WebDOMEventListener*
listener, bool useCapture) | 193 void WebNode::addEventListener(const WebString& eventType, WebDOMEventListener*
listener, bool useCapture) |
187 { | 194 { |
188 EventListenerWrapper* listenerWrapper = | 195 // Please do not add more eventTypes to this list without an API review. |
189 listener->createEventListenerWrapper(eventType, useCapture, m_private.ge
t()); | 196 RELEASE_ASSERT(eventType == "mousedown"); |
| 197 |
| 198 EventListenerWrapper* listenerWrapper = listener->createEventListenerWrapper
(eventType, useCapture, m_private.get()); |
190 // The listenerWrapper is only referenced by the actual Node. Once it goes | 199 // The listenerWrapper is only referenced by the actual Node. Once it goes |
191 // away, the wrapper notifies the WebEventListener so it can clear its | 200 // away, the wrapper notifies the WebEventListener so it can clear its |
192 // pointer to it. | 201 // pointer to it. |
193 m_private->addEventListener(eventType, adoptRef(listenerWrapper), useCapture
); | 202 m_private->addEventListener(eventType, adoptRef(listenerWrapper), useCapture
); |
194 } | 203 } |
195 | 204 |
196 void WebNode::removeEventListener(const WebString& eventType, WebDOMEventListene
r* listener, bool useCapture) | |
197 { | |
198 EventListenerWrapper* listenerWrapper = | |
199 listener->getEventListenerWrapper(eventType, useCapture, m_private.get()
); | |
200 m_private->removeEventListener(eventType, listenerWrapper, useCapture); | |
201 // listenerWrapper is now deleted. | |
202 } | |
203 | |
204 bool WebNode::dispatchEvent(const WebDOMEvent& event) | 205 bool WebNode::dispatchEvent(const WebDOMEvent& event) |
205 { | 206 { |
206 if (!event.isNull()) | 207 if (!event.isNull()) |
207 return m_private->dispatchEvent(event); | 208 return m_private->dispatchEvent(event); |
208 return false; | 209 return false; |
209 } | 210 } |
210 | 211 |
211 void WebNode::simulateClick() | 212 void WebNode::simulateClick() |
212 { | 213 { |
213 m_private->dispatchSimulatedClick(0); | 214 m_private->dispatchSimulatedClick(0); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 m_private = node; | 281 m_private = node; |
281 return *this; | 282 return *this; |
282 } | 283 } |
283 | 284 |
284 WebNode::operator PassRefPtr<Node>() const | 285 WebNode::operator PassRefPtr<Node>() const |
285 { | 286 { |
286 return m_private.get(); | 287 return m_private.get(); |
287 } | 288 } |
288 | 289 |
289 } // namespace WebKit | 290 } // namespace WebKit |
OLD | NEW |