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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 #include "core/dom/Microtask.h" | 79 #include "core/dom/Microtask.h" |
80 #include "core/dom/MutationObserver.h" | 80 #include "core/dom/MutationObserver.h" |
81 #include "core/dom/NodeChildRemovalTracker.h" | 81 #include "core/dom/NodeChildRemovalTracker.h" |
82 #include "core/dom/NodeFilter.h" | 82 #include "core/dom/NodeFilter.h" |
83 #include "core/dom/NodeIterator.h" | 83 #include "core/dom/NodeIterator.h" |
84 #include "core/dom/NodeLayoutStyle.h" | 84 #include "core/dom/NodeLayoutStyle.h" |
85 #include "core/dom/NodeRareData.h" | 85 #include "core/dom/NodeRareData.h" |
86 #include "core/dom/NodeRenderingTraversal.h" | 86 #include "core/dom/NodeRenderingTraversal.h" |
87 #include "core/dom/NodeTraversal.h" | 87 #include "core/dom/NodeTraversal.h" |
88 #include "core/dom/NodeWithIndex.h" | 88 #include "core/dom/NodeWithIndex.h" |
| 89 #include "core/dom/NthIndexCache.h" |
89 #include "core/dom/ProcessingInstruction.h" | 90 #include "core/dom/ProcessingInstruction.h" |
90 #include "core/dom/RequestAnimationFrameCallback.h" | 91 #include "core/dom/RequestAnimationFrameCallback.h" |
91 #include "core/dom/ScriptRunner.h" | 92 #include "core/dom/ScriptRunner.h" |
92 #include "core/dom/ScriptedAnimationController.h" | 93 #include "core/dom/ScriptedAnimationController.h" |
93 #include "core/dom/SelectorQuery.h" | 94 #include "core/dom/SelectorQuery.h" |
94 #include "core/dom/StaticNodeList.h" | 95 #include "core/dom/StaticNodeList.h" |
95 #include "core/dom/StyleEngine.h" | 96 #include "core/dom/StyleEngine.h" |
96 #include "core/dom/TouchList.h" | 97 #include "core/dom/TouchList.h" |
97 #include "core/dom/TransformSource.h" | 98 #include "core/dom/TransformSource.h" |
98 #include "core/dom/TreeWalker.h" | 99 #include "core/dom/TreeWalker.h" |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 , m_writeRecursionDepth(0) | 468 , m_writeRecursionDepth(0) |
468 , m_taskRunner(MainThreadTaskRunner::create(this)) | 469 , m_taskRunner(MainThreadTaskRunner::create(this)) |
469 , m_registrationContext(initializer.registrationContext(this)) | 470 , m_registrationContext(initializer.registrationContext(this)) |
470 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi
red) | 471 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi
red) |
471 , m_timeline(AnimationTimeline::create(this)) | 472 , m_timeline(AnimationTimeline::create(this)) |
472 , m_templateDocumentHost(nullptr) | 473 , m_templateDocumentHost(nullptr) |
473 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT
imerFired) | 474 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT
imerFired) |
474 , m_hasViewportUnits(false) | 475 , m_hasViewportUnits(false) |
475 , m_styleRecalcElementCounter(0) | 476 , m_styleRecalcElementCounter(0) |
476 , m_parserSyncPolicy(AllowAsynchronousParsing) | 477 , m_parserSyncPolicy(AllowAsynchronousParsing) |
| 478 , m_useNthIndexCache(false) |
477 { | 479 { |
478 if (m_frame) { | 480 if (m_frame) { |
479 ASSERT(m_frame->page()); | 481 ASSERT(m_frame->page()); |
480 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); | 482 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); |
481 | 483 |
482 m_fetcher = m_frame->loader().documentLoader()->fetcher(); | 484 m_fetcher = m_frame->loader().documentLoader()->fetcher(); |
483 } | 485 } |
484 | 486 |
485 if (!m_fetcher) | 487 if (!m_fetcher) |
486 m_fetcher = FrameFetchContext::createContextAndFetcher(nullptr); | 488 m_fetcher = FrameFetchContext::createContextAndFetcher(nullptr); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 } | 651 } |
650 #endif | 652 #endif |
651 | 653 |
652 SelectorQueryCache& Document::selectorQueryCache() | 654 SelectorQueryCache& Document::selectorQueryCache() |
653 { | 655 { |
654 if (!m_selectorQueryCache) | 656 if (!m_selectorQueryCache) |
655 m_selectorQueryCache = adoptPtr(new SelectorQueryCache()); | 657 m_selectorQueryCache = adoptPtr(new SelectorQueryCache()); |
656 return *m_selectorQueryCache; | 658 return *m_selectorQueryCache; |
657 } | 659 } |
658 | 660 |
| 661 NthIndexCache* Document::nthIndexCache() |
| 662 { |
| 663 if (!m_useNthIndexCache) |
| 664 return nullptr; |
| 665 if (!m_nthIndexCache) |
| 666 m_nthIndexCache = NthIndexCache::create(*this); |
| 667 return m_nthIndexCache.get(); |
| 668 } |
| 669 |
| 670 void Document::setUseNthIndexCache(bool use) |
| 671 { |
| 672 m_useNthIndexCache = use; |
| 673 if (!use && m_nthIndexCache) |
| 674 m_nthIndexCache->clear(); |
| 675 } |
| 676 |
659 MediaQueryMatcher& Document::mediaQueryMatcher() | 677 MediaQueryMatcher& Document::mediaQueryMatcher() |
660 { | 678 { |
661 if (!m_mediaQueryMatcher) | 679 if (!m_mediaQueryMatcher) |
662 m_mediaQueryMatcher = MediaQueryMatcher::create(*this); | 680 m_mediaQueryMatcher = MediaQueryMatcher::create(*this); |
663 return *m_mediaQueryMatcher; | 681 return *m_mediaQueryMatcher; |
664 } | 682 } |
665 | 683 |
666 void Document::mediaQueryAffectingValueChanged() | 684 void Document::mediaQueryAffectingValueChanged() |
667 { | 685 { |
668 m_evaluateMediaQueriesOnStyleRecalc = true; | 686 m_evaluateMediaQueriesOnStyleRecalc = true; |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 InspectorInstrumentation::didRecalculateStyle(cookie, m_styleRecalcElementCo
unter); | 1784 InspectorInstrumentation::didRecalculateStyle(cookie, m_styleRecalcElementCo
unter); |
1767 } | 1785 } |
1768 | 1786 |
1769 void Document::updateStyle(StyleRecalcChange change) | 1787 void Document::updateStyle(StyleRecalcChange change) |
1770 { | 1788 { |
1771 TRACE_EVENT0("blink", "Document::updateStyle"); | 1789 TRACE_EVENT0("blink", "Document::updateStyle"); |
1772 | 1790 |
1773 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; | 1791 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; |
1774 m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc); | 1792 m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc); |
1775 | 1793 |
| 1794 UseNthIndexCacheScope nthIndexScope(*this); |
| 1795 |
1776 if (styleChangeType() >= SubtreeStyleChange) | 1796 if (styleChangeType() >= SubtreeStyleChange) |
1777 change = Force; | 1797 change = Force; |
1778 | 1798 |
1779 // FIXME: Cannot access the ensureStyleResolver() before calling styleForDoc
ument below because | 1799 // FIXME: Cannot access the ensureStyleResolver() before calling styleForDoc
ument below because |
1780 // apparently the StyleResolver's constructor has side effects. We should fi
x it. | 1800 // apparently the StyleResolver's constructor has side effects. We should fi
x it. |
1781 // See printing/setPrinting.html, printing/width-overflow.html though they o
nly fail on | 1801 // See printing/setPrinting.html, printing/width-overflow.html though they o
nly fail on |
1782 // mac when accessing the resolver by what appears to be a viewport size dif
ference. | 1802 // mac when accessing the resolver by what appears to be a viewport size dif
ference. |
1783 | 1803 |
1784 if (change == Force) { | 1804 if (change == Force) { |
1785 m_hasNodesWithPlaceholderStyle = false; | 1805 m_hasNodesWithPlaceholderStyle = false; |
(...skipping 3921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5707 visitor->trace(m_elementDataCache); | 5727 visitor->trace(m_elementDataCache); |
5708 visitor->trace(m_associatedFormControls); | 5728 visitor->trace(m_associatedFormControls); |
5709 visitor->trace(m_useElementsNeedingUpdate); | 5729 visitor->trace(m_useElementsNeedingUpdate); |
5710 visitor->trace(m_layerUpdateSVGFilterElements); | 5730 visitor->trace(m_layerUpdateSVGFilterElements); |
5711 visitor->trace(m_timers); | 5731 visitor->trace(m_timers); |
5712 visitor->trace(m_templateDocument); | 5732 visitor->trace(m_templateDocument); |
5713 visitor->trace(m_templateDocumentHost); | 5733 visitor->trace(m_templateDocumentHost); |
5714 visitor->trace(m_visibilityObservers); | 5734 visitor->trace(m_visibilityObservers); |
5715 visitor->trace(m_userActionElements); | 5735 visitor->trace(m_userActionElements); |
5716 visitor->trace(m_svgExtensions); | 5736 visitor->trace(m_svgExtensions); |
| 5737 visitor->trace(m_nthIndexCache); |
5717 visitor->trace(m_timeline); | 5738 visitor->trace(m_timeline); |
5718 visitor->trace(m_compositorPendingAnimations); | 5739 visitor->trace(m_compositorPendingAnimations); |
5719 visitor->trace(m_contextDocument); | 5740 visitor->trace(m_contextDocument); |
5720 visitor->template registerWeakMembers<Document, &Document::clearWeakMembers>
(this); | 5741 visitor->template registerWeakMembers<Document, &Document::clearWeakMembers>
(this); |
5721 DocumentSupplementable::trace(visitor); | 5742 DocumentSupplementable::trace(visitor); |
5722 #endif | 5743 #endif |
5723 TreeScope::trace(visitor); | 5744 TreeScope::trace(visitor); |
5724 ContainerNode::trace(visitor); | 5745 ContainerNode::trace(visitor); |
5725 ExecutionContext::trace(visitor); | 5746 ExecutionContext::trace(visitor); |
5726 DocumentLifecycleNotifier::trace(visitor); | 5747 DocumentLifecycleNotifier::trace(visitor); |
5727 } | 5748 } |
5728 | 5749 |
5729 } // namespace blink | 5750 } // namespace blink |
5730 | 5751 |
5731 #ifndef NDEBUG | 5752 #ifndef NDEBUG |
5732 using namespace blink; | 5753 using namespace blink; |
5733 void showLiveDocumentInstances() | 5754 void showLiveDocumentInstances() |
5734 { | 5755 { |
5735 WeakDocumentSet& set = liveDocumentSet(); | 5756 WeakDocumentSet& set = liveDocumentSet(); |
5736 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5757 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5737 for (Document* document : set) | 5758 for (Document* document : set) |
5738 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5759 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
5739 } | 5760 } |
5740 #endif | 5761 #endif |
OLD | NEW |