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

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: Created 7 years, 2 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
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 17 matching lines...) Expand all
28 #ifndef StyleEngine_h 28 #ifndef StyleEngine_h
29 #define StyleEngine_h 29 #define StyleEngine_h
30 30
31 #include "core/dom/Document.h" 31 #include "core/dom/Document.h"
32 #include "core/dom/DocumentOrderedList.h" 32 #include "core/dom/DocumentOrderedList.h"
33 #include "core/dom/DocumentStyleSheetCollection.h" 33 #include "core/dom/DocumentStyleSheetCollection.h"
34 #include "wtf/FastAllocBase.h" 34 #include "wtf/FastAllocBase.h"
35 #include "wtf/ListHashSet.h" 35 #include "wtf/ListHashSet.h"
36 #include "wtf/RefPtr.h" 36 #include "wtf/RefPtr.h"
37 #include "wtf/Vector.h" 37 #include "wtf/Vector.h"
38 #include "wtf/text/AtomicString.h"
38 #include "wtf/text/WTFString.h" 39 #include "wtf/text/WTFString.h"
39 40
40 namespace WebCore { 41 namespace WebCore {
41 42
42 class CSSStyleSheet; 43 class CSSStyleSheet;
43 class Node; 44 class Node;
44 class RuleFeatureSet; 45 class RuleFeatureSet;
45 class ShadowTreeStyleSheetCollection; 46 class ShadowTreeStyleSheetCollection;
46 class StyleSheet; 47 class StyleSheet;
47 class StyleSheetCollection; 48 class StyleSheetCollection;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 bool hasScopedStyleSheet() { return m_documentStyleSheetCollection.scopingNo desForStyleScoped(); } 104 bool hasScopedStyleSheet() { return m_documentStyleSheetCollection.scopingNo desForStyleScoped(); }
104 105
105 void combineCSSFeatureFlags(const RuleFeatureSet&); 106 void combineCSSFeatureFlags(const RuleFeatureSet&);
106 void resetCSSFeatureFlags(const RuleFeatureSet&); 107 void resetCSSFeatureFlags(const RuleFeatureSet&);
107 108
108 void didModifySeamlessParentStyleSheet() { m_needsDocumentStyleSheetsUpdate = true; } 109 void didModifySeamlessParentStyleSheet() { m_needsDocumentStyleSheetsUpdate = true; }
109 void didRemoveShadowRoot(ShadowRoot*); 110 void didRemoveShadowRoot(ShadowRoot*);
110 void appendActiveAuthorStyleSheets(StyleResolver*); 111 void appendActiveAuthorStyleSheets(StyleResolver*);
111 void getActiveAuthorStyleSheets(Vector<const Vector<RefPtr<CSSStyleSheet> >* >& activeAuthorStyleSheets) const; 112 void getActiveAuthorStyleSheets(Vector<const Vector<RefPtr<CSSStyleSheet> >* >& activeAuthorStyleSheets) const;
112 113
114 // CSSStyleContents cache.
115 StyleSheetContents* findStyleSheetContents(const AtomicString&);
116 void registerStyleSheetContents(const AtomicString&, StyleSheetContents*);
117 void unregisterStyleSheetContents(const AtomicString&);
118
113 private: 119 private:
114 StyleEngine(Document&); 120 StyleEngine(Document&);
115 121
116 StyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&); 122 StyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&);
117 StyleSheetCollection* styleSheetCollectionFor(TreeScope&); 123 StyleSheetCollection* styleSheetCollectionFor(TreeScope&);
118 void activeStyleSheetsUpdatedForInspector(); 124 void activeStyleSheetsUpdatedForInspector();
119 bool shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode); 125 bool shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode);
120 126
121 typedef ListHashSet<TreeScope*, 16> TreeScopeSet; 127 typedef ListHashSet<TreeScope*, 16> TreeScopeSet;
122 static void insertTreeScopeInDocumentOrder(TreeScopeSet&, TreeScope*); 128 static void insertTreeScopeInDocumentOrder(TreeScopeSet&, TreeScope*);
(...skipping 24 matching lines...) Expand all
147 bool m_needsDocumentStyleSheetsUpdate; 153 bool m_needsDocumentStyleSheetsUpdate;
148 154
149 String m_preferredStylesheetSetName; 155 String m_preferredStylesheetSetName;
150 String m_selectedStylesheetSetName; 156 String m_selectedStylesheetSetName;
151 157
152 bool m_usesSiblingRules; 158 bool m_usesSiblingRules;
153 bool m_usesSiblingRulesOverride; 159 bool m_usesSiblingRulesOverride;
154 bool m_usesFirstLineRules; 160 bool m_usesFirstLineRules;
155 bool m_usesFirstLetterRules; 161 bool m_usesFirstLetterRules;
156 bool m_usesRemUnits; 162 bool m_usesRemUnits;
163
164 // Mapping from textContents of StyleElement to a pair of StyleSheetContent( second) and its usages(first).
dglazkov 2013/10/18 16:56:19 Can we move this into a separate class, which is c
tasak 2013/10/21 12:27:37 Done.
165 HashMap<AtomicString, std::pair<unsigned, RefPtr<StyleSheetContents> > > m_s tyleSheetContentsCache;
157 }; 166 };
158 167
159 } 168 }
160 169
161 #endif 170 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698