Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: Source/WebCore/dom/Node.cpp

Issue 11612021: Revert 137939 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/WebCore/dom/Document.cpp ('k') | Source/WebCore/history/CachedFrame.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
420 clearEventTargetData(); 416 clearEventTargetData();
421 }
422 417
423 if (renderer()) 418 if (renderer())
424 detach(); 419 detach();
425 420
426 Document* doc = m_document; 421 Document* doc = m_document;
427 if (AXObjectCache::accessibilityEnabled() && doc && doc->axObjectCacheExists () && !isContainerNode()) 422 if (AXObjectCache::accessibilityEnabled() && doc && doc->axObjectCacheExists () && !isContainerNode())
428 doc->axObjectCache()->remove(this); 423 doc->axObjectCache()->remove(this);
429 424
430 if (m_previous) 425 if (m_previous)
431 m_previous->setNextSibling(0); 426 m_previous->setNextSibling(0);
(...skipping 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after
2123 const EventListenerVector& wheelListeners = getEventListeners(eventNames().m ousewheelEvent); 2118 const EventListenerVector& wheelListeners = getEventListeners(eventNames().m ousewheelEvent);
2124 for (size_t i = 0; i < wheelListeners.size(); ++i) { 2119 for (size_t i = 0; i < wheelListeners.size(); ++i) {
2125 oldDocument->didRemoveWheelEventHandler(); 2120 oldDocument->didRemoveWheelEventHandler();
2126 document()->didAddWheelEventHandler(); 2121 document()->didAddWheelEventHandler();
2127 } 2122 }
2128 2123
2129 Vector<AtomicString> touchEventNames = eventNames().touchEventNames(); 2124 Vector<AtomicString> touchEventNames = eventNames().touchEventNames();
2130 for (size_t i = 0; i < touchEventNames.size(); ++i) { 2125 for (size_t i = 0; i < touchEventNames.size(); ++i) {
2131 const EventListenerVector& listeners = getEventListeners(touchEventNames [i]); 2126 const EventListenerVector& listeners = getEventListeners(touchEventNames [i]);
2132 for (size_t j = 0; j < listeners.size(); ++j) { 2127 for (size_t j = 0; j < listeners.size(); ++j) {
2133 oldDocument->didRemoveTouchEventHandler(this); 2128 oldDocument->didRemoveTouchEventHandler();
2134 document()->didAddTouchEventHandler(this); 2129 document()->didAddTouchEventHandler();
2135 } 2130 }
2136 } 2131 }
2137 2132
2138 #if ENABLE(MUTATION_OBSERVERS) 2133 #if ENABLE(MUTATION_OBSERVERS)
2139 if (Vector<OwnPtr<MutationObserverRegistration> >* registry = mutationObserv erRegistry()) { 2134 if (Vector<OwnPtr<MutationObserverRegistration> >* registry = mutationObserv erRegistry()) {
2140 for (size_t i = 0; i < registry->size(); ++i) { 2135 for (size_t i = 0; i < registry->size(); ++i) {
2141 document()->addMutationObserverTypes(registry->at(i)->mutationTypes( )); 2136 document()->addMutationObserverTypes(registry->at(i)->mutationTypes( ));
2142 } 2137 }
2143 } 2138 }
2144 2139
2145 if (HashSet<MutationObserverRegistration*>* transientRegistry = transientMut ationObserverRegistry()) { 2140 if (HashSet<MutationObserverRegistration*>* transientRegistry = transientMut ationObserverRegistry()) {
2146 for (HashSet<MutationObserverRegistration*>::iterator iter = transientRe gistry->begin(); iter != transientRegistry->end(); ++iter) { 2141 for (HashSet<MutationObserverRegistration*>::iterator iter = transientRe gistry->begin(); iter != transientRegistry->end(); ++iter) {
2147 document()->addMutationObserverTypes((*iter)->mutationTypes()); 2142 document()->addMutationObserverTypes((*iter)->mutationTypes());
2148 } 2143 }
2149 } 2144 }
2150 #endif 2145 #endif
2151 } 2146 }
2152 2147
2153 static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve ntType, PassRefPtr<EventListener> listener, bool useCapture) 2148 static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve ntType, PassRefPtr<EventListener> listener, bool useCapture)
2154 { 2149 {
2155 if (!targetNode->EventTarget::addEventListener(eventType, listener, useCaptu re)) 2150 if (!targetNode->EventTarget::addEventListener(eventType, listener, useCaptu re))
2156 return false; 2151 return false;
2157 2152
2158 if (Document* document = targetNode->document()) { 2153 if (Document* document = targetNode->document()) {
2159 document->addListenerTypeIfNeeded(eventType); 2154 document->addListenerTypeIfNeeded(eventType);
2160 if (eventType == eventNames().mousewheelEvent) 2155 if (eventType == eventNames().mousewheelEvent)
2161 document->didAddWheelEventHandler(); 2156 document->didAddWheelEventHandler();
2162 else if (eventNames().isTouchEventType(eventType)) 2157 else if (eventNames().isTouchEventType(eventType))
2163 document->didAddTouchEventHandler(targetNode); 2158 document->didAddTouchEventHandler();
2164 } 2159 }
2165 2160
2166 return true; 2161 return true;
2167 } 2162 }
2168 2163
2169 bool Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListe ner> listener, bool useCapture) 2164 bool Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListe ner> listener, bool useCapture)
2170 { 2165 {
2171 return tryAddEventListener(this, eventType, listener, useCapture); 2166 return tryAddEventListener(this, eventType, listener, useCapture);
2172 } 2167 }
2173 2168
2174 static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString& eventType, EventListener* listener, bool useCapture) 2169 static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString& eventType, EventListener* listener, bool useCapture)
2175 { 2170 {
2176 if (!targetNode->EventTarget::removeEventListener(eventType, listener, useCa pture)) 2171 if (!targetNode->EventTarget::removeEventListener(eventType, listener, useCa pture))
2177 return false; 2172 return false;
2178 2173
2179 // FIXME: Notify Document that the listener has vanished. We need to keep tr ack of a number of 2174 // FIXME: Notify Document that the listener has vanished. We need to keep tr ack of a number of
2180 // listeners for each type, not just a bool - see https://bugs.webkit.org/sh ow_bug.cgi?id=33861 2175 // listeners for each type, not just a bool - see https://bugs.webkit.org/sh ow_bug.cgi?id=33861
2181 if (Document* document = targetNode->document()) { 2176 if (Document* document = targetNode->document()) {
2182 if (eventType == eventNames().mousewheelEvent) 2177 if (eventType == eventNames().mousewheelEvent)
2183 document->didRemoveWheelEventHandler(); 2178 document->didRemoveWheelEventHandler();
2184 else if (eventNames().isTouchEventType(eventType)) 2179 else if (eventNames().isTouchEventType(eventType))
2185 document->didRemoveTouchEventHandler(targetNode); 2180 document->didRemoveTouchEventHandler();
2186 } 2181 }
2187 2182
2188 return true; 2183 return true;
2189 } 2184 }
2190 2185
2191 bool Node::removeEventListener(const AtomicString& eventType, EventListener* lis tener, bool useCapture) 2186 bool Node::removeEventListener(const AtomicString& eventType, EventListener* lis tener, bool useCapture)
2192 { 2187 {
2193 return tryRemoveEventListener(this, eventType, listener, useCapture); 2188 return tryRemoveEventListener(this, eventType, listener, useCapture);
2194 } 2189 }
2195 2190
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
2697 node->showTreeForThis(); 2692 node->showTreeForThis();
2698 } 2693 }
2699 2694
2700 void showNodePath(const WebCore::Node* node) 2695 void showNodePath(const WebCore::Node* node)
2701 { 2696 {
2702 if (node) 2697 if (node)
2703 node->showNodePathForThis(); 2698 node->showNodePathForThis();
2704 } 2699 }
2705 2700
2706 #endif 2701 #endif
OLDNEW
« no previous file with comments | « Source/WebCore/dom/Document.cpp ('k') | Source/WebCore/history/CachedFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698