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

Side by Side Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 1942723004: Change EventTarget callback APIs for add/RemoveEventListenerInternal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix gypi Created 4 years, 7 months 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
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 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after
1775 document().addMutationObserverTypes(registry->at(i)->mutationTypes() ); 1775 document().addMutationObserverTypes(registry->at(i)->mutationTypes() );
1776 } 1776 }
1777 } 1777 }
1778 1778
1779 if (transientMutationObserverRegistry()) { 1779 if (transientMutationObserverRegistry()) {
1780 for (MutationObserverRegistration* registration : *transientMutationObse rverRegistry()) 1780 for (MutationObserverRegistration* registration : *transientMutationObse rverRegistry())
1781 document().addMutationObserverTypes(registration->mutationTypes()); 1781 document().addMutationObserverTypes(registration->mutationTypes());
1782 } 1782 }
1783 } 1783 }
1784 1784
1785 bool Node::addEventListenerInternal(const AtomicString& eventType, EventListener * listener, const EventListenerOptions& options) 1785 void Node::addedEventListener(const AtomicString& eventType, const RegisteredEve ntListener& registeredListener)
1786 { 1786 {
1787 if (!EventTarget::addEventListenerInternal(eventType, listener, options)) 1787 EventTarget::addedEventListener(eventType, registeredListener);
1788 return false;
1789
1790 document().addListenerTypeIfNeeded(eventType); 1788 document().addListenerTypeIfNeeded(eventType);
1791 if (FrameHost* frameHost = document().frameHost()) 1789 if (FrameHost* frameHost = document().frameHost())
1792 frameHost->eventHandlerRegistry().didAddEventHandler(*this, eventType, o ptions); 1790 frameHost->eventHandlerRegistry().didAddEventHandler(*this, eventType, r egisteredListener.options());
1793
1794 return true;
1795 } 1791 }
1796 1792
1797 bool Node::removeEventListenerInternal(const AtomicString& eventType, EventListe ner* listener, const EventListenerOptions& options) 1793 void Node::removedEventListener(const AtomicString& eventType, const RegisteredE ventListener& registeredListener)
1798 { 1794 {
1799 if (!EventTarget::removeEventListenerInternal(eventType, listener, options)) 1795 EventTarget::removedEventListener(eventType, registeredListener);
1800 return false;
1801
1802 // FIXME: Notify Document that the listener has vanished. We need to keep tr ack of a number of 1796 // FIXME: Notify Document that the listener has vanished. We need to keep tr ack of a number of
1803 // listeners for each type, not just a bool - see https://bugs.webkit.org/sh ow_bug.cgi?id=33861 1797 // listeners for each type, not just a bool - see https://bugs.webkit.org/sh ow_bug.cgi?id=33861
1804 if (FrameHost* frameHost = document().frameHost()) 1798 if (FrameHost* frameHost = document().frameHost())
1805 frameHost->eventHandlerRegistry().didRemoveEventHandler(*this, eventType , options); 1799 frameHost->eventHandlerRegistry().didRemoveEventHandler(*this, eventType , registeredListener.options());
1806
1807 return true;
1808 } 1800 }
1809 1801
1810 void Node::removeAllEventListeners() 1802 void Node::removeAllEventListeners()
1811 { 1803 {
1812 if (hasEventListeners() && document().frameHost()) 1804 if (hasEventListeners() && document().frameHost())
1813 document().frameHost()->eventHandlerRegistry().didRemoveAllEventHandlers (*this); 1805 document().frameHost()->eventHandlerRegistry().didRemoveAllEventHandlers (*this);
1814 EventTarget::removeAllEventListeners(); 1806 EventTarget::removeAllEventListeners();
1815 } 1807 }
1816 1808
1817 void Node::removeAllEventListenersRecursively() 1809 void Node::removeAllEventListenersRecursively()
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
2332 2324
2333 void showNodePath(const blink::Node* node) 2325 void showNodePath(const blink::Node* node)
2334 { 2326 {
2335 if (node) 2327 if (node)
2336 node->showNodePathForThis(); 2328 node->showNodePathForThis();
2337 else 2329 else
2338 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2330 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2339 } 2331 }
2340 2332
2341 #endif 2333 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698