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/CoreExport.h" | 31 #include "core/CoreExport.h" |
32 #include "core/css/CSSFontSelectorClient.h" | 32 #include "core/css/CSSFontSelectorClient.h" |
33 #include "core/css/invalidation/StyleInvalidator.h" | 33 #include "core/css/invalidation/StyleInvalidator.h" |
34 #include "core/css/resolver/StyleResolver.h" | 34 #include "core/css/resolver/StyleResolver.h" |
| 35 #include "core/css/resolver/StyleResolverStats.h" |
35 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
36 #include "core/dom/DocumentOrderedList.h" | 37 #include "core/dom/DocumentOrderedList.h" |
37 #include "core/dom/DocumentStyleSheetCollection.h" | 38 #include "core/dom/DocumentStyleSheetCollection.h" |
38 #include "platform/heap/Handle.h" | 39 #include "platform/heap/Handle.h" |
39 #include "wtf/Allocator.h" | 40 #include "wtf/Allocator.h" |
40 #include "wtf/ListHashSet.h" | 41 #include "wtf/ListHashSet.h" |
41 #include "wtf/RefPtr.h" | 42 #include "wtf/RefPtr.h" |
42 #include "wtf/TemporaryChange.h" | 43 #include "wtf/TemporaryChange.h" |
43 #include "wtf/Vector.h" | 44 #include "wtf/Vector.h" |
44 #include "wtf/text/WTFString.h" | 45 #include "wtf/text/WTFString.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 void setFontSelector(PassRefPtrWillBeRawPtr<CSSFontSelector>); | 155 void setFontSelector(PassRefPtrWillBeRawPtr<CSSFontSelector>); |
155 | 156 |
156 void removeFontFaceRules(const WillBeHeapVector<RawPtrWillBeMember<const Sty
leRuleFontFace>>&); | 157 void removeFontFaceRules(const WillBeHeapVector<RawPtrWillBeMember<const Sty
leRuleFontFace>>&); |
157 void clearFontCache(); | 158 void clearFontCache(); |
158 // updateGenericFontFamilySettings is used from WebSettingsImpl. | 159 // updateGenericFontFamilySettings is used from WebSettingsImpl. |
159 void updateGenericFontFamilySettings(); | 160 void updateGenericFontFamilySettings(); |
160 | 161 |
161 void didDetach(); | 162 void didDetach(); |
162 bool shouldClearResolver() const; | 163 bool shouldClearResolver() const; |
163 void resolverChanged(StyleResolverUpdateMode); | 164 void resolverChanged(StyleResolverUpdateMode); |
164 unsigned resolverAccessCount() const; | |
165 | 165 |
166 void markDocumentDirty(); | 166 void markDocumentDirty(); |
167 | 167 |
168 PassRefPtrWillBeRawPtr<CSSStyleSheet> createSheet(Element*, const String& te
xt, TextPosition startPosition); | 168 PassRefPtrWillBeRawPtr<CSSStyleSheet> createSheet(Element*, const String& te
xt, TextPosition startPosition); |
169 void removeSheet(StyleSheetContents*); | 169 void removeSheet(StyleSheetContents*); |
170 | 170 |
171 void collectScopedStyleFeaturesTo(RuleFeatureSet&) const; | 171 void collectScopedStyleFeaturesTo(RuleFeatureSet&) const; |
172 | 172 |
173 void platformColorsChanged(); | 173 void platformColorsChanged(); |
174 | 174 |
175 void classChangedForElement(const SpaceSplitString& changedClasses, Element&
); | 175 void classChangedForElement(const SpaceSplitString& changedClasses, Element&
); |
176 void classChangedForElement(const SpaceSplitString& oldClasses, const SpaceS
plitString& newClasses, Element&); | 176 void classChangedForElement(const SpaceSplitString& oldClasses, const SpaceS
plitString& newClasses, Element&); |
177 void attributeChangedForElement(const QualifiedName& attributeName, Element&
); | 177 void attributeChangedForElement(const QualifiedName& attributeName, Element&
); |
178 void idChangedForElement(const AtomicString& oldId, const AtomicString& newI
d, Element&); | 178 void idChangedForElement(const AtomicString& oldId, const AtomicString& newI
d, Element&); |
179 void pseudoStateChangedForElement(CSSSelector::PseudoType, Element&); | 179 void pseudoStateChangedForElement(CSSSelector::PseudoType, Element&); |
180 | 180 |
| 181 unsigned styleForElementCount() const { return m_styleForElementCount; } |
| 182 void incStyleForElementCount() { m_styleForElementCount++; } |
| 183 |
| 184 StyleResolverStats* stats() { return m_styleResolverStats.get(); } |
| 185 void setStatsEnabled(bool); |
| 186 |
181 DECLARE_VIRTUAL_TRACE(); | 187 DECLARE_VIRTUAL_TRACE(); |
182 | 188 |
183 private: | 189 private: |
184 // CSSFontSelectorClient implementation. | 190 // CSSFontSelectorClient implementation. |
185 void fontsNeedUpdate(CSSFontSelector*) override; | 191 void fontsNeedUpdate(CSSFontSelector*) override; |
186 | 192 |
187 private: | 193 private: |
188 StyleEngine(Document&); | 194 StyleEngine(Document&); |
189 | 195 |
190 TreeScopeStyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&); | 196 TreeScopeStyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&); |
(...skipping 29 matching lines...) Expand all Loading... |
220 | 226 |
221 bool shouldSkipInvalidationFor(const Element&) const; | 227 bool shouldSkipInvalidationFor(const Element&) const; |
222 | 228 |
223 RawPtrWillBeMember<Document> m_document; | 229 RawPtrWillBeMember<Document> m_document; |
224 bool m_isMaster; | 230 bool m_isMaster; |
225 | 231 |
226 // Track the number of currently loading top-level stylesheets needed for la
yout. | 232 // Track the number of currently loading top-level stylesheets needed for la
yout. |
227 // Sheets loaded using the @import directive are not included in this count. | 233 // Sheets loaded using the @import directive are not included in this count. |
228 // We use this count of pending sheets to detect when we can begin attaching | 234 // We use this count of pending sheets to detect when we can begin attaching |
229 // elements and when it is safe to execute scripts. | 235 // elements and when it is safe to execute scripts. |
230 int m_pendingStylesheets; | 236 int m_pendingStylesheets = 0; |
231 | 237 |
232 WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet>> m_injectedAuthorStyleShe
ets; | 238 WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet>> m_injectedAuthorStyleShe
ets; |
233 | 239 |
234 OwnPtrWillBeMember<DocumentStyleSheetCollection> m_documentStyleSheetCollect
ion; | 240 OwnPtrWillBeMember<DocumentStyleSheetCollection> m_documentStyleSheetCollect
ion; |
235 | 241 |
236 typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<TreeScope>, OwnPtrWillBeMem
ber<ShadowTreeStyleSheetCollection>> StyleSheetCollectionMap; | 242 typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<TreeScope>, OwnPtrWillBeMem
ber<ShadowTreeStyleSheetCollection>> StyleSheetCollectionMap; |
237 StyleSheetCollectionMap m_styleSheetCollectionMap; | 243 StyleSheetCollectionMap m_styleSheetCollectionMap; |
238 | 244 |
239 bool m_documentScopeDirty; | 245 bool m_documentScopeDirty = true; |
240 UnorderedTreeScopeSet m_dirtyTreeScopes; | 246 UnorderedTreeScopeSet m_dirtyTreeScopes; |
241 UnorderedTreeScopeSet m_activeTreeScopes; | 247 UnorderedTreeScopeSet m_activeTreeScopes; |
242 | 248 |
243 String m_preferredStylesheetSetName; | 249 String m_preferredStylesheetSetName; |
244 String m_selectedStylesheetSetName; | 250 String m_selectedStylesheetSetName; |
245 | 251 |
246 bool m_usesSiblingRules; | 252 bool m_usesSiblingRules = false; |
247 bool m_usesFirstLineRules; | 253 bool m_usesFirstLineRules = false; |
248 bool m_usesWindowInactiveSelector; | 254 bool m_usesWindowInactiveSelector = false; |
249 bool m_usesRemUnits; | 255 bool m_usesRemUnits = false; |
250 unsigned m_maxDirectAdjacentSelectors; | 256 unsigned m_maxDirectAdjacentSelectors = 0; |
251 | 257 |
252 bool m_ignorePendingStylesheets; | 258 bool m_ignorePendingStylesheets = false; |
253 bool m_didCalculateResolver; | 259 bool m_didCalculateResolver = false; |
254 OwnPtrWillBeMember<StyleResolver> m_resolver; | 260 OwnPtrWillBeMember<StyleResolver> m_resolver; |
255 StyleInvalidator m_styleInvalidator; | 261 StyleInvalidator m_styleInvalidator; |
256 | 262 |
257 RefPtrWillBeMember<CSSFontSelector> m_fontSelector; | 263 RefPtrWillBeMember<CSSFontSelector> m_fontSelector; |
258 | 264 |
259 WillBeHeapHashMap<AtomicString, RawPtrWillBeMember<StyleSheetContents>> m_te
xtToSheetCache; | 265 WillBeHeapHashMap<AtomicString, RawPtrWillBeMember<StyleSheetContents>> m_te
xtToSheetCache; |
260 WillBeHeapHashMap<RawPtrWillBeMember<StyleSheetContents>, AtomicString> m_sh
eetToTextCache; | 266 WillBeHeapHashMap<RawPtrWillBeMember<StyleSheetContents>, AtomicString> m_sh
eetToTextCache; |
| 267 |
| 268 OwnPtr<StyleResolverStats> m_styleResolverStats; |
| 269 unsigned m_styleForElementCount = 0; |
261 }; | 270 }; |
262 | 271 |
263 } // namespace blink | 272 } // namespace blink |
264 | 273 |
265 #endif | 274 #endif |
OLD | NEW |