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 | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
6 * rights reserved. | 6 * rights reserved. |
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * | 10 * |
(...skipping 1796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1807 ExecutionContext* Node::getExecutionContext() const { | 1807 ExecutionContext* Node::getExecutionContext() const { |
1808 return document().contextDocument(); | 1808 return document().contextDocument(); |
1809 } | 1809 } |
1810 | 1810 |
1811 void Node::didMoveToNewDocument(Document& oldDocument) { | 1811 void Node::didMoveToNewDocument(Document& oldDocument) { |
1812 TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled(oldDocument); | 1812 TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled(oldDocument); |
1813 | 1813 |
1814 if (const EventTargetData* eventTargetData = this->eventTargetData()) { | 1814 if (const EventTargetData* eventTargetData = this->eventTargetData()) { |
1815 const EventListenerMap& listenerMap = eventTargetData->eventListenerMap; | 1815 const EventListenerMap& listenerMap = eventTargetData->eventListenerMap; |
1816 if (!listenerMap.isEmpty()) { | 1816 if (!listenerMap.isEmpty()) { |
1817 Vector<AtomicString> types = listenerMap.eventTypes(); | 1817 for (const auto& type : listenerMap.eventTypes()) |
1818 for (unsigned i = 0; i < types.size(); ++i) | 1818 document().addListenerTypeIfNeeded(type); |
1819 document().addListenerTypeIfNeeded(types[i]); | |
1820 } | 1819 } |
1821 } | 1820 } |
1822 | 1821 |
1823 oldDocument.markers().removeMarkers(this); | 1822 oldDocument.markers().removeMarkers(this); |
1824 if (oldDocument.frameHost() && !document().frameHost()) | 1823 if (oldDocument.frameHost() && !document().frameHost()) |
1825 oldDocument.frameHost()->eventHandlerRegistry().didMoveOutOfFrameHost( | 1824 oldDocument.frameHost()->eventHandlerRegistry().didMoveOutOfFrameHost( |
1826 *this); | 1825 *this); |
1827 else if (document().frameHost() && !oldDocument.frameHost()) | 1826 else if (document().frameHost() && !oldDocument.frameHost()) |
1828 document().frameHost()->eventHandlerRegistry().didMoveIntoFrameHost(*this); | 1827 document().frameHost()->eventHandlerRegistry().didMoveIntoFrameHost(*this); |
1829 else if (oldDocument.frameHost() != document().frameHost()) | 1828 else if (oldDocument.frameHost() != document().frameHost()) |
1830 EventHandlerRegistry::didMoveBetweenFrameHosts( | 1829 EventHandlerRegistry::didMoveBetweenFrameHosts( |
1831 *this, oldDocument.frameHost(), document().frameHost()); | 1830 *this, oldDocument.frameHost(), document().frameHost()); |
1832 | 1831 |
1833 if (const HeapVector<TraceWrapperMember<MutationObserverRegistration>>* | 1832 if (const HeapVector<TraceWrapperMember<MutationObserverRegistration>>* |
1834 registry = mutationObserverRegistry()) { | 1833 registry = mutationObserverRegistry()) { |
1835 for (size_t i = 0; i < registry->size(); ++i) { | 1834 for (const auto& registration : *registry) { |
1836 document().addMutationObserverTypes(registry->at(i)->mutationTypes()); | 1835 document().addMutationObserverTypes(registration->mutationTypes()); |
1837 } | 1836 } |
1838 } | 1837 } |
1839 | 1838 |
1840 if (transientMutationObserverRegistry()) { | 1839 if (transientMutationObserverRegistry()) { |
1841 for (MutationObserverRegistration* registration : | 1840 for (MutationObserverRegistration* registration : |
1842 *transientMutationObserverRegistry()) | 1841 *transientMutationObserverRegistry()) |
1843 document().addMutationObserverTypes(registration->mutationTypes()); | 1842 document().addMutationObserverTypes(registration->mutationTypes()); |
1844 } | 1843 } |
1845 } | 1844 } |
1846 | 1845 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1968 observers, node->transientMutationObserverRegistry(), *this, type, | 1967 observers, node->transientMutationObserverRegistry(), *this, type, |
1969 attributeName); | 1968 attributeName); |
1970 } | 1969 } |
1971 } | 1970 } |
1972 | 1971 |
1973 void Node::registerMutationObserver( | 1972 void Node::registerMutationObserver( |
1974 MutationObserver& observer, | 1973 MutationObserver& observer, |
1975 MutationObserverOptions options, | 1974 MutationObserverOptions options, |
1976 const HashSet<AtomicString>& attributeFilter) { | 1975 const HashSet<AtomicString>& attributeFilter) { |
1977 MutationObserverRegistration* registration = nullptr; | 1976 MutationObserverRegistration* registration = nullptr; |
1978 const HeapVector<TraceWrapperMember<MutationObserverRegistration>>& registry = | 1977 for (const auto& item : |
1979 ensureRareData().ensureMutationObserverData().registry(); | 1978 ensureRareData().ensureMutationObserverData().registry()) { |
1980 for (size_t i = 0; i < registry.size(); ++i) { | 1979 if (&item->observer() == &observer) { |
1981 if (®istry[i]->observer() == &observer) { | 1980 registration = item.get(); |
1982 registration = registry[i].get(); | |
1983 registration->resetObservation(options, attributeFilter); | 1981 registration->resetObservation(options, attributeFilter); |
1984 } | 1982 } |
1985 } | 1983 } |
1986 | 1984 |
1987 if (!registration) { | 1985 if (!registration) { |
1988 registration = MutationObserverRegistration::create(observer, this, options, | 1986 registration = MutationObserverRegistration::create(observer, this, options, |
1989 attributeFilter); | 1987 attributeFilter); |
1990 ensureRareData().ensureMutationObserverData().addRegistration(registration); | 1988 ensureRareData().ensureMutationObserverData().addRegistration(registration); |
1991 } | 1989 } |
1992 | 1990 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2028 } | 2026 } |
2029 | 2027 |
2030 void Node::notifyMutationObserversNodeWillDetach() { | 2028 void Node::notifyMutationObserversNodeWillDetach() { |
2031 if (!document().hasMutationObservers()) | 2029 if (!document().hasMutationObservers()) |
2032 return; | 2030 return; |
2033 | 2031 |
2034 ScriptForbiddenScope forbidScriptDuringRawIteration; | 2032 ScriptForbiddenScope forbidScriptDuringRawIteration; |
2035 for (Node* node = parentNode(); node; node = node->parentNode()) { | 2033 for (Node* node = parentNode(); node; node = node->parentNode()) { |
2036 if (const HeapVector<TraceWrapperMember<MutationObserverRegistration>>* | 2034 if (const HeapVector<TraceWrapperMember<MutationObserverRegistration>>* |
2037 registry = node->mutationObserverRegistry()) { | 2035 registry = node->mutationObserverRegistry()) { |
2038 const size_t size = registry->size(); | 2036 for (const auto& registration : *registry) |
2039 for (size_t i = 0; i < size; ++i) | 2037 registration->observedSubtreeNodeWillDetach(*this); |
2040 registry->at(i)->observedSubtreeNodeWillDetach(*this); | |
2041 } | 2038 } |
2042 | 2039 |
2043 if (const HeapHashSet<TraceWrapperMember<MutationObserverRegistration>>* | 2040 if (const HeapHashSet<TraceWrapperMember<MutationObserverRegistration>>* |
2044 transientRegistry = node->transientMutationObserverRegistry()) { | 2041 transientRegistry = node->transientMutationObserverRegistry()) { |
2045 for (auto& registration : *transientRegistry) | 2042 for (auto& registration : *transientRegistry) |
2046 registration->observedSubtreeNodeWillDetach(*this); | 2043 registration->observedSubtreeNodeWillDetach(*this); |
2047 } | 2044 } |
2048 } | 2045 } |
2049 } | 2046 } |
2050 | 2047 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2286 | 2283 |
2287 void Node::decrementConnectedSubframeCount() { | 2284 void Node::decrementConnectedSubframeCount() { |
2288 rareData()->decrementConnectedSubframeCount(); | 2285 rareData()->decrementConnectedSubframeCount(); |
2289 } | 2286 } |
2290 | 2287 |
2291 StaticNodeList* Node::getDestinationInsertionPoints() { | 2288 StaticNodeList* Node::getDestinationInsertionPoints() { |
2292 updateDistribution(); | 2289 updateDistribution(); |
2293 HeapVector<Member<InsertionPoint>, 8> insertionPoints; | 2290 HeapVector<Member<InsertionPoint>, 8> insertionPoints; |
2294 collectDestinationInsertionPoints(*this, insertionPoints); | 2291 collectDestinationInsertionPoints(*this, insertionPoints); |
2295 HeapVector<Member<Node>> filteredInsertionPoints; | 2292 HeapVector<Member<Node>> filteredInsertionPoints; |
2296 for (size_t i = 0; i < insertionPoints.size(); ++i) { | 2293 for (const auto& insertionPoint : insertionPoints) { |
2297 InsertionPoint* insertionPoint = insertionPoints[i]; | |
2298 DCHECK(insertionPoint->containingShadowRoot()); | 2294 DCHECK(insertionPoint->containingShadowRoot()); |
2299 if (!insertionPoint->containingShadowRoot()->isOpenOrV0()) | 2295 if (!insertionPoint->containingShadowRoot()->isOpenOrV0()) |
2300 break; | 2296 break; |
2301 filteredInsertionPoints.append(insertionPoint); | 2297 filteredInsertionPoints.append(insertionPoint); |
2302 } | 2298 } |
2303 return StaticNodeList::adopt(filteredInsertionPoints); | 2299 return StaticNodeList::adopt(filteredInsertionPoints); |
2304 } | 2300 } |
2305 | 2301 |
2306 HTMLSlotElement* Node::assignedSlot() const { | 2302 HTMLSlotElement* Node::assignedSlot() const { |
2307 DCHECK(!isPseudoElement()); | 2303 DCHECK(!isPseudoElement()); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2545 if (node) { | 2541 if (node) { |
2546 std::stringstream stream; | 2542 std::stringstream stream; |
2547 node->printNodePathTo(stream); | 2543 node->printNodePathTo(stream); |
2548 LOG(INFO) << stream.str(); | 2544 LOG(INFO) << stream.str(); |
2549 } else { | 2545 } else { |
2550 LOG(INFO) << "Cannot showNodePath for <null>"; | 2546 LOG(INFO) << "Cannot showNodePath for <null>"; |
2551 } | 2547 } |
2552 } | 2548 } |
2553 | 2549 |
2554 #endif | 2550 #endif |
OLD | NEW |