| 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 12 matching lines...) Expand all Loading... |
| 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 24 * Boston, MA 02110-1301, USA. | 24 * Boston, MA 02110-1301, USA. |
| 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/resolver/StyleResolver.h" | 34 #include "core/css/resolver/StyleResolver.h" |
| 34 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 35 #include "core/dom/DocumentOrderedList.h" | 36 #include "core/dom/DocumentOrderedList.h" |
| 36 #include "core/dom/DocumentStyleSheetCollection.h" | 37 #include "core/dom/DocumentStyleSheetCollection.h" |
| 37 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
| 38 #include "wtf/FastAllocBase.h" | 39 #include "wtf/FastAllocBase.h" |
| 39 #include "wtf/ListHashSet.h" | 40 #include "wtf/ListHashSet.h" |
| 40 #include "wtf/RefPtr.h" | 41 #include "wtf/RefPtr.h" |
| 41 #include "wtf/TemporaryChange.h" | 42 #include "wtf/TemporaryChange.h" |
| 42 #include "wtf/Vector.h" | 43 #include "wtf/Vector.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } else if (m_resolver->hasPendingAuthorStyleSheets()) { | 143 } else if (m_resolver->hasPendingAuthorStyleSheets()) { |
| 143 m_resolver->appendPendingAuthorStyleSheets(); | 144 m_resolver->appendPendingAuthorStyleSheets(); |
| 144 } | 145 } |
| 145 return *m_resolver.get(); | 146 return *m_resolver.get(); |
| 146 } | 147 } |
| 147 | 148 |
| 148 bool hasResolver() const { return m_resolver.get(); } | 149 bool hasResolver() const { return m_resolver.get(); } |
| 149 void clearResolver(); | 150 void clearResolver(); |
| 150 void clearMasterResolver(); | 151 void clearMasterResolver(); |
| 151 | 152 |
| 153 StyleInvalidator& styleInvalidator() { return m_styleInvalidator; } |
| 154 |
| 152 CSSFontSelector* fontSelector() { return m_fontSelector.get(); } | 155 CSSFontSelector* fontSelector() { return m_fontSelector.get(); } |
| 153 void setFontSelector(PassRefPtrWillBeRawPtr<CSSFontSelector>); | 156 void setFontSelector(PassRefPtrWillBeRawPtr<CSSFontSelector>); |
| 154 | 157 |
| 155 void removeFontFaceRules(const WillBeHeapVector<RawPtrWillBeMember<const Sty
leRuleFontFace>>&); | 158 void removeFontFaceRules(const WillBeHeapVector<RawPtrWillBeMember<const Sty
leRuleFontFace>>&); |
| 156 void clearFontCache(); | 159 void clearFontCache(); |
| 157 // updateGenericFontFamilySettings is used from WebSettingsImpl. | 160 // updateGenericFontFamilySettings is used from WebSettingsImpl. |
| 158 void updateGenericFontFamilySettings(); | 161 void updateGenericFontFamilySettings(); |
| 159 | 162 |
| 160 void didDetach(); | 163 void didDetach(); |
| 161 bool shouldClearResolver() const; | 164 bool shouldClearResolver() const; |
| 162 void resolverChanged(StyleResolverUpdateMode); | 165 void resolverChanged(StyleResolverUpdateMode); |
| 163 unsigned resolverAccessCount() const; | 166 unsigned resolverAccessCount() const; |
| 164 | 167 |
| 165 void markDocumentDirty(); | 168 void markDocumentDirty(); |
| 166 | 169 |
| 167 PassRefPtrWillBeRawPtr<CSSStyleSheet> createSheet(Element*, const String& te
xt, TextPosition startPosition, bool createdByParser); | 170 PassRefPtrWillBeRawPtr<CSSStyleSheet> createSheet(Element*, const String& te
xt, TextPosition startPosition, bool createdByParser); |
| 168 void removeSheet(StyleSheetContents*); | 171 void removeSheet(StyleSheetContents*); |
| 169 | 172 |
| 170 void collectScopedStyleFeaturesTo(RuleFeatureSet&) const; | 173 void collectScopedStyleFeaturesTo(RuleFeatureSet&) const; |
| 171 | 174 |
| 172 void platformColorsChanged(); | 175 void platformColorsChanged(); |
| 173 | 176 |
| 177 void classChangedForElement(const SpaceSplitString& changedClasses, Element&
); |
| 178 void classChangedForElement(const SpaceSplitString& oldClasses, const SpaceS
plitString& newClasses, Element&); |
| 179 void attributeChangedForElement(const QualifiedName& attributeName, Element&
); |
| 180 void idChangedForElement(const AtomicString& oldId, const AtomicString& newI
d, Element&); |
| 181 void pseudoStateChangedForElement(CSSSelector::PseudoType, Element&); |
| 182 |
| 174 DECLARE_VIRTUAL_TRACE(); | 183 DECLARE_VIRTUAL_TRACE(); |
| 175 | 184 |
| 176 private: | 185 private: |
| 177 // CSSFontSelectorClient implementation. | 186 // CSSFontSelectorClient implementation. |
| 178 virtual void fontsNeedUpdate(CSSFontSelector*) override; | 187 virtual void fontsNeedUpdate(CSSFontSelector*) override; |
| 179 | 188 |
| 180 private: | 189 private: |
| 181 StyleEngine(Document&); | 190 StyleEngine(Document&); |
| 182 | 191 |
| 183 TreeScopeStyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&); | 192 TreeScopeStyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&); |
| 184 TreeScopeStyleSheetCollection* styleSheetCollectionFor(TreeScope&); | 193 TreeScopeStyleSheetCollection* styleSheetCollectionFor(TreeScope&); |
| 185 bool shouldUpdateDocumentStyleSheetCollection(StyleResolverUpdateMode) const
; | 194 bool shouldUpdateDocumentStyleSheetCollection(StyleResolverUpdateMode) const
; |
| 186 bool shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode) con
st; | 195 bool shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode) con
st; |
| 187 | 196 |
| 188 void markTreeScopeDirty(TreeScope&); | 197 void markTreeScopeDirty(TreeScope&); |
| 189 | 198 |
| 190 bool isMaster() const { return m_isMaster; } | 199 bool isMaster() const { return m_isMaster; } |
| 191 Document* master(); | 200 Document* master(); |
| 192 Document& document() const { return *m_document; } | 201 Document& document() const { return *m_document; } |
| 193 | 202 |
| 203 void scheduleInvalidationSetsForElement(const InvalidationSetVector&, Elemen
t&); |
| 204 |
| 194 typedef WillBeHeapHashSet<RawPtrWillBeMember<TreeScope>> UnorderedTreeScopeS
et; | 205 typedef WillBeHeapHashSet<RawPtrWillBeMember<TreeScope>> UnorderedTreeScopeS
et; |
| 195 | 206 |
| 196 // A class which holds document-ordered treescopes which have stylesheets. | 207 // A class which holds document-ordered treescopes which have stylesheets. |
| 197 // ListHashSet allows only sequential access, not random access. | 208 // ListHashSet allows only sequential access, not random access. |
| 198 // So it gets slow when the size of treescopes gets larger when finding | 209 // So it gets slow when the size of treescopes gets larger when finding |
| 199 // the best place to insert a treescope into the document-ordered | 210 // the best place to insert a treescope into the document-ordered |
| 200 // treescopes (requires linear search). | 211 // treescopes (requires linear search). |
| 201 // To solve this, use a vector for the document-ordered treescopes and | 212 // To solve this, use a vector for the document-ordered treescopes and |
| 202 // use a hashset for quickly checking whether a given treescope is | 213 // use a hashset for quickly checking whether a given treescope is |
| 203 // in the document-ordered treescopes or not. | 214 // in the document-ordered treescopes or not. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 bool m_usesSiblingRules; | 290 bool m_usesSiblingRules; |
| 280 bool m_usesFirstLineRules; | 291 bool m_usesFirstLineRules; |
| 281 bool m_usesWindowInactiveSelector; | 292 bool m_usesWindowInactiveSelector; |
| 282 bool m_usesFirstLetterRules; | 293 bool m_usesFirstLetterRules; |
| 283 bool m_usesRemUnits; | 294 bool m_usesRemUnits; |
| 284 unsigned m_maxDirectAdjacentSelectors; | 295 unsigned m_maxDirectAdjacentSelectors; |
| 285 | 296 |
| 286 bool m_ignorePendingStylesheets; | 297 bool m_ignorePendingStylesheets; |
| 287 bool m_didCalculateResolver; | 298 bool m_didCalculateResolver; |
| 288 OwnPtrWillBeMember<StyleResolver> m_resolver; | 299 OwnPtrWillBeMember<StyleResolver> m_resolver; |
| 300 StyleInvalidator m_styleInvalidator; |
| 289 | 301 |
| 290 RefPtrWillBeMember<CSSFontSelector> m_fontSelector; | 302 RefPtrWillBeMember<CSSFontSelector> m_fontSelector; |
| 291 | 303 |
| 292 WillBeHeapHashMap<AtomicString, RawPtrWillBeMember<StyleSheetContents>> m_te
xtToSheetCache; | 304 WillBeHeapHashMap<AtomicString, RawPtrWillBeMember<StyleSheetContents>> m_te
xtToSheetCache; |
| 293 WillBeHeapHashMap<RawPtrWillBeMember<StyleSheetContents>, AtomicString> m_sh
eetToTextCache; | 305 WillBeHeapHashMap<RawPtrWillBeMember<StyleSheetContents>, AtomicString> m_sh
eetToTextCache; |
| 294 }; | 306 }; |
| 295 | 307 |
| 296 } | 308 } |
| 297 | 309 |
| 298 #endif | 310 #endif |
| OLD | NEW |