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 | 1941 |
1943 | 1942 if (oldDocument.frameHost() != document().frameHost()) |
Rick Byers
2014/06/19 17:10:36
Since the boundary of interest has moved from fram
Sami
2014/06/27 17:58:51
Yes, actually the previous CLs for scroll and mous
Rick Byers
2014/06/27 21:36:51
SGTM, thanks.
| |
1944 if (const TouchEventTargetSet* touchHandlers = oldDocument.touchEventTargets ()) { | 1943 EventHandlerRegistry::didMoveBetweenFrameHosts(*this, oldDocument.frameH ost(), document().frameHost()); |
1945 while (touchHandlers->contains(this)) { | |
1946 oldDocument.didRemoveTouchEventHandler(this); | |
1947 document().didAddTouchEventHandler(this); | |
1948 } | |
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 | 1944 |
1957 if (WillBeHeapVector<OwnPtrWillBeMember<MutationObserverRegistration> >* reg istry = mutationObserverRegistry()) { | 1945 if (WillBeHeapVector<OwnPtrWillBeMember<MutationObserverRegistration> >* reg istry = mutationObserverRegistry()) { |
1958 for (size_t i = 0; i < registry->size(); ++i) { | 1946 for (size_t i = 0; i < registry->size(); ++i) { |
1959 document().addMutationObserverTypes(registry->at(i)->mutationTypes() ); | 1947 document().addMutationObserverTypes(registry->at(i)->mutationTypes() ); |
1960 } | 1948 } |
1961 } | 1949 } |
1962 | 1950 |
1963 if (WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration> >* tr ansientRegistry = transientMutationObserverRegistry()) { | 1951 if (WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration> >* tr ansientRegistry = transientMutationObserverRegistry()) { |
1964 for (WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration> >::iterator iter = transientRegistry->begin(); iter != transientRegistry->end(); ++iter) { | 1952 for (WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration> >::iterator iter = transientRegistry->begin(); iter != transientRegistry->end(); ++iter) { |
1965 document().addMutationObserverTypes((*iter)->mutationTypes()); | 1953 document().addMutationObserverTypes((*iter)->mutationTypes()); |
1966 } | 1954 } |
1967 } | 1955 } |
1968 } | 1956 } |
1969 | 1957 |
1970 static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve ntType, PassRefPtr<EventListener> listener, bool useCapture) | 1958 static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve ntType, PassRefPtr<EventListener> listener, bool useCapture) |
1971 { | 1959 { |
1972 if (!targetNode->EventTarget::addEventListener(eventType, listener, useCaptu re)) | 1960 if (!targetNode->EventTarget::addEventListener(eventType, listener, useCaptu re)) |
1973 return false; | 1961 return false; |
1974 | 1962 |
1975 Document& document = targetNode->document(); | 1963 Document& document = targetNode->document(); |
1976 document.addListenerTypeIfNeeded(eventType); | 1964 document.addListenerTypeIfNeeded(eventType); |
1977 if (isTouchEventType(eventType)) | |
1978 document.didAddTouchEventHandler(targetNode); | |
1979 if (document.frameHost()) | 1965 if (document.frameHost()) |
1980 document.frameHost()->eventHandlerRegistry().didAddEventHandler(*targetN ode, eventType); | 1966 document.frameHost()->eventHandlerRegistry().didAddEventHandler(*targetN ode, eventType); |
1981 | 1967 |
1982 return true; | 1968 return true; |
1983 } | 1969 } |
1984 | 1970 |
1985 bool Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListe ner> listener, bool useCapture) | 1971 bool Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListe ner> listener, bool useCapture) |
1986 { | 1972 { |
1987 return tryAddEventListener(this, eventType, listener, useCapture); | 1973 return tryAddEventListener(this, eventType, listener, useCapture); |
1988 } | 1974 } |
1989 | 1975 |
1990 static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString& eventType, EventListener* listener, bool useCapture) | 1976 static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString& eventType, EventListener* listener, bool useCapture) |
1991 { | 1977 { |
1992 if (!targetNode->EventTarget::removeEventListener(eventType, listener, useCa pture)) | 1978 if (!targetNode->EventTarget::removeEventListener(eventType, listener, useCa pture)) |
1993 return false; | 1979 return false; |
1994 | 1980 |
1995 // FIXME: Notify Document that the listener has vanished. We need to keep tr ack of a number of | 1981 // 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 | 1982 // listeners for each type, not just a bool - see https://bugs.webkit.org/sh ow_bug.cgi?id=33861 |
1997 Document& document = targetNode->document(); | 1983 Document& document = targetNode->document(); |
1998 if (isTouchEventType(eventType)) | |
1999 document.didRemoveTouchEventHandler(targetNode); | |
2000 if (document.frameHost()) | 1984 if (document.frameHost()) |
2001 document.frameHost()->eventHandlerRegistry().didRemoveEventHandler(*targ etNode, eventType); | 1985 document.frameHost()->eventHandlerRegistry().didRemoveEventHandler(*targ etNode, eventType); |
2002 | 1986 |
2003 return true; | 1987 return true; |
2004 } | 1988 } |
2005 | 1989 |
2006 bool Node::removeEventListener(const AtomicString& eventType, EventListener* lis tener, bool useCapture) | 1990 bool Node::removeEventListener(const AtomicString& eventType, EventListener* lis tener, bool useCapture) |
2007 { | 1991 { |
2008 return tryRemoveEventListener(this, eventType, listener, useCapture); | 1992 return tryRemoveEventListener(this, eventType, listener, useCapture); |
2009 } | 1993 } |
2010 | 1994 |
2011 void Node::removeAllEventListeners() | 1995 void Node::removeAllEventListeners() |
2012 { | 1996 { |
2013 if (hasEventListeners() && document().frameHost()) | 1997 if (hasEventListeners() && document().frameHost()) |
2014 document().frameHost()->eventHandlerRegistry().didRemoveAllEventHandlers (*this); | 1998 document().frameHost()->eventHandlerRegistry().didRemoveAllEventHandlers (*this); |
2015 EventTarget::removeAllEventListeners(); | 1999 EventTarget::removeAllEventListeners(); |
2016 document().didClearTouchEventHandlers(this); | |
2017 } | 2000 } |
2018 | 2001 |
2019 void Node::removeAllEventListenersRecursively() | 2002 void Node::removeAllEventListenersRecursively() |
2020 { | 2003 { |
2021 for (Node* node = this; node; node = NodeTraversal::next(*node)) { | 2004 for (Node* node = this; node; node = NodeTraversal::next(*node)) { |
2022 node->removeAllEventListeners(); | 2005 node->removeAllEventListeners(); |
2023 for (ShadowRoot* root = node->youngestShadowRoot(); root; root = root->o lderShadowRoot()) | 2006 for (ShadowRoot* root = node->youngestShadowRoot(); root; root = root->o lderShadowRoot()) |
2024 root->removeAllEventListenersRecursively(); | 2007 root->removeAllEventListenersRecursively(); |
2025 } | 2008 } |
2026 } | 2009 } |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2572 node->showTreeForThis(); | 2555 node->showTreeForThis(); |
2573 } | 2556 } |
2574 | 2557 |
2575 void showNodePath(const WebCore::Node* node) | 2558 void showNodePath(const WebCore::Node* node) |
2576 { | 2559 { |
2577 if (node) | 2560 if (node) |
2578 node->showNodePathForThis(); | 2561 node->showNodePathForThis(); |
2579 } | 2562 } |
2580 | 2563 |
2581 #endif | 2564 #endif |
OLD | NEW |