OLD | NEW |
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 14 matching lines...) Expand all Loading... |
25 * | 25 * |
26 */ | 26 */ |
27 | 27 |
28 #ifndef StyleEngine_h | 28 #ifndef StyleEngine_h |
29 #define StyleEngine_h | 29 #define StyleEngine_h |
30 | 30 |
31 #include "core/css/resolver/StyleResolver.h" | 31 #include "core/css/resolver/StyleResolver.h" |
32 #include "core/dom/Document.h" | 32 #include "core/dom/Document.h" |
33 #include "core/dom/DocumentOrderedList.h" | 33 #include "core/dom/DocumentOrderedList.h" |
34 #include "core/dom/DocumentStyleSheetCollection.h" | 34 #include "core/dom/DocumentStyleSheetCollection.h" |
| 35 #include "heap/Handle.h" |
35 #include "wtf/FastAllocBase.h" | 36 #include "wtf/FastAllocBase.h" |
36 #include "wtf/ListHashSet.h" | 37 #include "wtf/ListHashSet.h" |
37 #include "wtf/RefPtr.h" | 38 #include "wtf/RefPtr.h" |
38 #include "wtf/TemporaryChange.h" | 39 #include "wtf/TemporaryChange.h" |
39 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
40 #include "wtf/text/WTFString.h" | 41 #include "wtf/text/WTFString.h" |
41 | 42 |
42 namespace WebCore { | 43 namespace WebCore { |
43 | 44 |
44 class CSSFontSelector; | 45 class CSSFontSelector; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // updateGenericFontFamilySettings is used from WebSettingsImpl. | 178 // updateGenericFontFamilySettings is used from WebSettingsImpl. |
178 void updateGenericFontFamilySettings(); | 179 void updateGenericFontFamilySettings(); |
179 | 180 |
180 void didDetach(); | 181 void didDetach(); |
181 bool shouldClearResolver() const; | 182 bool shouldClearResolver() const; |
182 StyleResolverChange resolverChanged(RecalcStyleTime, StyleResolverUpdateMode
); | 183 StyleResolverChange resolverChanged(RecalcStyleTime, StyleResolverUpdateMode
); |
183 unsigned resolverAccessCount() const; | 184 unsigned resolverAccessCount() const; |
184 | 185 |
185 void markDocumentDirty(); | 186 void markDocumentDirty(); |
186 | 187 |
187 PassRefPtr<CSSStyleSheet> createSheet(Element*, const String& text, TextPosi
tion startPosition, bool createdByParser); | 188 PassRefPtrWillBeRawPtr<CSSStyleSheet> createSheet(Element*, const String& te
xt, TextPosition startPosition, bool createdByParser); |
188 void removeSheet(StyleSheetContents*); | 189 void removeSheet(StyleSheetContents*); |
189 | 190 |
190 void trace(Visitor*); | 191 void trace(Visitor*); |
191 | 192 |
192 private: | 193 private: |
193 StyleEngine(Document&); | 194 StyleEngine(Document&); |
194 | 195 |
195 TreeScopeStyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&); | 196 TreeScopeStyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&); |
196 TreeScopeStyleSheetCollection* styleSheetCollectionFor(TreeScope&); | 197 TreeScopeStyleSheetCollection* styleSheetCollectionFor(TreeScope&); |
197 bool shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode); | 198 bool shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode); |
198 | 199 |
199 void markTreeScopeDirty(TreeScope&); | 200 void markTreeScopeDirty(TreeScope&); |
200 | 201 |
201 bool isMaster() const { return m_isMaster; } | 202 bool isMaster() const { return m_isMaster; } |
202 Document* master(); | 203 Document* master(); |
203 | 204 |
204 typedef ListHashSet<TreeScope*, 16> TreeScopeSet; | 205 typedef ListHashSet<TreeScope*, 16> TreeScopeSet; |
205 static void insertTreeScopeInDocumentOrder(TreeScopeSet&, TreeScope*); | 206 static void insertTreeScopeInDocumentOrder(TreeScopeSet&, TreeScope*); |
206 void clearMediaQueryRuleSetOnTreeScopeStyleSheets(TreeScopeSet treeScopes); | 207 void clearMediaQueryRuleSetOnTreeScopeStyleSheets(TreeScopeSet treeScopes); |
207 | 208 |
208 void createResolver(); | 209 void createResolver(); |
209 | 210 |
210 static PassRefPtr<CSSStyleSheet> parseSheet(Element*, const String& text, Te
xtPosition startPosition, bool createdByParser); | 211 static PassRefPtrWillBeRawPtr<CSSStyleSheet> parseSheet(Element*, const Stri
ng& text, TextPosition startPosition, bool createdByParser); |
211 | 212 |
212 Document& m_document; | 213 Document& m_document; |
213 bool m_isMaster; | 214 bool m_isMaster; |
214 | 215 |
215 // Track the number of currently loading top-level stylesheets needed for re
ndering. | 216 // Track the number of currently loading top-level stylesheets needed for re
ndering. |
216 // Sheets loaded using the @import directive are not included in this count. | 217 // Sheets loaded using the @import directive are not included in this count. |
217 // We use this count of pending sheets to detect when we can begin attaching | 218 // We use this count of pending sheets to detect when we can begin attaching |
218 // elements and when it is safe to execute scripts. | 219 // elements and when it is safe to execute scripts. |
219 int m_pendingStylesheets; | 220 int m_pendingStylesheets; |
220 | 221 |
221 mutable WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> > m_injectedAutho
rStyleSheets; | 222 mutable WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> > m_injectedAutho
rStyleSheets; |
222 mutable bool m_injectedStyleSheetCacheValid; | 223 mutable bool m_injectedStyleSheetCacheValid; |
223 | 224 |
224 WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> > m_authorStyleSheets; | 225 WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> > m_authorStyleSheets; |
225 | 226 |
226 DocumentStyleSheetCollection m_documentStyleSheetCollection; | 227 DocumentStyleSheetCollection m_documentStyleSheetCollection; |
227 HashMap<TreeScope*, OwnPtr<TreeScopeStyleSheetCollection> > m_styleSheetColl
ectionMap; | 228 WillBeHeapHashMap<TreeScope*, OwnPtrWillBeMember<ShadowTreeStyleSheetCollect
ion> > m_styleSheetCollectionMap; |
228 | 229 |
229 bool m_documentScopeDirty; | 230 bool m_documentScopeDirty; |
230 TreeScopeSet m_dirtyTreeScopes; | 231 TreeScopeSet m_dirtyTreeScopes; |
231 TreeScopeSet m_activeTreeScopes; | 232 TreeScopeSet m_activeTreeScopes; |
232 | 233 |
233 String m_preferredStylesheetSetName; | 234 String m_preferredStylesheetSetName; |
234 String m_selectedStylesheetSetName; | 235 String m_selectedStylesheetSetName; |
235 | 236 |
236 bool m_usesSiblingRules; | 237 bool m_usesSiblingRules; |
237 bool m_usesSiblingRulesOverride; | 238 bool m_usesSiblingRulesOverride; |
238 bool m_usesFirstLineRules; | 239 bool m_usesFirstLineRules; |
239 bool m_usesFirstLetterRules; | 240 bool m_usesFirstLetterRules; |
240 bool m_usesRemUnits; | 241 bool m_usesRemUnits; |
241 unsigned m_maxDirectAdjacentSelectors; | 242 unsigned m_maxDirectAdjacentSelectors; |
242 | 243 |
243 bool m_ignorePendingStylesheets; | 244 bool m_ignorePendingStylesheets; |
244 bool m_didCalculateResolver; | 245 bool m_didCalculateResolver; |
245 OwnPtr<StyleResolver> m_resolver; | 246 OwnPtr<StyleResolver> m_resolver; |
246 | 247 |
247 RefPtr<CSSFontSelector> m_fontSelector; | 248 RefPtr<CSSFontSelector> m_fontSelector; |
248 | 249 |
249 HashMap<AtomicString, StyleSheetContents*> m_textToSheetCache; | 250 HashMap<AtomicString, StyleSheetContents*> m_textToSheetCache; |
250 HashMap<StyleSheetContents*, AtomicString> m_sheetToTextCache; | 251 HashMap<StyleSheetContents*, AtomicString> m_sheetToTextCache; |
251 }; | 252 }; |
252 | 253 |
253 } | 254 } |
254 | 255 |
255 #endif | 256 #endif |
OLD | NEW |