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 = adoptPtr(new NthIndexCache(*this)); | |
sof
2015/03/28 08:33:59
adoptPtrWillBeNoop() -- would be tidier to provide
rune
2015/03/30 09:00:03
Done.
sof
2015/03/30 20:55:16
Oh, not quite, you're still using adoptPtr() -- ou
| |
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 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1706 | 1724 |
1707 if (!view() || !isActive()) | 1725 if (!view() || !isActive()) |
1708 return; | 1726 return; |
1709 | 1727 |
1710 if (change != Force && !needsRenderTreeUpdate()) | 1728 if (change != Force && !needsRenderTreeUpdate()) |
1711 return; | 1729 return; |
1712 | 1730 |
1713 if (inStyleRecalc()) | 1731 if (inStyleRecalc()) |
1714 return; | 1732 return; |
1715 | 1733 |
1734 UseNthIndexCacheScope nthIndexScope(*this); | |
1735 | |
1716 // Entering here from inside layout or paint would be catastrophic since rec alcStyle can | 1736 // Entering here from inside layout or paint would be catastrophic since rec alcStyle can |
1717 // tear down the render tree or (unfortunately) run script. Kill the whole r enderer if | 1737 // tear down the render tree or (unfortunately) run script. Kill the whole r enderer if |
1718 // someone managed to get into here from inside layout or paint. | 1738 // someone managed to get into here from inside layout or paint. |
1719 RELEASE_ASSERT(!view()->isInPerformLayout()); | 1739 RELEASE_ASSERT(!view()->isInPerformLayout()); |
1720 RELEASE_ASSERT(!view()->isPainting()); | 1740 RELEASE_ASSERT(!view()->isPainting()); |
1721 | 1741 |
1722 // Script can run below in WidgetUpdates, so protect the LocalFrame. | 1742 // Script can run below in WidgetUpdates, so protect the LocalFrame. |
1723 // FIXME: Can this still happen? How does script run inside | 1743 // FIXME: Can this still happen? How does script run inside |
1724 // UpdateSuspendScope::performDeferredWidgetTreeOperations() ? | 1744 // UpdateSuspendScope::performDeferredWidgetTreeOperations() ? |
1725 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); | 1745 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
(...skipping 4005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5731 #ifndef NDEBUG | 5751 #ifndef NDEBUG |
5732 using namespace blink; | 5752 using namespace blink; |
5733 void showLiveDocumentInstances() | 5753 void showLiveDocumentInstances() |
5734 { | 5754 { |
5735 WeakDocumentSet& set = liveDocumentSet(); | 5755 WeakDocumentSet& set = liveDocumentSet(); |
5736 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5756 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5737 for (Document* document : set) | 5757 for (Document* document : set) |
5738 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); | 5758 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); |
5739 } | 5759 } |
5740 #endif | 5760 #endif |
OLD | NEW |