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

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

Issue 1449623002: IntersectionObserver: second cut. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Add missing break, rebaseline, no config.h Created 4 years, 12 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 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 #include "core/dom/DocumentFragment.h" 68 #include "core/dom/DocumentFragment.h"
69 #include "core/dom/DocumentLifecycleObserver.h" 69 #include "core/dom/DocumentLifecycleObserver.h"
70 #include "core/dom/DocumentType.h" 70 #include "core/dom/DocumentType.h"
71 #include "core/dom/Element.h" 71 #include "core/dom/Element.h"
72 #include "core/dom/ElementDataCache.h" 72 #include "core/dom/ElementDataCache.h"
73 #include "core/dom/ElementRegistrationOptions.h" 73 #include "core/dom/ElementRegistrationOptions.h"
74 #include "core/dom/ElementTraversal.h" 74 #include "core/dom/ElementTraversal.h"
75 #include "core/dom/ExceptionCode.h" 75 #include "core/dom/ExceptionCode.h"
76 #include "core/dom/ExecutionContextTask.h" 76 #include "core/dom/ExecutionContextTask.h"
77 #include "core/dom/FrameRequestCallback.h" 77 #include "core/dom/FrameRequestCallback.h"
78 #include "core/dom/IntersectionObserverController.h"
78 #include "core/dom/LayoutTreeBuilderTraversal.h" 79 #include "core/dom/LayoutTreeBuilderTraversal.h"
79 #include "core/dom/MainThreadTaskRunner.h" 80 #include "core/dom/MainThreadTaskRunner.h"
80 #include "core/dom/Microtask.h" 81 #include "core/dom/Microtask.h"
81 #include "core/dom/MutationObserver.h" 82 #include "core/dom/MutationObserver.h"
82 #include "core/dom/NodeChildRemovalTracker.h" 83 #include "core/dom/NodeChildRemovalTracker.h"
83 #include "core/dom/NodeComputedStyle.h" 84 #include "core/dom/NodeComputedStyle.h"
84 #include "core/dom/NodeFilter.h" 85 #include "core/dom/NodeFilter.h"
85 #include "core/dom/NodeIterator.h" 86 #include "core/dom/NodeIterator.h"
86 #include "core/dom/NodeRareData.h" 87 #include "core/dom/NodeRareData.h"
87 #include "core/dom/NodeTraversal.h" 88 #include "core/dom/NodeTraversal.h"
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 // FIXME: consider using ActiveDOMObject. 602 // FIXME: consider using ActiveDOMObject.
602 if (m_scriptedAnimationController) 603 if (m_scriptedAnimationController)
603 m_scriptedAnimationController->clearDocumentPointer(); 604 m_scriptedAnimationController->clearDocumentPointer();
604 m_scriptedAnimationController.clear(); 605 m_scriptedAnimationController.clear();
605 606
606 m_scriptedIdleTaskController.clear(); 607 m_scriptedIdleTaskController.clear();
607 608
608 if (svgExtensions()) 609 if (svgExtensions())
609 accessSVGExtensions().pauseAnimations(); 610 accessSVGExtensions().pauseAnimations();
610 611
612 if (m_intersectionObserverController) {
613 m_intersectionObserverController->dispose();
614 m_intersectionObserverController.clear();
615 }
haraken 2015/12/22 01:13:29 I think we should call these in Document::detach,
szager1 2015/12/22 07:53:40 In oilpan, it should not be necessary to run this
616
611 m_lifecycle.advanceTo(DocumentLifecycle::Disposed); 617 m_lifecycle.advanceTo(DocumentLifecycle::Disposed);
612 DocumentLifecycleNotifier::notifyDocumentWasDisposed(); 618 DocumentLifecycleNotifier::notifyDocumentWasDisposed();
613 619
614 m_canvasFontCache.clear(); 620 m_canvasFontCache.clear();
615 } 621 }
616 #endif 622 #endif
617 623
618 SelectorQueryCache& Document::selectorQueryCache() 624 SelectorQueryCache& Document::selectorQueryCache()
619 { 625 {
620 if (!m_selectorQueryCache) 626 if (!m_selectorQueryCache)
(...skipping 3951 matching lines...) Expand 10 before | Expand all | Expand 10 after
4572 4578
4573 ASSERT(doc); 4579 ASSERT(doc);
4574 return *doc; 4580 return *doc;
4575 } 4581 }
4576 4582
4577 WeakPtrWillBeRawPtr<Document> Document::contextDocument() 4583 WeakPtrWillBeRawPtr<Document> Document::contextDocument()
4578 { 4584 {
4579 if (m_contextDocument) 4585 if (m_contextDocument)
4580 return m_contextDocument; 4586 return m_contextDocument;
4581 if (m_frame) { 4587 if (m_frame) {
4582 #if ENABLE(OILPAN) 4588 return createWeakPtr();
4583 return this;
4584 #else
4585 return m_weakFactory.createWeakPtr();
4586 #endif
4587 } 4589 }
4588 return nullptr; 4590 return nullptr;
4589 } 4591 }
4590 4592
4591 PassRefPtrWillBeRawPtr<Attr> Document::createAttribute(const AtomicString& name, ExceptionState& exceptionState) 4593 PassRefPtrWillBeRawPtr<Attr> Document::createAttribute(const AtomicString& name, ExceptionState& exceptionState)
4592 { 4594 {
4593 if (isHTMLDocument() && name != name.lower()) 4595 if (isHTMLDocument() && name != name.lower())
4594 UseCounter::count(*this, UseCounter::HTMLDocumentCreateAttributeNameNotL owercase); 4596 UseCounter::count(*this, UseCounter::HTMLDocumentCreateAttributeNameNotL owercase);
4595 return createAttributeNS(nullAtom, name, exceptionState, true); 4597 return createAttributeNS(nullAtom, name, exceptionState, true);
4596 } 4598 }
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
5052 { 5054 {
5053 if (equalIgnoringCase(dnsPrefetchControl, "on") && !m_haveExplicitlyDisabled DNSPrefetch) { 5055 if (equalIgnoringCase(dnsPrefetchControl, "on") && !m_haveExplicitlyDisabled DNSPrefetch) {
5054 m_isDNSPrefetchEnabled = true; 5056 m_isDNSPrefetchEnabled = true;
5055 return; 5057 return;
5056 } 5058 }
5057 5059
5058 m_isDNSPrefetchEnabled = false; 5060 m_isDNSPrefetchEnabled = false;
5059 m_haveExplicitlyDisabledDNSPrefetch = true; 5061 m_haveExplicitlyDisabledDNSPrefetch = true;
5060 } 5062 }
5061 5063
5064 WeakPtrWillBeRawPtr<Document> Document::createWeakPtr()
5065 {
5066 #if ENABLE(OILPAN)
5067 return this;
5068 #else
5069 return m_weakFactory.createWeakPtr();
5070 #endif
5071 }
5072
5073 IntersectionObserverController& Document::intersectionObserverController()
haraken 2015/12/22 01:13:29 intersectionObserverController() => ensureIntersec
szager1 2015/12/22 07:53:40 Done.
5074 {
5075 if (!m_intersectionObserverController)
5076 m_intersectionObserverController = new IntersectionObserverController();
5077 return *m_intersectionObserverController;
5078 }
5079
5062 void Document::reportBlockedScriptExecutionToInspector(const String& directiveTe xt) 5080 void Document::reportBlockedScriptExecutionToInspector(const String& directiveTe xt)
5063 { 5081 {
5064 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); 5082 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText);
5065 } 5083 }
5066 5084
5067 void Document::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleM essage) 5085 void Document::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleM essage)
5068 { 5086 {
5069 if (!isContextThread()) { 5087 if (!isContextThread()) {
5070 m_taskRunner->postTask(BLINK_FROM_HERE, AddConsoleMessageTask::create(co nsoleMessage->source(), consoleMessage->level(), consoleMessage->message())); 5088 m_taskRunner->postTask(BLINK_FROM_HERE, AddConsoleMessageTask::create(co nsoleMessage->source(), consoleMessage->level(), consoleMessage->message()));
5071 return; 5089 return;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
5109 void Document::tasksWereResumed() 5127 void Document::tasksWereResumed()
5110 { 5128 {
5111 scriptRunner()->resume(); 5129 scriptRunner()->resume();
5112 5130
5113 if (m_parser) 5131 if (m_parser)
5114 m_parser->resumeScheduledTasks(); 5132 m_parser->resumeScheduledTasks();
5115 if (m_scriptedAnimationController) 5133 if (m_scriptedAnimationController)
5116 m_scriptedAnimationController->resume(); 5134 m_scriptedAnimationController->resume();
5117 5135
5118 MutationObserver::resumeSuspendedObservers(); 5136 MutationObserver::resumeSuspendedObservers();
5137 if (m_intersectionObserverController)
5138 m_intersectionObserverController->resumeSuspendedIntersectionObservers() ;
5119 if (m_domWindow) 5139 if (m_domWindow)
5120 DOMWindowPerformance::performance(*m_domWindow)->resumeSuspendedObserver s(); 5140 DOMWindowPerformance::performance(*m_domWindow)->resumeSuspendedObserver s();
5121 } 5141 }
5122 5142
5123 // FIXME: suspendScheduledTasks(), resumeScheduledTasks(), tasksNeedSuspension() 5143 // FIXME: suspendScheduledTasks(), resumeScheduledTasks(), tasksNeedSuspension()
5124 // should be moved to LocalDOMWindow once it inherits ExecutionContext 5144 // should be moved to LocalDOMWindow once it inherits ExecutionContext
5125 void Document::suspendScheduledTasks() 5145 void Document::suspendScheduledTasks()
5126 { 5146 {
5127 ExecutionContext::suspendScheduledTasks(); 5147 ExecutionContext::suspendScheduledTasks();
5128 m_taskRunner->suspend(); 5148 m_taskRunner->suspend();
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
5855 visitor->trace(m_timers); 5875 visitor->trace(m_timers);
5856 visitor->trace(m_templateDocument); 5876 visitor->trace(m_templateDocument);
5857 visitor->trace(m_templateDocumentHost); 5877 visitor->trace(m_templateDocumentHost);
5858 visitor->trace(m_visibilityObservers); 5878 visitor->trace(m_visibilityObservers);
5859 visitor->trace(m_userActionElements); 5879 visitor->trace(m_userActionElements);
5860 visitor->trace(m_svgExtensions); 5880 visitor->trace(m_svgExtensions);
5861 visitor->trace(m_timeline); 5881 visitor->trace(m_timeline);
5862 visitor->trace(m_compositorPendingAnimations); 5882 visitor->trace(m_compositorPendingAnimations);
5863 visitor->trace(m_contextDocument); 5883 visitor->trace(m_contextDocument);
5864 visitor->trace(m_canvasFontCache); 5884 visitor->trace(m_canvasFontCache);
5885 visitor->trace(m_intersectionObserverController);
5865 WillBeHeapSupplementable<Document>::trace(visitor); 5886 WillBeHeapSupplementable<Document>::trace(visitor);
5866 #endif 5887 #endif
5867 TreeScope::trace(visitor); 5888 TreeScope::trace(visitor);
5868 ContainerNode::trace(visitor); 5889 ContainerNode::trace(visitor);
5869 ExecutionContext::trace(visitor); 5890 ExecutionContext::trace(visitor);
5870 DocumentLifecycleNotifier::trace(visitor); 5891 DocumentLifecycleNotifier::trace(visitor);
5871 SecurityContext::trace(visitor); 5892 SecurityContext::trace(visitor);
5872 } 5893 }
5873 5894
5874 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>; 5895 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>;
5875 5896
5876 } // namespace blink 5897 } // namespace blink
5877 5898
5878 #ifndef NDEBUG 5899 #ifndef NDEBUG
5879 using namespace blink; 5900 using namespace blink;
5880 void showLiveDocumentInstances() 5901 void showLiveDocumentInstances()
5881 { 5902 {
5882 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5903 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5883 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5904 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5884 for (Document* document : set) 5905 for (Document* document : set)
5885 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5906 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5886 } 5907 }
5887 #endif 5908 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698