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

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

Issue 330043002: Simplified code for styleResolverChanged. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
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, 2010, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 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) 2010 Nokia Corporation and/or its subsidiary(-ies) 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
9 * Copyright (C) 2013 Google Inc. All rights reserved. 9 * Copyright (C) 2013 Google Inc. All rights reserved.
10 * 10 *
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 void DocumentStyleSheetCollection::collectStyleSheets(StyleEngine* engine, Docum entStyleSheetCollector& collector) 85 void DocumentStyleSheetCollection::collectStyleSheets(StyleEngine* engine, Docum entStyleSheetCollector& collector)
86 { 86 {
87 ASSERT(document().styleEngine() == engine); 87 ASSERT(document().styleEngine() == engine);
88 collector.appendActiveStyleSheets(engine->injectedAuthorStyleSheets()); 88 collector.appendActiveStyleSheets(engine->injectedAuthorStyleSheets());
89 collector.appendActiveStyleSheets(engine->documentAuthorStyleSheets()); 89 collector.appendActiveStyleSheets(engine->documentAuthorStyleSheets());
90 collectStyleSheetsFromCandidates(engine, collector); 90 collectStyleSheetsFromCandidates(engine, collector);
91 } 91 }
92 92
93 bool DocumentStyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine, StyleResolverUpdateMode updateMode) 93 void DocumentStyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine, StyleResolverUpdateMode updateMode)
94 { 94 {
95 StyleSheetCollection collection; 95 StyleSheetCollection collection;
96 ActiveDocumentStyleSheetCollector collector(collection); 96 ActiveDocumentStyleSheetCollector collector(collection);
97 collectStyleSheets(engine, collector); 97 collectStyleSheets(engine, collector);
98 98
99 StyleSheetChange change; 99 StyleSheetChange change;
100 analyzeStyleSheetChange(updateMode, collection, change); 100 analyzeStyleSheetChange(updateMode, collection, change);
101 101
102 if (change.styleResolverUpdateType == Reconstruct) { 102 if (change.styleResolverUpdateType == Reconstruct) {
103 engine->clearMasterResolver(); 103 engine->clearMasterResolver();
104 // FIMXE: The following depends on whether StyleRuleFontFace was modifie d or not. 104 // FIMXE: The following depends on whether StyleRuleFontFace was modifie d or not.
105 // No need to always-clear font cache. 105 // No need to always-clear font cache.
106 engine->clearFontCache(); 106 engine->clearFontCache();
107 } else if (StyleResolver* styleResolver = engine->resolver()) { 107 } else if (StyleResolver* styleResolver = engine->resolver()) {
108 // FIXME: We might have already had styles in child treescope. In this c ase, we cannot use buildScopedStyleTreeInDocumentOrder. 108 // FIXME: We might have already had styles in child treescope. In this c ase, we cannot use buildScopedStyleTreeInDocumentOrder.
109 // Need to change "false" to some valid condition. 109 // Need to change "false" to some valid condition.
110 styleResolver->setBuildScopedStyleTreeInDocumentOrder(false); 110 styleResolver->setBuildScopedStyleTreeInDocumentOrder(false);
111 if (change.styleResolverUpdateType != Additive) { 111 if (change.styleResolverUpdateType != Additive) {
112 ASSERT(change.styleResolverUpdateType == Reset); 112 ASSERT(change.styleResolverUpdateType == Reset);
113 resetAllRuleSetsInTreeScope(styleResolver); 113 resetAllRuleSetsInTreeScope(styleResolver);
114 engine->removeFontFaceRules(change.fontFaceRulesToRemove); 114 engine->removeFontFaceRules(change.fontFaceRulesToRemove);
115 styleResolver->removePendingAuthorStyleSheets(m_activeAuthorStyleShe ets); 115 styleResolver->removePendingAuthorStyleSheets(m_activeAuthorStyleShe ets);
116 styleResolver->lazyAppendAuthorStyleSheets(0, collection.activeAutho rStyleSheets()); 116 styleResolver->lazyAppendAuthorStyleSheets(0, collection.activeAutho rStyleSheets());
117 } else { 117 } else {
118 styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets .size(), collection.activeAuthorStyleSheets()); 118 styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets .size(), collection.activeAuthorStyleSheets());
119 } 119 }
120 } 120 }
121 if (change.requiresFullStyleRecalc)
122 document().setNeedsStyleRecalc(SubtreeStyleChange);
123
121 m_scopingNodesForStyleScoped.didRemoveScopingNodes(); 124 m_scopingNodesForStyleScoped.didRemoveScopingNodes();
122 125
123 collection.swap(*this); 126 collection.swap(*this);
124 127
125 updateUsesRemUnits(); 128 updateUsesRemUnits();
126
127 return change.requiresFullStyleRecalc;
128 } 129 }
129 130
130 } 131 }
OLDNEW
« no previous file with comments | « Source/core/dom/DocumentStyleSheetCollection.h ('k') | Source/core/dom/ShadowTreeStyleSheetCollection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698