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

Side by Side Diff: third_party/WebKit/Source/core/dom/StyleEngine.cpp

Issue 2590793003: Don't update global ruleset when active style is dirty. (Closed)
Patch Set: window.eventSender Created 4 years 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 | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | 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 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 348
349 bool StyleEngine::needsActiveStyleUpdate() const { 349 bool StyleEngine::needsActiveStyleUpdate() const {
350 return (m_viewportResolver && m_viewportResolver->needsUpdate()) || 350 return (m_viewportResolver && m_viewportResolver->needsUpdate()) ||
351 needsActiveStyleSheetUpdate() || m_globalRuleSet.isDirty(); 351 needsActiveStyleSheetUpdate() || m_globalRuleSet.isDirty();
352 } 352 }
353 353
354 void StyleEngine::updateActiveStyle() { 354 void StyleEngine::updateActiveStyle() {
355 DCHECK(document().isActive()); 355 DCHECK(document().isActive());
356 updateViewport(); 356 updateViewport();
357 updateActiveStyleSheets(); 357 updateActiveStyleSheets();
358 m_globalRuleSet.update(document()); 358 updateGlobalRuleSet();
359 } 359 }
360 360
361 const ActiveStyleSheetVector StyleEngine::activeStyleSheetsForInspector() { 361 const ActiveStyleSheetVector StyleEngine::activeStyleSheetsForInspector() {
362 if (document().isActive()) 362 if (document().isActive())
363 updateActiveStyle(); 363 updateActiveStyle();
364 364
365 if (m_activeTreeScopes.isEmpty()) 365 if (m_activeTreeScopes.isEmpty())
366 return documentStyleSheetCollection().activeAuthorStyleSheets(); 366 return documentStyleSheetCollection().activeAuthorStyleSheets();
367 367
368 ActiveStyleSheetVector activeStyleSheets; 368 ActiveStyleSheetVector activeStyleSheets;
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 924
925 void StyleEngine::setHttpDefaultStyle(const String& content) { 925 void StyleEngine::setHttpDefaultStyle(const String& content) {
926 setPreferredStylesheetSetNameIfNotSet(content); 926 setPreferredStylesheetSetNameIfNotSet(content);
927 } 927 }
928 928
929 void StyleEngine::ensureUAStyleForFullscreen() { 929 void StyleEngine::ensureUAStyleForFullscreen() {
930 if (m_globalRuleSet.hasFullscreenUAStyle()) 930 if (m_globalRuleSet.hasFullscreenUAStyle())
931 return; 931 return;
932 CSSDefaultStyleSheets::instance().ensureDefaultStyleSheetForFullscreen(); 932 CSSDefaultStyleSheets::instance().ensureDefaultStyleSheetForFullscreen();
933 m_globalRuleSet.markDirty(); 933 m_globalRuleSet.markDirty();
934 m_globalRuleSet.update(document()); 934 updateActiveStyle();
935 } 935 }
936 936
937 void StyleEngine::ensureUAStyleForElement(const Element& element) { 937 void StyleEngine::ensureUAStyleForElement(const Element& element) {
938 if (CSSDefaultStyleSheets::instance().ensureDefaultStyleSheetsForElement( 938 if (CSSDefaultStyleSheets::instance().ensureDefaultStyleSheetsForElement(
939 element)) { 939 element)) {
940 m_globalRuleSet.markDirty(); 940 m_globalRuleSet.markDirty();
941 m_globalRuleSet.update(document()); 941 updateActiveStyle();
942 } 942 }
943 } 943 }
944 944
945 bool StyleEngine::hasRulesForId(const AtomicString& id) const { 945 bool StyleEngine::hasRulesForId(const AtomicString& id) const {
946 return m_globalRuleSet.ruleFeatureSet().hasSelectorForId(id); 946 return m_globalRuleSet.ruleFeatureSet().hasSelectorForId(id);
947 } 947 }
948 948
949 void StyleEngine::initialViewportChanged() { 949 void StyleEngine::initialViewportChanged() {
950 if (m_viewportResolver) 950 if (m_viewportResolver)
951 m_viewportResolver->initialViewportChanged(); 951 m_viewportResolver->initialViewportChanged();
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 } 1144 }
1145 1145
1146 DEFINE_TRACE_WRAPPERS(StyleEngine) { 1146 DEFINE_TRACE_WRAPPERS(StyleEngine) {
1147 for (auto sheet : m_injectedAuthorStyleSheets) { 1147 for (auto sheet : m_injectedAuthorStyleSheets) {
1148 visitor->traceWrappers(sheet); 1148 visitor->traceWrappers(sheet);
1149 } 1149 }
1150 visitor->traceWrappers(m_documentStyleSheetCollection); 1150 visitor->traceWrappers(m_documentStyleSheetCollection);
1151 } 1151 }
1152 1152
1153 } // namespace blink 1153 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698