| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
| 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 nodeCounter.decrement(); | 405 nodeCounter.decrement(); |
| 406 #endif | 406 #endif |
| 407 | 407 |
| 408 #if DUMP_NODE_STATISTICS | 408 #if DUMP_NODE_STATISTICS |
| 409 liveNodeSet.remove(this); | 409 liveNodeSet.remove(this); |
| 410 #endif | 410 #endif |
| 411 | 411 |
| 412 if (hasRareData()) | 412 if (hasRareData()) |
| 413 clearRareData(); | 413 clearRareData(); |
| 414 | 414 |
| 415 if (hasEventTargetData()) | 415 if (hasEventTargetData()) { |
| 416 #if ENABLE(TOUCH_EVENT_TRACKING) |
| 417 if (m_document) |
| 418 m_document->didRemoveEventTargetNode(this); |
| 419 #endif |
| 416 clearEventTargetData(); | 420 clearEventTargetData(); |
| 421 } |
| 417 | 422 |
| 418 if (renderer()) | 423 if (renderer()) |
| 419 detach(); | 424 detach(); |
| 420 | 425 |
| 421 Document* doc = m_document; | 426 Document* doc = m_document; |
| 422 if (AXObjectCache::accessibilityEnabled() && doc && doc->axObjectCacheExists
() && !isContainerNode()) | 427 if (AXObjectCache::accessibilityEnabled() && doc && doc->axObjectCacheExists
() && !isContainerNode()) |
| 423 doc->axObjectCache()->remove(this); | 428 doc->axObjectCache()->remove(this); |
| 424 | 429 |
| 425 if (m_previous) | 430 if (m_previous) |
| 426 m_previous->setNextSibling(0); | 431 m_previous->setNextSibling(0); |
| (...skipping 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2118 const EventListenerVector& wheelListeners = getEventListeners(eventNames().m
ousewheelEvent); | 2123 const EventListenerVector& wheelListeners = getEventListeners(eventNames().m
ousewheelEvent); |
| 2119 for (size_t i = 0; i < wheelListeners.size(); ++i) { | 2124 for (size_t i = 0; i < wheelListeners.size(); ++i) { |
| 2120 oldDocument->didRemoveWheelEventHandler(); | 2125 oldDocument->didRemoveWheelEventHandler(); |
| 2121 document()->didAddWheelEventHandler(); | 2126 document()->didAddWheelEventHandler(); |
| 2122 } | 2127 } |
| 2123 | 2128 |
| 2124 Vector<AtomicString> touchEventNames = eventNames().touchEventNames(); | 2129 Vector<AtomicString> touchEventNames = eventNames().touchEventNames(); |
| 2125 for (size_t i = 0; i < touchEventNames.size(); ++i) { | 2130 for (size_t i = 0; i < touchEventNames.size(); ++i) { |
| 2126 const EventListenerVector& listeners = getEventListeners(touchEventNames
[i]); | 2131 const EventListenerVector& listeners = getEventListeners(touchEventNames
[i]); |
| 2127 for (size_t j = 0; j < listeners.size(); ++j) { | 2132 for (size_t j = 0; j < listeners.size(); ++j) { |
| 2128 oldDocument->didRemoveTouchEventHandler(); | 2133 oldDocument->didRemoveTouchEventHandler(this); |
| 2129 document()->didAddTouchEventHandler(); | 2134 document()->didAddTouchEventHandler(this); |
| 2130 } | 2135 } |
| 2131 } | 2136 } |
| 2132 | 2137 |
| 2133 #if ENABLE(MUTATION_OBSERVERS) | 2138 #if ENABLE(MUTATION_OBSERVERS) |
| 2134 if (Vector<OwnPtr<MutationObserverRegistration> >* registry = mutationObserv
erRegistry()) { | 2139 if (Vector<OwnPtr<MutationObserverRegistration> >* registry = mutationObserv
erRegistry()) { |
| 2135 for (size_t i = 0; i < registry->size(); ++i) { | 2140 for (size_t i = 0; i < registry->size(); ++i) { |
| 2136 document()->addMutationObserverTypes(registry->at(i)->mutationTypes(
)); | 2141 document()->addMutationObserverTypes(registry->at(i)->mutationTypes(
)); |
| 2137 } | 2142 } |
| 2138 } | 2143 } |
| 2139 | 2144 |
| 2140 if (HashSet<MutationObserverRegistration*>* transientRegistry = transientMut
ationObserverRegistry()) { | 2145 if (HashSet<MutationObserverRegistration*>* transientRegistry = transientMut
ationObserverRegistry()) { |
| 2141 for (HashSet<MutationObserverRegistration*>::iterator iter = transientRe
gistry->begin(); iter != transientRegistry->end(); ++iter) { | 2146 for (HashSet<MutationObserverRegistration*>::iterator iter = transientRe
gistry->begin(); iter != transientRegistry->end(); ++iter) { |
| 2142 document()->addMutationObserverTypes((*iter)->mutationTypes()); | 2147 document()->addMutationObserverTypes((*iter)->mutationTypes()); |
| 2143 } | 2148 } |
| 2144 } | 2149 } |
| 2145 #endif | 2150 #endif |
| 2146 } | 2151 } |
| 2147 | 2152 |
| 2148 static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve
ntType, PassRefPtr<EventListener> listener, bool useCapture) | 2153 static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve
ntType, PassRefPtr<EventListener> listener, bool useCapture) |
| 2149 { | 2154 { |
| 2150 if (!targetNode->EventTarget::addEventListener(eventType, listener, useCaptu
re)) | 2155 if (!targetNode->EventTarget::addEventListener(eventType, listener, useCaptu
re)) |
| 2151 return false; | 2156 return false; |
| 2152 | 2157 |
| 2153 if (Document* document = targetNode->document()) { | 2158 if (Document* document = targetNode->document()) { |
| 2154 document->addListenerTypeIfNeeded(eventType); | 2159 document->addListenerTypeIfNeeded(eventType); |
| 2155 if (eventType == eventNames().mousewheelEvent) | 2160 if (eventType == eventNames().mousewheelEvent) |
| 2156 document->didAddWheelEventHandler(); | 2161 document->didAddWheelEventHandler(); |
| 2157 else if (eventNames().isTouchEventType(eventType)) | 2162 else if (eventNames().isTouchEventType(eventType)) |
| 2158 document->didAddTouchEventHandler(); | 2163 document->didAddTouchEventHandler(targetNode); |
| 2159 } | 2164 } |
| 2160 | 2165 |
| 2161 return true; | 2166 return true; |
| 2162 } | 2167 } |
| 2163 | 2168 |
| 2164 bool Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListe
ner> listener, bool useCapture) | 2169 bool Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListe
ner> listener, bool useCapture) |
| 2165 { | 2170 { |
| 2166 return tryAddEventListener(this, eventType, listener, useCapture); | 2171 return tryAddEventListener(this, eventType, listener, useCapture); |
| 2167 } | 2172 } |
| 2168 | 2173 |
| 2169 static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString&
eventType, EventListener* listener, bool useCapture) | 2174 static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString&
eventType, EventListener* listener, bool useCapture) |
| 2170 { | 2175 { |
| 2171 if (!targetNode->EventTarget::removeEventListener(eventType, listener, useCa
pture)) | 2176 if (!targetNode->EventTarget::removeEventListener(eventType, listener, useCa
pture)) |
| 2172 return false; | 2177 return false; |
| 2173 | 2178 |
| 2174 // FIXME: Notify Document that the listener has vanished. We need to keep tr
ack of a number of | 2179 // FIXME: Notify Document that the listener has vanished. We need to keep tr
ack of a number of |
| 2175 // listeners for each type, not just a bool - see https://bugs.webkit.org/sh
ow_bug.cgi?id=33861 | 2180 // listeners for each type, not just a bool - see https://bugs.webkit.org/sh
ow_bug.cgi?id=33861 |
| 2176 if (Document* document = targetNode->document()) { | 2181 if (Document* document = targetNode->document()) { |
| 2177 if (eventType == eventNames().mousewheelEvent) | 2182 if (eventType == eventNames().mousewheelEvent) |
| 2178 document->didRemoveWheelEventHandler(); | 2183 document->didRemoveWheelEventHandler(); |
| 2179 else if (eventNames().isTouchEventType(eventType)) | 2184 else if (eventNames().isTouchEventType(eventType)) |
| 2180 document->didRemoveTouchEventHandler(); | 2185 document->didRemoveTouchEventHandler(targetNode); |
| 2181 } | 2186 } |
| 2182 | 2187 |
| 2183 return true; | 2188 return true; |
| 2184 } | 2189 } |
| 2185 | 2190 |
| 2186 bool Node::removeEventListener(const AtomicString& eventType, EventListener* lis
tener, bool useCapture) | 2191 bool Node::removeEventListener(const AtomicString& eventType, EventListener* lis
tener, bool useCapture) |
| 2187 { | 2192 { |
| 2188 return tryRemoveEventListener(this, eventType, listener, useCapture); | 2193 return tryRemoveEventListener(this, eventType, listener, useCapture); |
| 2189 } | 2194 } |
| 2190 | 2195 |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2692 node->showTreeForThis(); | 2697 node->showTreeForThis(); |
| 2693 } | 2698 } |
| 2694 | 2699 |
| 2695 void showNodePath(const WebCore::Node* node) | 2700 void showNodePath(const WebCore::Node* node) |
| 2696 { | 2701 { |
| 2697 if (node) | 2702 if (node) |
| 2698 node->showNodePathForThis(); | 2703 node->showNodePathForThis(); |
| 2699 } | 2704 } |
| 2700 | 2705 |
| 2701 #endif | 2706 #endif |
| OLD | NEW |