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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 // With Oilpan all of this is handled with weak processing of the document. | 313 // With Oilpan all of this is handled with weak processing of the document. |
314 void Node::willBeDeletedFromDocument() | 314 void Node::willBeDeletedFromDocument() |
315 { | 315 { |
316 if (!isTreeScopeInitialized()) | 316 if (!isTreeScopeInitialized()) |
317 return; | 317 return; |
318 | 318 |
319 Document& document = this->document(); | 319 Document& document = this->document(); |
320 | 320 |
321 if (hasEventTargetData()) { | 321 if (hasEventTargetData()) { |
322 clearEventTargetData(); | 322 clearEventTargetData(); |
323 document.didClearTouchEventHandlers(this); | |
324 if (document.frameHost()) | 323 if (document.frameHost()) |
325 document.frameHost()->eventHandlerRegistry().didRemoveAllEventHandle
rs(*this); | 324 document.frameHost()->eventHandlerRegistry().didRemoveAllEventHandle
rs(*this); |
326 } | 325 } |
327 | 326 |
328 if (AXObjectCache* cache = document.existingAXObjectCache()) | 327 if (AXObjectCache* cache = document.existingAXObjectCache()) |
329 cache->remove(this); | 328 cache->remove(this); |
330 | 329 |
331 document.markers().removeMarkers(this); | 330 document.markers().removeMarkers(this); |
332 } | 331 } |
333 #endif | 332 #endif |
(...skipping 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1933 } | 1932 } |
1934 } | 1933 } |
1935 | 1934 |
1936 if (AXObjectCache::accessibilityEnabled()) { | 1935 if (AXObjectCache::accessibilityEnabled()) { |
1937 if (AXObjectCache* cache = oldDocument.existingAXObjectCache()) | 1936 if (AXObjectCache* cache = oldDocument.existingAXObjectCache()) |
1938 cache->remove(this); | 1937 cache->remove(this); |
1939 } | 1938 } |
1940 | 1939 |
1941 oldDocument.markers().removeMarkers(this); | 1940 oldDocument.markers().removeMarkers(this); |
1942 oldDocument.updateRangesAfterNodeMovedToAnotherDocument(*this); | 1941 oldDocument.updateRangesAfterNodeMovedToAnotherDocument(*this); |
1943 | 1942 if (oldDocument.frameHost() && !document().frameHost()) |
1944 if (const TouchEventTargetSet* touchHandlers = oldDocument.touchEventTargets
()) { | 1943 oldDocument.frameHost()->eventHandlerRegistry().didMoveOutOfFrameHost(*t
his); |
1945 while (touchHandlers->contains(this)) { | 1944 else if (document().frameHost() && !oldDocument.frameHost()) |
1946 oldDocument.didRemoveTouchEventHandler(this); | 1945 document().frameHost()->eventHandlerRegistry().didMoveIntoFrameHost(*thi
s); |
1947 document().didAddTouchEventHandler(this); | 1946 else if (oldDocument.frameHost() != document().frameHost()) |
1948 } | 1947 EventHandlerRegistry::didMoveBetweenFrameHosts(*this, oldDocument.frameH
ost(), document().frameHost()); |
1949 } | |
1950 if (oldDocument.frameHost() != document().frameHost()) { | |
1951 if (oldDocument.frameHost()) | |
1952 oldDocument.frameHost()->eventHandlerRegistry().didMoveOutOfFrameHos
t(*this); | |
1953 if (document().frameHost()) | |
1954 document().frameHost()->eventHandlerRegistry().didMoveIntoFrameHost(
*this); | |
1955 } | |
1956 | 1948 |
1957 if (WillBeHeapVector<OwnPtrWillBeMember<MutationObserverRegistration> >* reg
istry = mutationObserverRegistry()) { | 1949 if (WillBeHeapVector<OwnPtrWillBeMember<MutationObserverRegistration> >* reg
istry = mutationObserverRegistry()) { |
1958 for (size_t i = 0; i < registry->size(); ++i) { | 1950 for (size_t i = 0; i < registry->size(); ++i) { |
1959 document().addMutationObserverTypes(registry->at(i)->mutationTypes()
); | 1951 document().addMutationObserverTypes(registry->at(i)->mutationTypes()
); |
1960 } | 1952 } |
1961 } | 1953 } |
1962 | 1954 |
1963 if (WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration> >* tr
ansientRegistry = transientMutationObserverRegistry()) { | 1955 if (WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration> >* tr
ansientRegistry = transientMutationObserverRegistry()) { |
1964 for (WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration>
>::iterator iter = transientRegistry->begin(); iter != transientRegistry->end();
++iter) { | 1956 for (WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration>
>::iterator iter = transientRegistry->begin(); iter != transientRegistry->end();
++iter) { |
1965 document().addMutationObserverTypes((*iter)->mutationTypes()); | 1957 document().addMutationObserverTypes((*iter)->mutationTypes()); |
1966 } | 1958 } |
1967 } | 1959 } |
1968 } | 1960 } |
1969 | 1961 |
1970 static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve
ntType, PassRefPtr<EventListener> listener, bool useCapture) | 1962 static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve
ntType, PassRefPtr<EventListener> listener, bool useCapture) |
1971 { | 1963 { |
1972 if (!targetNode->EventTarget::addEventListener(eventType, listener, useCaptu
re)) | 1964 if (!targetNode->EventTarget::addEventListener(eventType, listener, useCaptu
re)) |
1973 return false; | 1965 return false; |
1974 | 1966 |
1975 Document& document = targetNode->document(); | 1967 Document& document = targetNode->document(); |
1976 document.addListenerTypeIfNeeded(eventType); | 1968 document.addListenerTypeIfNeeded(eventType); |
1977 if (isTouchEventType(eventType)) | |
1978 document.didAddTouchEventHandler(targetNode); | |
1979 if (document.frameHost()) | 1969 if (document.frameHost()) |
1980 document.frameHost()->eventHandlerRegistry().didAddEventHandler(*targetN
ode, eventType); | 1970 document.frameHost()->eventHandlerRegistry().didAddEventHandler(*targetN
ode, eventType); |
1981 | 1971 |
1982 return true; | 1972 return true; |
1983 } | 1973 } |
1984 | 1974 |
1985 bool Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListe
ner> listener, bool useCapture) | 1975 bool Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListe
ner> listener, bool useCapture) |
1986 { | 1976 { |
1987 return tryAddEventListener(this, eventType, listener, useCapture); | 1977 return tryAddEventListener(this, eventType, listener, useCapture); |
1988 } | 1978 } |
1989 | 1979 |
1990 static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString&
eventType, EventListener* listener, bool useCapture) | 1980 static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString&
eventType, EventListener* listener, bool useCapture) |
1991 { | 1981 { |
1992 if (!targetNode->EventTarget::removeEventListener(eventType, listener, useCa
pture)) | 1982 if (!targetNode->EventTarget::removeEventListener(eventType, listener, useCa
pture)) |
1993 return false; | 1983 return false; |
1994 | 1984 |
1995 // FIXME: Notify Document that the listener has vanished. We need to keep tr
ack of a number of | 1985 // FIXME: Notify Document that the listener has vanished. We need to keep tr
ack of a number of |
1996 // listeners for each type, not just a bool - see https://bugs.webkit.org/sh
ow_bug.cgi?id=33861 | 1986 // listeners for each type, not just a bool - see https://bugs.webkit.org/sh
ow_bug.cgi?id=33861 |
1997 Document& document = targetNode->document(); | 1987 Document& document = targetNode->document(); |
1998 if (isTouchEventType(eventType)) | |
1999 document.didRemoveTouchEventHandler(targetNode); | |
2000 if (document.frameHost()) | 1988 if (document.frameHost()) |
2001 document.frameHost()->eventHandlerRegistry().didRemoveEventHandler(*targ
etNode, eventType); | 1989 document.frameHost()->eventHandlerRegistry().didRemoveEventHandler(*targ
etNode, eventType); |
2002 | 1990 |
2003 return true; | 1991 return true; |
2004 } | 1992 } |
2005 | 1993 |
2006 bool Node::removeEventListener(const AtomicString& eventType, EventListener* lis
tener, bool useCapture) | 1994 bool Node::removeEventListener(const AtomicString& eventType, EventListener* lis
tener, bool useCapture) |
2007 { | 1995 { |
2008 return tryRemoveEventListener(this, eventType, listener, useCapture); | 1996 return tryRemoveEventListener(this, eventType, listener, useCapture); |
2009 } | 1997 } |
2010 | 1998 |
2011 void Node::removeAllEventListeners() | 1999 void Node::removeAllEventListeners() |
2012 { | 2000 { |
2013 if (hasEventListeners() && document().frameHost()) | 2001 if (hasEventListeners() && document().frameHost()) |
2014 document().frameHost()->eventHandlerRegistry().didRemoveAllEventHandlers
(*this); | 2002 document().frameHost()->eventHandlerRegistry().didRemoveAllEventHandlers
(*this); |
2015 EventTarget::removeAllEventListeners(); | 2003 EventTarget::removeAllEventListeners(); |
2016 document().didClearTouchEventHandlers(this); | |
2017 } | 2004 } |
2018 | 2005 |
2019 void Node::removeAllEventListenersRecursively() | 2006 void Node::removeAllEventListenersRecursively() |
2020 { | 2007 { |
2021 for (Node* node = this; node; node = NodeTraversal::next(*node)) { | 2008 for (Node* node = this; node; node = NodeTraversal::next(*node)) { |
2022 node->removeAllEventListeners(); | 2009 node->removeAllEventListeners(); |
2023 for (ShadowRoot* root = node->youngestShadowRoot(); root; root = root->o
lderShadowRoot()) | 2010 for (ShadowRoot* root = node->youngestShadowRoot(); root; root = root->o
lderShadowRoot()) |
2024 root->removeAllEventListenersRecursively(); | 2011 root->removeAllEventListenersRecursively(); |
2025 } | 2012 } |
2026 } | 2013 } |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2567 node->showTreeForThis(); | 2554 node->showTreeForThis(); |
2568 } | 2555 } |
2569 | 2556 |
2570 void showNodePath(const WebCore::Node* node) | 2557 void showNodePath(const WebCore::Node* node) |
2571 { | 2558 { |
2572 if (node) | 2559 if (node) |
2573 node->showNodePathForThis(); | 2560 node->showNodePathForThis(); |
2574 } | 2561 } |
2575 | 2562 |
2576 #endif | 2563 #endif |
OLD | NEW |