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

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

Issue 199633020: Move all style invalidation code into the css/invalidation directory. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Merge. Created 6 years, 9 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/StyleEngine.cpp ('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, 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 10 matching lines...) Expand all
21 * You should have received a copy of the GNU Library General Public License 21 * You should have received a copy of the GNU Library General Public License
22 * along with this library; see the file COPYING.LIB. If not, write to 22 * along with this library; see the file COPYING.LIB. If not, write to
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301, USA. 24 * Boston, MA 02110-1301, USA.
25 */ 25 */
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "core/dom/TreeScopeStyleSheetCollection.h" 28 #include "core/dom/TreeScopeStyleSheetCollection.h"
29 29
30 #include "core/css/CSSStyleSheet.h" 30 #include "core/css/CSSStyleSheet.h"
31 #include "core/css/StyleInvalidationAnalysis.h"
32 #include "core/css/StyleRuleImport.h" 31 #include "core/css/StyleRuleImport.h"
33 #include "core/css/StyleSheetContents.h" 32 #include "core/css/StyleSheetContents.h"
33 #include "core/css/invalidation/StyleSheetInvalidationAnalysis.h"
34 #include "core/css/resolver/StyleResolver.h" 34 #include "core/css/resolver/StyleResolver.h"
35 #include "core/dom/Element.h" 35 #include "core/dom/Element.h"
36 #include "core/dom/StyleEngine.h" 36 #include "core/dom/StyleEngine.h"
37 #include "core/html/HTMLStyleElement.h" 37 #include "core/html/HTMLStyleElement.h"
38 38
39 namespace WebCore { 39 namespace WebCore {
40 40
41 TreeScopeStyleSheetCollection::TreeScopeStyleSheetCollection(TreeScope& treeScop e) 41 TreeScopeStyleSheetCollection::TreeScopeStyleSheetCollection(TreeScope& treeScop e)
42 : m_treeScope(treeScope) 42 : m_treeScope(treeScope)
43 , m_hadActiveLoadingStylesheet(false) 43 , m_hadActiveLoadingStylesheet(false)
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 change.styleResolverUpdateType = updateType; 154 change.styleResolverUpdateType = updateType;
155 } else { 155 } else {
156 change.styleResolverUpdateType = Reset; 156 change.styleResolverUpdateType = Reset;
157 // If @font-face is removed, needs full style recalc. 157 // If @font-face is removed, needs full style recalc.
158 if (findFontFaceRulesFromStyleSheetContents(addedSheets, change.font FaceRulesToRemove)) 158 if (findFontFaceRulesFromStyleSheetContents(addedSheets, change.font FaceRulesToRemove))
159 return; 159 return;
160 } 160 }
161 } 161 }
162 162
163 // FIXME: If styleResolverUpdateType is Reconstruct, we should return early here since 163 // FIXME: If styleResolverUpdateType is Reconstruct, we should return early here since
164 // we need to recalc the whole document. It's wrong to use StyleInvalidation Analysis since 164 // we need to recalc the whole document. It's wrong to use StyleSheetInvalid ationAnalysis since
165 // it only looks at the addedSheets. 165 // it only looks at the addedSheets.
166 166
167 // No point in doing the analysis work if we're just going to recalc the who le document anyways. 167 // No point in doing the analysis work if we're just going to recalc the who le document anyways.
168 // This needs to be done after the compareStyleSheets calls above to ensure we don't throw away 168 // This needs to be done after the compareStyleSheets calls above to ensure we don't throw away
169 // the StyleResolver if we don't need to. 169 // the StyleResolver if we don't need to.
170 if (document().hasPendingForcedStyleRecalc()) 170 if (document().hasPendingForcedStyleRecalc())
171 return; 171 return;
172 172
173 // If we are already parsing the body and so may have significant amount of elements, put some effort into trying to avoid style recalcs. 173 // If we are already parsing the body and so may have significant amount of elements, put some effort into trying to avoid style recalcs.
174 if (!document().body() || document().hasNodesWithPlaceholderStyle()) 174 if (!document().body() || document().hasNodesWithPlaceholderStyle())
175 return; 175 return;
176 StyleInvalidationAnalysis invalidationAnalysis(addedSheets); 176 StyleSheetInvalidationAnalysis invalidationAnalysis(addedSheets);
177 if (invalidationAnalysis.dirtiesAllStyle()) 177 if (invalidationAnalysis.dirtiesAllStyle())
178 return; 178 return;
179 invalidationAnalysis.invalidateStyle(document()); 179 invalidationAnalysis.invalidateStyle(document());
180 change.requiresFullStyleRecalc = false; 180 change.requiresFullStyleRecalc = false;
181 return; 181 return;
182 } 182 }
183 183
184 void TreeScopeStyleSheetCollection::clearMediaQueryRuleSetStyleSheets() 184 void TreeScopeStyleSheetCollection::clearMediaQueryRuleSetStyleSheets()
185 { 185 {
186 for (size_t i = 0; i < m_activeAuthorStyleSheets.size(); ++i) { 186 for (size_t i = 0; i < m_activeAuthorStyleSheets.size(); ++i) {
(...skipping 25 matching lines...) Expand all
212 } 212 }
213 return false; 213 return false;
214 } 214 }
215 215
216 void TreeScopeStyleSheetCollection::updateUsesRemUnits() 216 void TreeScopeStyleSheetCollection::updateUsesRemUnits()
217 { 217 {
218 m_usesRemUnits = styleSheetsUseRemUnits(m_activeAuthorStyleSheets); 218 m_usesRemUnits = styleSheetsUseRemUnits(m_activeAuthorStyleSheets);
219 } 219 }
220 220
221 } 221 }
OLDNEW
« no previous file with comments | « Source/core/dom/StyleEngine.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698