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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index d305ffb3d2a566c0ec7c61d0db9b06639882d94a..85850d0e9acbc061c1884361981972fbb43be4c0 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -1808,9 +1808,11 @@ void Document::updateStyle(StyleRecalcChange change)
clearNeedsStyleRecalc();
+ StyleResolver& resolver = ensureStyleResolver();
+
bool shouldRecordStats;
TRACE_EVENT_CATEGORY_GROUP_ENABLED("blink,blink_style", &shouldRecordStats);
- ensureStyleResolver().setStatsEnabled(shouldRecordStats);
+ resolver.setStatsEnabled(shouldRecordStats);
if (Element* documentElement = this->documentElement()) {
inheritHtmlAndBodyElementStyles(change);
@@ -1825,20 +1827,19 @@ void Document::updateStyle(StyleRecalcChange change)
clearChildNeedsStyleRecalc();
- if (styleEngine().hasResolver()) {
- // Pseudo element removal and similar may only work with these flags still set. Reset them after the style recalc.
- StyleResolver& resolver = styleEngine().ensureResolver();
- styleEngine().resetCSSFeatureFlags(resolver.ensureUpdatedRuleFeatureSet());
- resolver.clearStyleSharingList();
- }
+ // Pseudo element removal and similar may only work with these flags still set. Reset them after the style recalc.
+ styleEngine().resetCSSFeatureFlags(resolver.ensureUpdatedRuleFeatureSet());
+ resolver.clearStyleSharingList();
ASSERT(!needsStyleRecalc());
ASSERT(!childNeedsStyleRecalc());
ASSERT(inStyleRecalc());
+ ASSERT(styleResolver() == &resolver);
m_lifecycle.advanceTo(DocumentLifecycle::StyleClean);
+ RefPtr<TracedValue> counters = shouldRecordStats ? resolver.stats()->toTracedValue() : nullptr;
TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle",
"resolverAccessCount", styleEngine().resolverAccessCount() - initialResolverAccessCount,
- "counters", ensureStyleResolver().stats()->toTracedValue());
+ "counters", counters);
}
void Document::notifyLayoutTreeOfSubtreeChanges()
« 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