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

Side by Side Diff: Source/core/css/StyleSheetContents.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 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
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 const CSSParserContext& parserContext() const { return m_parserContext; } 64 const CSSParserContext& parserContext() const { return m_parserContext; }
65 65
66 const AtomicString& determineNamespace(const AtomicString& prefix); 66 const AtomicString& determineNamespace(const AtomicString& prefix);
67 67
68 void parseAuthorStyleSheet(const CSSStyleSheetResource*, const SecurityOrigi n*); 68 void parseAuthorStyleSheet(const CSSStyleSheetResource*, const SecurityOrigi n*);
69 bool parseString(const String&); 69 bool parseString(const String&);
70 bool parseStringAtPosition(const String&, const TextPosition&, bool); 70 bool parseStringAtPosition(const String&, const TextPosition&, bool);
71 71
72 bool isCacheable() const; 72 bool isCacheable() const;
73 bool maybeCacheable() const;
73 74
74 bool isLoading() const; 75 bool isLoading() const;
75 76
76 void checkLoaded(); 77 void checkLoaded();
77 void startLoadingDynamicSheet(); 78 void startLoadingDynamicSheet();
78 79
79 StyleSheetContents* rootStyleSheet() const; 80 StyleSheetContents* rootStyleSheet() const;
80 bool hasSingleOwnerNode() const; 81 bool hasSingleOwnerNode() const;
81 Node* singleOwnerNode() const; 82 Node* singleOwnerNode() const;
82 Document* singleOwnerDocument() const; 83 Document* singleOwnerDocument() const;
83 84
84 const String& charset() const { return m_parserContext.charset(); } 85 const String& charset() const { return m_parserContext.charset(); }
85 86
86 bool loadCompleted() const { return m_loadCompleted; } 87 bool loadCompleted() const;
87 bool hasFailedOrCanceledSubresources() const; 88 bool hasFailedOrCanceledSubresources() const;
88 89
89 KURL completeURL(const String& url) const; 90 KURL completeURL(const String& url) const;
90 91
91 void setHasSyntacticallyValidCSSHeader(bool b) { m_hasSyntacticallyValidCSSH eader = b; } 92 void setHasSyntacticallyValidCSSHeader(bool isValidCss);
92 bool hasSyntacticallyValidCSSHeader() const { return m_hasSyntacticallyValid CSSHeader; } 93 bool hasSyntacticallyValidCSSHeader() const { return m_hasSyntacticallyValid CSSHeader; }
93 94
94 void setHasFontFaceRule(bool b) { m_hasFontFaceRule = b; } 95 void setHasFontFaceRule(bool b) { m_hasFontFaceRule = b; }
95 bool hasFontFaceRule() const { return m_hasFontFaceRule; } 96 bool hasFontFaceRule() const { return m_hasFontFaceRule; }
96 void findFontFaceRules(Vector<const StyleRuleFontFace*>& fontFaceRules); 97 void findFontFaceRules(Vector<const StyleRuleFontFace*>& fontFaceRules);
97 98
98 void parserAddNamespace(const AtomicString& prefix, const AtomicString& uri) ; 99 void parserAddNamespace(const AtomicString& prefix, const AtomicString& uri) ;
99 void parserAppendRule(PassRefPtr<StyleRuleBase>); 100 void parserAppendRule(PassRefPtr<StyleRuleBase>);
100 void parserSetEncodingFromCharsetRule(const String& encoding); 101 void parserSetEncodingFromCharsetRule(const String& encoding);
101 void parserSetUsesRemUnits(bool b) { m_usesRemUnits = b; } 102 void parserSetUsesRemUnits(bool b) { m_usesRemUnits = b; }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 RuleSet& ruleSet() { ASSERT(m_ruleSet); return *m_ruleSet.get(); } 151 RuleSet& ruleSet() { ASSERT(m_ruleSet); return *m_ruleSet.get(); }
151 RuleSet& ensureRuleSet(const MediaQueryEvaluator&, AddRuleFlags); 152 RuleSet& ensureRuleSet(const MediaQueryEvaluator&, AddRuleFlags);
152 void clearRuleSet(); 153 void clearRuleSet();
153 154
154 private: 155 private:
155 StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, co nst CSSParserContext&); 156 StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, co nst CSSParserContext&);
156 StyleSheetContents(const StyleSheetContents&); 157 StyleSheetContents(const StyleSheetContents&);
157 void notifyRemoveFontFaceRule(const StyleRuleFontFace*); 158 void notifyRemoveFontFaceRule(const StyleRuleFontFace*);
158 159
159 void clearCharsetRule(); 160 void clearCharsetRule();
161 void clearCache();
160 162
161 StyleRuleImport* m_ownerRule; 163 StyleRuleImport* m_ownerRule;
162 164
163 String m_originalURL; 165 String m_originalURL;
164 166
165 String m_encodingFromCharsetRule; 167 String m_encodingFromCharsetRule;
166 Vector<RefPtr<StyleRuleImport> > m_importRules; 168 Vector<RefPtr<StyleRuleImport> > m_importRules;
167 Vector<RefPtr<StyleRuleBase> > m_childRules; 169 Vector<RefPtr<StyleRuleBase> > m_childRules;
168 typedef HashMap<AtomicString, AtomicString> PrefixNamespaceURIMap; 170 typedef HashMap<AtomicString, AtomicString> PrefixNamespaceURIMap;
169 PrefixNamespaceURIMap m_namespaces; 171 PrefixNamespaceURIMap m_namespaces;
170 172
171 bool m_loadCompleted : 1;
172 bool m_hasSyntacticallyValidCSSHeader : 1; 173 bool m_hasSyntacticallyValidCSSHeader : 1;
173 bool m_didLoadErrorOccur : 1; 174 bool m_didLoadErrorOccur : 1;
174 bool m_usesRemUnits : 1; 175 bool m_usesRemUnits : 1;
175 bool m_isMutable : 1; 176 bool m_isMutable : 1;
176 bool m_isInMemoryCache : 1; 177 bool m_isInMemoryCache : 1;
177 bool m_hasFontFaceRule : 1; 178 bool m_hasFontFaceRule : 1;
178 bool m_hasMediaQueries : 1; 179 bool m_hasMediaQueries : 1;
179 180
180 CSSParserContext m_parserContext; 181 CSSParserContext m_parserContext;
181 182
182 Vector<CSSStyleSheet*> m_clients; 183 Vector<CSSStyleSheet*> m_clients;
183 OwnPtr<RuleSet> m_ruleSet; 184 OwnPtr<RuleSet> m_ruleSet;
184 }; 185 };
185 186
186 } // namespace 187 } // namespace
187 188
188 #endif 189 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698