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

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

Issue 1023393002: Cache element indices for :nth-child and :nth-last-child selectors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Back to stack-based cache Created 5 years, 8 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 InspectorInstrumentation::didRecalculateStyle(cookie, m_styleRecalcElementCo unter); 1767 InspectorInstrumentation::didRecalculateStyle(cookie, m_styleRecalcElementCo unter);
1767 } 1768 }
1768 1769
1769 void Document::updateStyle(StyleRecalcChange change) 1770 void Document::updateStyle(StyleRecalcChange change)
1770 { 1771 {
1771 TRACE_EVENT0("blink", "Document::updateStyle"); 1772 TRACE_EVENT0("blink", "Document::updateStyle");
1772 1773
1773 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; 1774 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates;
1774 m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc); 1775 m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc);
1775 1776
1777 NthIndexCache nthIndexCache(*this);
1778
1776 if (styleChangeType() >= SubtreeStyleChange) 1779 if (styleChangeType() >= SubtreeStyleChange)
1777 change = Force; 1780 change = Force;
1778 1781
1779 // FIXME: Cannot access the ensureStyleResolver() before calling styleForDoc ument below because 1782 // 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. 1783 // 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 1784 // 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. 1785 // mac when accessing the resolver by what appears to be a viewport size dif ference.
1783 1786
1784 if (change == Force) { 1787 if (change == Force) {
1785 m_hasNodesWithPlaceholderStyle = false; 1788 m_hasNodesWithPlaceholderStyle = false;
(...skipping 3945 matching lines...) Expand 10 before | Expand all | Expand 10 after
5731 #ifndef NDEBUG 5734 #ifndef NDEBUG
5732 using namespace blink; 5735 using namespace blink;
5733 void showLiveDocumentInstances() 5736 void showLiveDocumentInstances()
5734 { 5737 {
5735 WeakDocumentSet& set = liveDocumentSet(); 5738 WeakDocumentSet& set = liveDocumentSet();
5736 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5739 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5737 for (Document* document : set) 5740 for (Document* document : set)
5738 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5741 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5739 } 5742 }
5740 #endif 5743 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698