| 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 | 320 |
| 321 #if !ENABLE(OILPAN) | 321 #if !ENABLE(OILPAN) |
| 322 // With Oilpan all of this is handled with weak processing of the document. | 322 // With Oilpan all of this is handled with weak processing of the document. |
| 323 void Node::willBeDeletedFromDocument() | 323 void Node::willBeDeletedFromDocument() |
| 324 { | 324 { |
| 325 if (!isTreeScopeInitialized()) | 325 if (!isTreeScopeInitialized()) |
| 326 return; | 326 return; |
| 327 | 327 |
| 328 Document& document = this->document(); | 328 Document& document = this->document(); |
| 329 | 329 |
| 330 if (hasEventTargetData()) { | 330 if (hasEventTargetData()) |
| 331 clearEventTargetData(); | 331 clearEventTargetData(); |
| 332 document.didClearTouchEventHandlers(this); | |
| 333 } | |
| 334 | 332 |
| 335 if (document.frameHost()) | 333 if (document.frameHost()) |
| 336 document.frameHost()->eventHandlerRegistry().didRemoveAllEventHandlers(*
this); | 334 document.frameHost()->eventHandlerRegistry().didRemoveAllEventHandlers(*
this); |
| 337 | 335 |
| 338 if (AXObjectCache* cache = document.existingAXObjectCache()) | 336 if (AXObjectCache* cache = document.existingAXObjectCache()) |
| 339 cache->remove(this); | 337 cache->remove(this); |
| 340 | 338 |
| 341 document.markers().removeMarkers(this); | 339 document.markers().removeMarkers(this); |
| 342 } | 340 } |
| 343 #endif | 341 #endif |
| (...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1850 } | 1848 } |
| 1851 } | 1849 } |
| 1852 | 1850 |
| 1853 if (AXObjectCache::accessibilityEnabled()) { | 1851 if (AXObjectCache::accessibilityEnabled()) { |
| 1854 if (AXObjectCache* cache = oldDocument.existingAXObjectCache()) | 1852 if (AXObjectCache* cache = oldDocument.existingAXObjectCache()) |
| 1855 cache->remove(this); | 1853 cache->remove(this); |
| 1856 } | 1854 } |
| 1857 | 1855 |
| 1858 oldDocument.markers().removeMarkers(this); | 1856 oldDocument.markers().removeMarkers(this); |
| 1859 oldDocument.updateRangesAfterNodeMovedToAnotherDocument(*this); | 1857 oldDocument.updateRangesAfterNodeMovedToAnotherDocument(*this); |
| 1860 | 1858 if (oldDocument.frameHost() && !document().frameHost()) |
| 1861 if (const TouchEventTargetSet* touchHandlers = oldDocument.touchEventTargets
()) { | 1859 oldDocument.frameHost()->eventHandlerRegistry().didMoveOutOfFrameHost(*t
his); |
| 1862 while (touchHandlers->contains(this)) { | 1860 else if (document().frameHost() && !oldDocument.frameHost()) |
| 1863 oldDocument.didRemoveTouchEventHandler(this); | 1861 document().frameHost()->eventHandlerRegistry().didMoveIntoFrameHost(*thi
s); |
| 1864 document().didAddTouchEventHandler(this); | 1862 else if (oldDocument.frameHost() != document().frameHost()) |
| 1865 } | 1863 EventHandlerRegistry::didMoveBetweenFrameHosts(*this, oldDocument.frameH
ost(), document().frameHost()); |
| 1866 } | |
| 1867 if (oldDocument.frameHost() != document().frameHost()) { | |
| 1868 if (oldDocument.frameHost()) | |
| 1869 oldDocument.frameHost()->eventHandlerRegistry().didMoveOutOfFrameHos
t(*this); | |
| 1870 if (document().frameHost()) | |
| 1871 document().frameHost()->eventHandlerRegistry().didMoveIntoFrameHost(
*this); | |
| 1872 } | |
| 1873 | 1864 |
| 1874 if (WillBeHeapVector<OwnPtrWillBeMember<MutationObserverRegistration> >* reg
istry = mutationObserverRegistry()) { | 1865 if (WillBeHeapVector<OwnPtrWillBeMember<MutationObserverRegistration> >* reg
istry = mutationObserverRegistry()) { |
| 1875 for (size_t i = 0; i < registry->size(); ++i) { | 1866 for (size_t i = 0; i < registry->size(); ++i) { |
| 1876 document().addMutationObserverTypes(registry->at(i)->mutationTypes()
); | 1867 document().addMutationObserverTypes(registry->at(i)->mutationTypes()
); |
| 1877 } | 1868 } |
| 1878 } | 1869 } |
| 1879 | 1870 |
| 1880 if (WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration> >* tr
ansientRegistry = transientMutationObserverRegistry()) { | 1871 if (WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration> >* tr
ansientRegistry = transientMutationObserverRegistry()) { |
| 1881 for (WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration>
>::iterator iter = transientRegistry->begin(); iter != transientRegistry->end();
++iter) { | 1872 for (WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration>
>::iterator iter = transientRegistry->begin(); iter != transientRegistry->end();
++iter) { |
| 1882 document().addMutationObserverTypes((*iter)->mutationTypes()); | 1873 document().addMutationObserverTypes((*iter)->mutationTypes()); |
| 1883 } | 1874 } |
| 1884 } | 1875 } |
| 1885 } | 1876 } |
| 1886 | 1877 |
| 1887 static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve
ntType, PassRefPtr<EventListener> listener, bool useCapture) | 1878 static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve
ntType, PassRefPtr<EventListener> listener, bool useCapture) |
| 1888 { | 1879 { |
| 1889 if (!targetNode->EventTarget::addEventListener(eventType, listener, useCaptu
re)) | 1880 if (!targetNode->EventTarget::addEventListener(eventType, listener, useCaptu
re)) |
| 1890 return false; | 1881 return false; |
| 1891 | 1882 |
| 1892 Document& document = targetNode->document(); | 1883 Document& document = targetNode->document(); |
| 1893 document.addListenerTypeIfNeeded(eventType); | 1884 document.addListenerTypeIfNeeded(eventType); |
| 1894 if (isTouchEventType(eventType)) | |
| 1895 document.didAddTouchEventHandler(targetNode); | |
| 1896 if (document.frameHost()) | 1885 if (document.frameHost()) |
| 1897 document.frameHost()->eventHandlerRegistry().didAddEventHandler(*targetN
ode, eventType); | 1886 document.frameHost()->eventHandlerRegistry().didAddEventHandler(*targetN
ode, eventType); |
| 1898 | 1887 |
| 1899 return true; | 1888 return true; |
| 1900 } | 1889 } |
| 1901 | 1890 |
| 1902 bool Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListe
ner> listener, bool useCapture) | 1891 bool Node::addEventListener(const AtomicString& eventType, PassRefPtr<EventListe
ner> listener, bool useCapture) |
| 1903 { | 1892 { |
| 1904 return tryAddEventListener(this, eventType, listener, useCapture); | 1893 return tryAddEventListener(this, eventType, listener, useCapture); |
| 1905 } | 1894 } |
| 1906 | 1895 |
| 1907 static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString&
eventType, PassRefPtr<EventListener> listener, bool useCapture) | 1896 static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString&
eventType, PassRefPtr<EventListener> listener, bool useCapture) |
| 1908 { | 1897 { |
| 1909 if (!targetNode->EventTarget::removeEventListener(eventType, listener, useCa
pture)) | 1898 if (!targetNode->EventTarget::removeEventListener(eventType, listener, useCa
pture)) |
| 1910 return false; | 1899 return false; |
| 1911 | 1900 |
| 1912 // FIXME: Notify Document that the listener has vanished. We need to keep tr
ack of a number of | 1901 // FIXME: Notify Document that the listener has vanished. We need to keep tr
ack of a number of |
| 1913 // listeners for each type, not just a bool - see https://bugs.webkit.org/sh
ow_bug.cgi?id=33861 | 1902 // listeners for each type, not just a bool - see https://bugs.webkit.org/sh
ow_bug.cgi?id=33861 |
| 1914 Document& document = targetNode->document(); | 1903 Document& document = targetNode->document(); |
| 1915 if (isTouchEventType(eventType)) | |
| 1916 document.didRemoveTouchEventHandler(targetNode); | |
| 1917 if (document.frameHost()) | 1904 if (document.frameHost()) |
| 1918 document.frameHost()->eventHandlerRegistry().didRemoveEventHandler(*targ
etNode, eventType); | 1905 document.frameHost()->eventHandlerRegistry().didRemoveEventHandler(*targ
etNode, eventType); |
| 1919 | 1906 |
| 1920 return true; | 1907 return true; |
| 1921 } | 1908 } |
| 1922 | 1909 |
| 1923 bool Node::removeEventListener(const AtomicString& eventType, PassRefPtr<EventLi
stener> listener, bool useCapture) | 1910 bool Node::removeEventListener(const AtomicString& eventType, PassRefPtr<EventLi
stener> listener, bool useCapture) |
| 1924 { | 1911 { |
| 1925 return tryRemoveEventListener(this, eventType, listener, useCapture); | 1912 return tryRemoveEventListener(this, eventType, listener, useCapture); |
| 1926 } | 1913 } |
| 1927 | 1914 |
| 1928 void Node::removeAllEventListeners() | 1915 void Node::removeAllEventListeners() |
| 1929 { | 1916 { |
| 1930 if (hasEventListeners() && document().frameHost()) | 1917 if (hasEventListeners() && document().frameHost()) |
| 1931 document().frameHost()->eventHandlerRegistry().didRemoveAllEventHandlers
(*this); | 1918 document().frameHost()->eventHandlerRegistry().didRemoveAllEventHandlers
(*this); |
| 1932 EventTarget::removeAllEventListeners(); | 1919 EventTarget::removeAllEventListeners(); |
| 1933 document().didClearTouchEventHandlers(this); | |
| 1934 } | 1920 } |
| 1935 | 1921 |
| 1936 void Node::removeAllEventListenersRecursively() | 1922 void Node::removeAllEventListenersRecursively() |
| 1937 { | 1923 { |
| 1938 for (Node* node = this; node; node = NodeTraversal::next(*node)) { | 1924 for (Node* node = this; node; node = NodeTraversal::next(*node)) { |
| 1939 node->removeAllEventListeners(); | 1925 node->removeAllEventListeners(); |
| 1940 for (ShadowRoot* root = node->youngestShadowRoot(); root; root = root->o
lderShadowRoot()) | 1926 for (ShadowRoot* root = node->youngestShadowRoot(); root; root = root->o
lderShadowRoot()) |
| 1941 root->removeAllEventListenersRecursively(); | 1927 root->removeAllEventListenersRecursively(); |
| 1942 } | 1928 } |
| 1943 } | 1929 } |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2490 node->showTreeForThis(); | 2476 node->showTreeForThis(); |
| 2491 } | 2477 } |
| 2492 | 2478 |
| 2493 void showNodePath(const blink::Node* node) | 2479 void showNodePath(const blink::Node* node) |
| 2494 { | 2480 { |
| 2495 if (node) | 2481 if (node) |
| 2496 node->showNodePathForThis(); | 2482 node->showNodePathForThis(); |
| 2497 } | 2483 } |
| 2498 | 2484 |
| 2499 #endif | 2485 #endif |
| OLD | NEW |