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

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: Rebased Created 7 years, 1 month 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 const CSSParserContext& parserContext() const { return m_parserContext; } 61 const CSSParserContext& parserContext() const { return m_parserContext; }
62 62
63 const AtomicString& determineNamespace(const AtomicString& prefix); 63 const AtomicString& determineNamespace(const AtomicString& prefix);
64 64
65 void parseAuthorStyleSheet(const CSSStyleSheetResource*, const SecurityOrigi n*); 65 void parseAuthorStyleSheet(const CSSStyleSheetResource*, const SecurityOrigi n*);
66 bool parseString(const String&); 66 bool parseString(const String&);
67 bool parseStringAtPosition(const String&, const TextPosition&, bool); 67 bool parseStringAtPosition(const String&, const TextPosition&, bool);
68 68
69 bool isCacheable() const; 69 bool isCacheable() const;
70 bool maybeCacheable() const;
70 71
71 bool isLoading() const; 72 bool isLoading() const;
72 73
74 void checkLoadedFor(PassRefPtr<Node>);
73 void checkLoaded(); 75 void checkLoaded();
74 void startLoadingDynamicSheet(); 76 void startLoadingDynamicSheet();
75 77
76 StyleSheetContents* rootStyleSheet() const; 78 StyleSheetContents* rootStyleSheet() const;
77 bool hasSingleOwnerNode() const; 79 bool hasSingleOwnerNode() const;
78 Node* singleOwnerNode() const; 80 Node* singleOwnerNode() const;
79 Document* singleOwnerDocument() const; 81 Document* singleOwnerDocument() const;
80 82
81 const String& charset() const { return m_parserContext.charset; } 83 const String& charset() const { return m_parserContext.charset; }
82 84
83 bool loadCompleted() const { return m_loadCompleted; } 85 bool loadCompleted() const { return m_loadCompleted; }
84 bool hasFailedOrCanceledSubresources() const; 86 bool hasFailedOrCanceledSubresources() const;
85 87
86 KURL completeURL(const String& url) const; 88 KURL completeURL(const String& url) const;
87 void addSubresourceStyleURLs(ListHashSet<KURL>&); 89 void addSubresourceStyleURLs(ListHashSet<KURL>&);
88 90
89 void setHasSyntacticallyValidCSSHeader(bool b) { m_hasSyntacticallyValidCSSH eader = b; } 91 void setHasSyntacticallyValidCSSHeader(bool isValidCss);
90 bool hasSyntacticallyValidCSSHeader() const { return m_hasSyntacticallyValid CSSHeader; } 92 bool hasSyntacticallyValidCSSHeader() const { return m_hasSyntacticallyValid CSSHeader; }
91 93
92 void parserAddNamespace(const AtomicString& prefix, const AtomicString& uri) ; 94 void parserAddNamespace(const AtomicString& prefix, const AtomicString& uri) ;
93 void parserAppendRule(PassRefPtr<StyleRuleBase>); 95 void parserAppendRule(PassRefPtr<StyleRuleBase>);
94 void parserSetEncodingFromCharsetRule(const String& encoding); 96 void parserSetEncodingFromCharsetRule(const String& encoding);
95 void parserSetUsesRemUnits(bool b) { m_usesRemUnits = b; } 97 void parserSetUsesRemUnits(bool b) { m_usesRemUnits = b; }
96 98
97 void clearRules(); 99 void clearRules();
98 100
99 bool hasCharsetRule() const { return !m_encodingFromCharsetRule.isNull(); } 101 bool hasCharsetRule() const { return !m_encodingFromCharsetRule.isNull(); }
(...skipping 24 matching lines...) Expand all
124 bool wrapperInsertRule(PassRefPtr<StyleRuleBase>, unsigned index); 126 bool wrapperInsertRule(PassRefPtr<StyleRuleBase>, unsigned index);
125 void wrapperDeleteRule(unsigned index); 127 void wrapperDeleteRule(unsigned index);
126 128
127 PassRefPtr<StyleSheetContents> copy() const { return adoptRef(new StyleSheet Contents(*this)); } 129 PassRefPtr<StyleSheetContents> copy() const { return adoptRef(new StyleSheet Contents(*this)); }
128 130
129 void registerClient(CSSStyleSheet*); 131 void registerClient(CSSStyleSheet*);
130 void unregisterClient(CSSStyleSheet*); 132 void unregisterClient(CSSStyleSheet*);
131 bool hasOneClient() { return m_clients.size() == 1; } 133 bool hasOneClient() { return m_clients.size() == 1; }
132 134
133 bool isMutable() const { return m_isMutable; } 135 bool isMutable() const { return m_isMutable; }
134 void setMutable() { m_isMutable = true; } 136 void setMutable();
135 137
136 bool isInMemoryCache() const { return m_isInMemoryCache; } 138 bool isInMemoryCache() const { return m_isInMemoryCache; }
137 void addedToMemoryCache(); 139 void addedToMemoryCache();
138 void removedFromMemoryCache(); 140 void removedFromMemoryCache();
139 141
140 void shrinkToFit(); 142 void shrinkToFit();
141 143
142 private: 144 private:
143 StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, co nst CSSParserContext&); 145 StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, co nst CSSParserContext&);
144 StyleSheetContents(const StyleSheetContents&); 146 StyleSheetContents(const StyleSheetContents&);
145 147
146 void clearCharsetRule(); 148 void clearCharsetRule();
149 void clearCache();
147 150
148 StyleRuleImport* m_ownerRule; 151 StyleRuleImport* m_ownerRule;
149 152
150 String m_originalURL; 153 String m_originalURL;
151 154
152 String m_encodingFromCharsetRule; 155 String m_encodingFromCharsetRule;
153 Vector<RefPtr<StyleRuleImport> > m_importRules; 156 Vector<RefPtr<StyleRuleImport> > m_importRules;
154 Vector<RefPtr<StyleRuleBase> > m_childRules; 157 Vector<RefPtr<StyleRuleBase> > m_childRules;
155 typedef HashMap<AtomicString, AtomicString> PrefixNamespaceURIMap; 158 typedef HashMap<AtomicString, AtomicString> PrefixNamespaceURIMap;
156 PrefixNamespaceURIMap m_namespaces; 159 PrefixNamespaceURIMap m_namespaces;
157 160
158 bool m_loadCompleted : 1; 161 bool m_loadCompleted : 1;
159 bool m_hasSyntacticallyValidCSSHeader : 1; 162 bool m_hasSyntacticallyValidCSSHeader : 1;
160 bool m_didLoadErrorOccur : 1; 163 bool m_didLoadErrorOccur : 1;
161 bool m_usesRemUnits : 1; 164 bool m_usesRemUnits : 1;
162 bool m_isMutable : 1; 165 bool m_isMutable : 1;
163 bool m_isInMemoryCache : 1; 166 bool m_isInMemoryCache : 1;
164 167
165 CSSParserContext m_parserContext; 168 CSSParserContext m_parserContext;
166 169
167 Vector<CSSStyleSheet*> m_clients; 170 Vector<CSSStyleSheet*> m_clients;
168 }; 171 };
169 172
170 } // namespace 173 } // namespace
171 174
172 #endif 175 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698