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

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: Missing initializer and incorrect assert. 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
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/NthIndexCache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 #include "core/dom/Microtask.h" 80 #include "core/dom/Microtask.h"
81 #include "core/dom/MutationObserver.h" 81 #include "core/dom/MutationObserver.h"
82 #include "core/dom/NodeChildRemovalTracker.h" 82 #include "core/dom/NodeChildRemovalTracker.h"
83 #include "core/dom/NodeFilter.h" 83 #include "core/dom/NodeFilter.h"
84 #include "core/dom/NodeIterator.h" 84 #include "core/dom/NodeIterator.h"
85 #include "core/dom/NodeComputedStyle.h" 85 #include "core/dom/NodeComputedStyle.h"
86 #include "core/dom/NodeRareData.h" 86 #include "core/dom/NodeRareData.h"
87 #include "core/dom/NodeRenderingTraversal.h" 87 #include "core/dom/NodeRenderingTraversal.h"
88 #include "core/dom/NodeTraversal.h" 88 #include "core/dom/NodeTraversal.h"
89 #include "core/dom/NodeWithIndex.h" 89 #include "core/dom/NodeWithIndex.h"
90 #include "core/dom/NthIndexCache.h"
90 #include "core/dom/ProcessingInstruction.h" 91 #include "core/dom/ProcessingInstruction.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"
99 #include "core/dom/VisitedLinkState.h" 100 #include "core/dom/VisitedLinkState.h"
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 InspectorInstrumentation::didRecalculateStyle(cookie, m_styleRecalcElementCo unter); 1763 InspectorInstrumentation::didRecalculateStyle(cookie, m_styleRecalcElementCo unter);
1763 } 1764 }
1764 1765
1765 void Document::updateStyle(StyleRecalcChange change) 1766 void Document::updateStyle(StyleRecalcChange change)
1766 { 1767 {
1767 TRACE_EVENT0("blink", "Document::updateStyle"); 1768 TRACE_EVENT0("blink", "Document::updateStyle");
1768 1769
1769 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; 1770 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates;
1770 m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc); 1771 m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc);
1771 1772
1773 NthIndexCache nthIndexCache(*this);
1774
1772 if (styleChangeType() >= SubtreeStyleChange) 1775 if (styleChangeType() >= SubtreeStyleChange)
1773 change = Force; 1776 change = Force;
1774 1777
1775 // FIXME: Cannot access the ensureStyleResolver() before calling styleForDoc ument below because 1778 // FIXME: Cannot access the ensureStyleResolver() before calling styleForDoc ument below because
1776 // apparently the StyleResolver's constructor has side effects. We should fi x it. 1779 // apparently the StyleResolver's constructor has side effects. We should fi x it.
1777 // See printing/setPrinting.html, printing/width-overflow.html though they o nly fail on 1780 // See printing/setPrinting.html, printing/width-overflow.html though they o nly fail on
1778 // mac when accessing the resolver by what appears to be a viewport size dif ference. 1781 // mac when accessing the resolver by what appears to be a viewport size dif ference.
1779 1782
1780 if (change == Force) { 1783 if (change == Force) {
1781 m_hasNodesWithPlaceholderStyle = false; 1784 m_hasNodesWithPlaceholderStyle = false;
(...skipping 3923 matching lines...) Expand 10 before | Expand all | Expand 10 after
5705 #ifndef NDEBUG 5708 #ifndef NDEBUG
5706 using namespace blink; 5709 using namespace blink;
5707 void showLiveDocumentInstances() 5710 void showLiveDocumentInstances()
5708 { 5711 {
5709 WeakDocumentSet& set = liveDocumentSet(); 5712 WeakDocumentSet& set = liveDocumentSet();
5710 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5713 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5711 for (Document* document : set) 5714 for (Document* document : set)
5712 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5715 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5713 } 5716 }
5714 #endif 5717 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/NthIndexCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698