| 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 * (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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 #include "core/dom/DocumentFragment.h" | 69 #include "core/dom/DocumentFragment.h" |
| 70 #include "core/dom/DocumentLifecycleObserver.h" | 70 #include "core/dom/DocumentLifecycleObserver.h" |
| 71 #include "core/dom/DocumentType.h" | 71 #include "core/dom/DocumentType.h" |
| 72 #include "core/dom/Element.h" | 72 #include "core/dom/Element.h" |
| 73 #include "core/dom/ElementDataCache.h" | 73 #include "core/dom/ElementDataCache.h" |
| 74 #include "core/dom/ElementRegistrationOptions.h" | 74 #include "core/dom/ElementRegistrationOptions.h" |
| 75 #include "core/dom/ElementTraversal.h" | 75 #include "core/dom/ElementTraversal.h" |
| 76 #include "core/dom/ExceptionCode.h" | 76 #include "core/dom/ExceptionCode.h" |
| 77 #include "core/dom/ExecutionContextTask.h" | 77 #include "core/dom/ExecutionContextTask.h" |
| 78 #include "core/dom/FrameRequestCallback.h" | 78 #include "core/dom/FrameRequestCallback.h" |
| 79 #include "core/dom/IntersectionObserver.h" |
| 79 #include "core/dom/LayoutTreeBuilderTraversal.h" | 80 #include "core/dom/LayoutTreeBuilderTraversal.h" |
| 80 #include "core/dom/MainThreadTaskRunner.h" | 81 #include "core/dom/MainThreadTaskRunner.h" |
| 81 #include "core/dom/Microtask.h" | 82 #include "core/dom/Microtask.h" |
| 82 #include "core/dom/MutationObserver.h" | 83 #include "core/dom/MutationObserver.h" |
| 83 #include "core/dom/NodeChildRemovalTracker.h" | 84 #include "core/dom/NodeChildRemovalTracker.h" |
| 84 #include "core/dom/NodeComputedStyle.h" | 85 #include "core/dom/NodeComputedStyle.h" |
| 85 #include "core/dom/NodeFilter.h" | 86 #include "core/dom/NodeFilter.h" |
| 86 #include "core/dom/NodeIterator.h" | 87 #include "core/dom/NodeIterator.h" |
| 87 #include "core/dom/NodeRareData.h" | 88 #include "core/dom/NodeRareData.h" |
| 88 #include "core/dom/NodeTraversal.h" | 89 #include "core/dom/NodeTraversal.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 #include "wtf/text/StringBuffer.h" | 220 #include "wtf/text/StringBuffer.h" |
| 220 #include "wtf/text/TextEncodingRegistry.h" | 221 #include "wtf/text/TextEncodingRegistry.h" |
| 221 | 222 |
| 222 using namespace WTF; | 223 using namespace WTF; |
| 223 using namespace Unicode; | 224 using namespace Unicode; |
| 224 | 225 |
| 225 namespace blink { | 226 namespace blink { |
| 226 | 227 |
| 227 using namespace HTMLNames; | 228 using namespace HTMLNames; |
| 228 | 229 |
| 230 using IntersectionObserverVector = WillBeHeapVector<RefPtrWillBeMember<Intersect
ionObserver>>; |
| 231 |
| 229 static const unsigned cMaxWriteRecursionDepth = 21; | 232 static const unsigned cMaxWriteRecursionDepth = 21; |
| 230 | 233 |
| 231 // This amount of time must have elapsed before we will even consider scheduling
a layout without a delay. | 234 // This amount of time must have elapsed before we will even consider scheduling
a layout without a delay. |
| 232 // FIXME: For faster machines this value can really be lowered to 200. 250 is a
dequate, but a little high | 235 // FIXME: For faster machines this value can really be lowered to 200. 250 is a
dequate, but a little high |
| 233 // for dual G5s. :) | 236 // for dual G5s. :) |
| 234 static const int cLayoutScheduleThreshold = 250; | 237 static const int cLayoutScheduleThreshold = 250; |
| 235 | 238 |
| 236 // DOM Level 2 says (letters added): | 239 // DOM Level 2 says (letters added): |
| 237 // | 240 // |
| 238 // a) Name start characters must have one of the categories Ll, Lu, Lo, Lt, Nl. | 241 // a) Name start characters must have one of the categories Ll, Lu, Lo, Lt, Nl. |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 , m_isMobileDocument(false) | 418 , m_isMobileDocument(false) |
| 416 , m_layoutView(0) | 419 , m_layoutView(0) |
| 417 #if !ENABLE(OILPAN) | 420 #if !ENABLE(OILPAN) |
| 418 , m_weakFactory(this) | 421 , m_weakFactory(this) |
| 419 #endif | 422 #endif |
| 420 , m_contextDocument(initializer.contextDocument()) | 423 , m_contextDocument(initializer.contextDocument()) |
| 421 , m_hasFullscreenSupplement(false) | 424 , m_hasFullscreenSupplement(false) |
| 422 , m_loadEventDelayCount(0) | 425 , m_loadEventDelayCount(0) |
| 423 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) | 426 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) |
| 424 , m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired) | 427 , m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired) |
| 428 , m_deliverIntersectionObservationsTimer(this, &Document::deliverIntersectio
nObservationsTimerFired) |
| 425 , m_documentTiming(*this) | 429 , m_documentTiming(*this) |
| 426 , m_writeRecursionIsTooDeep(false) | 430 , m_writeRecursionIsTooDeep(false) |
| 427 , m_writeRecursionDepth(0) | 431 , m_writeRecursionDepth(0) |
| 428 , m_taskRunner(MainThreadTaskRunner::create(this)) | 432 , m_taskRunner(MainThreadTaskRunner::create(this)) |
| 429 , m_registrationContext(initializer.registrationContext(this)) | 433 , m_registrationContext(initializer.registrationContext(this)) |
| 430 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi
red) | 434 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi
red) |
| 431 , m_timeline(AnimationTimeline::create(this)) | 435 , m_timeline(AnimationTimeline::create(this)) |
| 432 , m_templateDocumentHost(nullptr) | 436 , m_templateDocumentHost(nullptr) |
| 433 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT
imerFired) | 437 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT
imerFired) |
| 434 , m_hasViewportUnits(false) | 438 , m_hasViewportUnits(false) |
| (...skipping 5190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5625 if (!context->securityOrigin()->isPotentiallyTrustworthy(err
orMessage)) | 5629 if (!context->securityOrigin()->isPotentiallyTrustworthy(err
orMessage)) |
| 5626 return false; | 5630 return false; |
| 5627 } | 5631 } |
| 5628 } | 5632 } |
| 5629 context = context->parentDocument(); | 5633 context = context->parentDocument(); |
| 5630 } | 5634 } |
| 5631 } | 5635 } |
| 5632 return true; | 5636 return true; |
| 5633 } | 5637 } |
| 5634 | 5638 |
| 5639 void Document::activateIntersectionObserver(IntersectionObserver& observer) |
| 5640 { |
| 5641 if (m_activeIntersectionObservers.isEmpty()) |
| 5642 m_deliverIntersectionObservationsTimer.startOneShot(0, FROM_HERE); |
| 5643 |
| 5644 m_activeIntersectionObservers.add(&observer); |
| 5645 } |
| 5646 |
| 5647 void Document::resumeSuspendedIntersectionObservers() |
| 5648 { |
| 5649 ASSERT(isMainThread()); |
| 5650 if (m_suspendedIntersectionObservers.isEmpty()) |
| 5651 return; |
| 5652 |
| 5653 IntersectionObserverVector suspended; |
| 5654 copyToVector(m_suspendedIntersectionObservers, suspended); |
| 5655 for (size_t i = 0; i < suspended.size(); ++i) { |
| 5656 if (!suspended[i]->shouldBeSuspended()) { |
| 5657 m_suspendedIntersectionObservers.remove(suspended[i]); |
| 5658 activateIntersectionObserver(*suspended[i]); |
| 5659 } |
| 5660 } |
| 5661 } |
| 5662 |
| 5663 void Document::deliverIntersectionObservationsTimerFired(Timer<Document>*) |
| 5664 { |
| 5665 ASSERT(isMainThread()); |
| 5666 IntersectionObserverVector observers; |
| 5667 copyToVector(m_activeIntersectionObservers, observers); |
| 5668 m_activeIntersectionObservers.clear(); |
| 5669 for (size_t i = 0; i < observers.size(); ++i) { |
| 5670 if (observers[i]->shouldBeSuspended()) |
| 5671 m_suspendedIntersectionObservers.add(observers[i]); |
| 5672 else |
| 5673 observers[i]->deliver(); |
| 5674 } |
| 5675 } |
| 5676 |
| 5635 DEFINE_TRACE(Document) | 5677 DEFINE_TRACE(Document) |
| 5636 { | 5678 { |
| 5637 #if ENABLE(OILPAN) | 5679 #if ENABLE(OILPAN) |
| 5638 visitor->trace(m_importsController); | 5680 visitor->trace(m_importsController); |
| 5639 visitor->trace(m_docType); | 5681 visitor->trace(m_docType); |
| 5640 visitor->trace(m_implementation); | 5682 visitor->trace(m_implementation); |
| 5641 visitor->trace(m_autofocusElement); | 5683 visitor->trace(m_autofocusElement); |
| 5642 visitor->trace(m_focusedElement); | 5684 visitor->trace(m_focusedElement); |
| 5643 visitor->trace(m_hoverNode); | 5685 visitor->trace(m_hoverNode); |
| 5644 visitor->trace(m_activeHoverElement); | 5686 visitor->trace(m_activeHoverElement); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5681 visitor->trace(m_timers); | 5723 visitor->trace(m_timers); |
| 5682 visitor->trace(m_templateDocument); | 5724 visitor->trace(m_templateDocument); |
| 5683 visitor->trace(m_templateDocumentHost); | 5725 visitor->trace(m_templateDocumentHost); |
| 5684 visitor->trace(m_visibilityObservers); | 5726 visitor->trace(m_visibilityObservers); |
| 5685 visitor->trace(m_userActionElements); | 5727 visitor->trace(m_userActionElements); |
| 5686 visitor->trace(m_svgExtensions); | 5728 visitor->trace(m_svgExtensions); |
| 5687 visitor->trace(m_timeline); | 5729 visitor->trace(m_timeline); |
| 5688 visitor->trace(m_compositorPendingAnimations); | 5730 visitor->trace(m_compositorPendingAnimations); |
| 5689 visitor->trace(m_contextDocument); | 5731 visitor->trace(m_contextDocument); |
| 5690 visitor->trace(m_canvasFontCache); | 5732 visitor->trace(m_canvasFontCache); |
| 5733 visitor->trace(m_activeIntersectionObservers); |
| 5734 visitor->trace(m_suspendedIntersectionObservers); |
| 5691 WillBeHeapSupplementable<Document>::trace(visitor); | 5735 WillBeHeapSupplementable<Document>::trace(visitor); |
| 5692 #endif | 5736 #endif |
| 5693 TreeScope::trace(visitor); | 5737 TreeScope::trace(visitor); |
| 5694 ContainerNode::trace(visitor); | 5738 ContainerNode::trace(visitor); |
| 5695 ExecutionContext::trace(visitor); | 5739 ExecutionContext::trace(visitor); |
| 5696 DocumentLifecycleNotifier::trace(visitor); | 5740 DocumentLifecycleNotifier::trace(visitor); |
| 5697 SecurityContext::trace(visitor); | 5741 SecurityContext::trace(visitor); |
| 5698 } | 5742 } |
| 5699 | 5743 |
| 5700 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>; | 5744 template class CORE_TEMPLATE_EXPORT WillBeHeapSupplement<Document>; |
| 5701 | 5745 |
| 5702 } // namespace blink | 5746 } // namespace blink |
| 5703 | 5747 |
| 5704 #ifndef NDEBUG | 5748 #ifndef NDEBUG |
| 5705 using namespace blink; | 5749 using namespace blink; |
| 5706 void showLiveDocumentInstances() | 5750 void showLiveDocumentInstances() |
| 5707 { | 5751 { |
| 5708 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 5752 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
| 5709 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5753 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5710 for (Document* document : set) | 5754 for (Document* document : set) |
| 5711 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5755 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
| 5712 } | 5756 } |
| 5713 #endif | 5757 #endif |
| OLD | NEW |