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

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

Issue 1199563003: Remove hasResolver() check from Document::updateStyle. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Tracing. Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 if (change == Force) { 1801 if (change == Force) {
1802 m_hasNodesWithPlaceholderStyle = false; 1802 m_hasNodesWithPlaceholderStyle = false;
1803 RefPtr<ComputedStyle> documentStyle = StyleResolver::styleForDocument(*t his); 1803 RefPtr<ComputedStyle> documentStyle = StyleResolver::styleForDocument(*t his);
1804 StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff(docu mentStyle.get(), layoutView()->style()); 1804 StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff(docu mentStyle.get(), layoutView()->style());
1805 if (localChange != NoChange) 1805 if (localChange != NoChange)
1806 layoutView()->setStyle(documentStyle.release()); 1806 layoutView()->setStyle(documentStyle.release());
1807 } 1807 }
1808 1808
1809 clearNeedsStyleRecalc(); 1809 clearNeedsStyleRecalc();
1810 1810
1811 StyleResolver& resolver = ensureStyleResolver();
1812
1811 bool shouldRecordStats; 1813 bool shouldRecordStats;
1812 TRACE_EVENT_CATEGORY_GROUP_ENABLED("blink,blink_style", &shouldRecordStats); 1814 TRACE_EVENT_CATEGORY_GROUP_ENABLED("blink,blink_style", &shouldRecordStats);
1813 ensureStyleResolver().setStatsEnabled(shouldRecordStats); 1815 resolver.setStatsEnabled(shouldRecordStats);
1814 1816
1815 if (Element* documentElement = this->documentElement()) { 1817 if (Element* documentElement = this->documentElement()) {
1816 inheritHtmlAndBodyElementStyles(change); 1818 inheritHtmlAndBodyElementStyles(change);
1817 dirtyElementsForLayerUpdate(); 1819 dirtyElementsForLayerUpdate();
1818 if (documentElement->shouldCallRecalcStyle(change)) 1820 if (documentElement->shouldCallRecalcStyle(change))
1819 documentElement->recalcStyle(change); 1821 documentElement->recalcStyle(change);
1820 while (dirtyElementsForLayerUpdate()) 1822 while (dirtyElementsForLayerUpdate())
1821 documentElement->recalcStyle(NoChange); 1823 documentElement->recalcStyle(NoChange);
1822 } 1824 }
1823 1825
1824 view()->recalcOverflowAfterStyleChange(); 1826 view()->recalcOverflowAfterStyleChange();
1825 1827
1826 clearChildNeedsStyleRecalc(); 1828 clearChildNeedsStyleRecalc();
1827 1829
1828 if (styleEngine().hasResolver()) { 1830 // Pseudo element removal and similar may only work with these flags still s et. Reset them after the style recalc.
1829 // Pseudo element removal and similar may only work with these flags sti ll set. Reset them after the style recalc. 1831 styleEngine().resetCSSFeatureFlags(resolver.ensureUpdatedRuleFeatureSet());
1830 StyleResolver& resolver = styleEngine().ensureResolver(); 1832 resolver.clearStyleSharingList();
1831 styleEngine().resetCSSFeatureFlags(resolver.ensureUpdatedRuleFeatureSet( ));
1832 resolver.clearStyleSharingList();
1833 }
1834 1833
1835 ASSERT(!needsStyleRecalc()); 1834 ASSERT(!needsStyleRecalc());
1836 ASSERT(!childNeedsStyleRecalc()); 1835 ASSERT(!childNeedsStyleRecalc());
1837 ASSERT(inStyleRecalc()); 1836 ASSERT(inStyleRecalc());
1837 ASSERT(styleResolver() == &resolver);
1838 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); 1838 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean);
1839 RefPtr<TracedValue> counters = shouldRecordStats ? resolver.stats()->toTrace dValue() : nullptr;
1839 TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle", 1840 TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle",
1840 "resolverAccessCount", styleEngine().resolverAccessCount() - initialReso lverAccessCount, 1841 "resolverAccessCount", styleEngine().resolverAccessCount() - initialReso lverAccessCount,
1841 "counters", ensureStyleResolver().stats()->toTracedValue()); 1842 "counters", counters);
1842 } 1843 }
1843 1844
1844 void Document::notifyLayoutTreeOfSubtreeChanges() 1845 void Document::notifyLayoutTreeOfSubtreeChanges()
1845 { 1846 {
1846 if (!layoutView()->wasNotifiedOfSubtreeChange()) 1847 if (!layoutView()->wasNotifiedOfSubtreeChange())
1847 return; 1848 return;
1848 1849
1849 m_lifecycle.advanceTo(DocumentLifecycle::InLayoutSubtreeChange); 1850 m_lifecycle.advanceTo(DocumentLifecycle::InLayoutSubtreeChange);
1850 1851
1851 layoutView()->handleSubtreeModifications(); 1852 layoutView()->handleSubtreeModifications();
(...skipping 3887 matching lines...) Expand 10 before | Expand all | Expand 10 after
5739 #ifndef NDEBUG 5740 #ifndef NDEBUG
5740 using namespace blink; 5741 using namespace blink;
5741 void showLiveDocumentInstances() 5742 void showLiveDocumentInstances()
5742 { 5743 {
5743 WeakDocumentSet& set = liveDocumentSet(); 5744 WeakDocumentSet& set = liveDocumentSet();
5744 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5745 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5745 for (Document* document : set) 5746 for (Document* document : set)
5746 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5747 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5747 } 5748 }
5748 #endif 5749 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698