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

Side by Side Diff: Source/core/dom/StyleEngine.h

Issue 28553005: Avoid parsing css text if there are identical inline style blocks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing Created 6 years, 11 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 | « Source/core/dom/StyleElement.cpp ('k') | Source/core/dom/StyleEngine.cpp » ('j') | 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) 2011 Google Inc. All rights reserved. 9 * Copyright (C) 2011 Google Inc. All rights reserved.
10 * 10 *
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 void didAttach(); 169 void didAttach();
170 void didDetach(); 170 void didDetach();
171 bool shouldClearResolver() const; 171 bool shouldClearResolver() const;
172 StyleResolverChange resolverChanged(RecalcStyleTime, StyleResolverUpdateMode ); 172 StyleResolverChange resolverChanged(RecalcStyleTime, StyleResolverUpdateMode );
173 unsigned resolverAccessCount() const; 173 unsigned resolverAccessCount() const;
174 174
175 void collectDocumentActiveStyleSheets(StyleSheetCollectionBase&); 175 void collectDocumentActiveStyleSheets(StyleSheetCollectionBase&);
176 void markDocumentDirty(); 176 void markDocumentDirty();
177 177
178 static PassRefPtr<CSSStyleSheet> createSheet(Element*, const String& text, T extPosition startPosition, bool createdByParser);
179 static void removeSheet(StyleSheetContents*);
180
178 private: 181 private:
179 StyleEngine(Document&); 182 StyleEngine(Document&);
180 183
181 StyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&); 184 StyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&);
182 StyleSheetCollection* styleSheetCollectionFor(TreeScope&); 185 StyleSheetCollection* styleSheetCollectionFor(TreeScope&);
183 bool shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode); 186 bool shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode);
184 void resolverThrowawayTimerFired(Timer<StyleEngine>*); 187 void resolverThrowawayTimerFired(Timer<StyleEngine>*);
185 188
186 void markTreeScopeDirty(TreeScope&); 189 void markTreeScopeDirty(TreeScope&);
187 190
188 bool isMaster() const { return m_isMaster; } 191 bool isMaster() const { return m_isMaster; }
189 Document* master(); 192 Document* master();
190 193
191 typedef ListHashSet<TreeScope*, 16> TreeScopeSet; 194 typedef ListHashSet<TreeScope*, 16> TreeScopeSet;
192 static void insertTreeScopeInDocumentOrder(TreeScopeSet&, TreeScope*); 195 static void insertTreeScopeInDocumentOrder(TreeScopeSet&, TreeScope*);
193 void clearMediaQueryRuleSetOnTreeScopeStyleSheets(TreeScopeSet treeScopes); 196 void clearMediaQueryRuleSetOnTreeScopeStyleSheets(TreeScopeSet treeScopes);
194 197
195 void createResolver(); 198 void createResolver();
196 199
197 void notifyPendingStyleSheetAdded(); 200 void notifyPendingStyleSheetAdded();
198 void notifyPendingStyleSheetRemoved(RemovePendingSheetNotificationType); 201 void notifyPendingStyleSheetRemoved(RemovePendingSheetNotificationType);
199 202
203 static PassRefPtr<CSSStyleSheet> parseSheet(Element*, const String& text, Te xtPosition startPosition, bool createdByParser);
204
200 Document& m_document; 205 Document& m_document;
201 bool m_isMaster; 206 bool m_isMaster;
202 207
203 // Track the number of currently loading top-level stylesheets needed for re ndering. 208 // Track the number of currently loading top-level stylesheets needed for re ndering.
204 // Sheets loaded using the @import directive are not included in this count. 209 // Sheets loaded using the @import directive are not included in this count.
205 // We use this count of pending sheets to detect when we can begin attaching 210 // We use this count of pending sheets to detect when we can begin attaching
206 // elements and when it is safe to execute scripts. 211 // elements and when it is safe to execute scripts.
207 int m_pendingStylesheets; 212 int m_pendingStylesheets;
208 213
209 mutable Vector<RefPtr<CSSStyleSheet> > m_injectedAuthorStyleSheets; 214 mutable Vector<RefPtr<CSSStyleSheet> > m_injectedAuthorStyleSheets;
(...skipping 25 matching lines...) Expand all
235 unsigned m_lastResolverAccessCount; 240 unsigned m_lastResolverAccessCount;
236 Timer<StyleEngine> m_resolverThrowawayTimer; 241 Timer<StyleEngine> m_resolverThrowawayTimer;
237 OwnPtr<StyleResolver> m_resolver; 242 OwnPtr<StyleResolver> m_resolver;
238 243
239 RefPtr<CSSFontSelector> m_fontSelector; 244 RefPtr<CSSFontSelector> m_fontSelector;
240 }; 245 };
241 246
242 } 247 }
243 248
244 #endif 249 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/StyleElement.cpp ('k') | Source/core/dom/StyleEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698