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

Side by Side Diff: sky/engine/core/dom/StyleEngine.h

Issue 799393005: Merge all StyleSheetCollections. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
OLDNEW
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
25 * 25 *
26 */ 26 */
27 27
28 #ifndef SKY_ENGINE_CORE_DOM_STYLEENGINE_H_ 28 #ifndef SKY_ENGINE_CORE_DOM_STYLEENGINE_H_
29 #define SKY_ENGINE_CORE_DOM_STYLEENGINE_H_ 29 #define SKY_ENGINE_CORE_DOM_STYLEENGINE_H_
30 30
31 #include "sky/engine/core/css/CSSFontSelectorClient.h" 31 #include "sky/engine/core/css/CSSFontSelectorClient.h"
32 #include "sky/engine/core/css/resolver/StyleResolver.h" 32 #include "sky/engine/core/css/resolver/StyleResolver.h"
33 #include "sky/engine/core/dom/Document.h" 33 #include "sky/engine/core/dom/Document.h"
34 #include "sky/engine/core/dom/DocumentOrderedList.h" 34 #include "sky/engine/core/dom/DocumentOrderedList.h"
35 #include "sky/engine/core/dom/DocumentStyleSheetCollection.h" 35 #include "sky/engine/core/dom/StyleSheetCollection.h"
36 #include "sky/engine/platform/heap/Handle.h" 36 #include "sky/engine/platform/heap/Handle.h"
37 #include "sky/engine/wtf/FastAllocBase.h" 37 #include "sky/engine/wtf/FastAllocBase.h"
38 #include "sky/engine/wtf/ListHashSet.h" 38 #include "sky/engine/wtf/ListHashSet.h"
39 #include "sky/engine/wtf/RefPtr.h" 39 #include "sky/engine/wtf/RefPtr.h"
40 #include "sky/engine/wtf/TemporaryChange.h" 40 #include "sky/engine/wtf/TemporaryChange.h"
41 #include "sky/engine/wtf/Vector.h" 41 #include "sky/engine/wtf/Vector.h"
42 #include "sky/engine/wtf/text/WTFString.h" 42 #include "sky/engine/wtf/text/WTFString.h"
43 43
44 namespace blink { 44 namespace blink {
45 45
46 class CSSFontSelector; 46 class CSSFontSelector;
47 class CSSStyleSheet; 47 class CSSStyleSheet;
48 class Node; 48 class Node;
49 class RuleFeatureSet; 49 class RuleFeatureSet;
50 class ShadowTreeStyleSheetCollection;
51 class StyleRuleFontFace; 50 class StyleRuleFontFace;
52 class StyleSheetContents; 51 class StyleSheetContents;
53 52
54 class StyleEngine final : public CSSFontSelectorClient { 53 class StyleEngine final : public CSSFontSelectorClient {
55 WTF_MAKE_FAST_ALLOCATED; 54 WTF_MAKE_FAST_ALLOCATED;
56 public: 55 public:
57 56
58 class IgnoringPendingStylesheet : public TemporaryChange<bool> { 57 class IgnoringPendingStylesheet : public TemporaryChange<bool> {
59 public: 58 public:
60 IgnoringPendingStylesheet(StyleEngine* engine) 59 IgnoringPendingStylesheet(StyleEngine* engine)
61 : TemporaryChange<bool>(engine->m_ignorePendingStylesheets, true) 60 : TemporaryChange<bool>(engine->m_ignorePendingStylesheets, true)
62 { 61 {
63 } 62 }
64 }; 63 };
65 64
66 friend class IgnoringPendingStylesheet; 65 friend class IgnoringPendingStylesheet;
67 66
68 static PassOwnPtr<StyleEngine> create(Document& document) { return adoptPtr( new StyleEngine(document)); } 67 static PassOwnPtr<StyleEngine> create(Document& document) { return adoptPtr( new StyleEngine(document)); }
69 68
70 ~StyleEngine(); 69 ~StyleEngine();
71 70
72 #if !ENABLE(OILPAN) 71 #if !ENABLE(OILPAN)
73 void detachFromDocument(); 72 void detachFromDocument();
74 #endif 73 #endif
75 74
76 const Vector<RefPtr<CSSStyleSheet>>& activeAuthorStyleSheetsFor(TreeScope&); 75 const Vector<RefPtr<CSSStyleSheet>>& activeAuthorStyleSheetsFor(TreeScope&);
77 const Vector<RefPtr<CSSStyleSheet> >& documentAuthorStyleSheets() const { re turn m_authorStyleSheets; }
78 76
79 void modifiedStyleSheet(CSSStyleSheet*); 77 void modifiedStyleSheet(CSSStyleSheet*);
80 void addStyleSheetCandidateNode(Node*, bool createdByParser); 78 void addStyleSheetCandidateNode(Node*, bool createdByParser);
81 void removeStyleSheetCandidateNode(Node*, ContainerNode* scopingNode, TreeSc ope&); 79 void removeStyleSheetCandidateNode(Node*, ContainerNode* scopingNode, TreeSc ope&);
82 80
83 void updateActiveStyleSheets(); 81 void updateActiveStyleSheets();
84 82
85 bool ignoringPendingStylesheets() const { return m_ignorePendingStylesheets; } 83 bool ignoringPendingStylesheets() const { return m_ignorePendingStylesheets; }
86 84
87 // FIXME(sky): Remove this and ::first-line. 85 // FIXME(sky): Remove this and ::first-line.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 bool hasOnlyScopedResolverForDocument() const { return m_scopedStyleResolver s.size() == 1; } 127 bool hasOnlyScopedResolverForDocument() const { return m_scopedStyleResolver s.size() == 1; }
130 void collectScopedStyleFeaturesTo(RuleFeatureSet&) const; 128 void collectScopedStyleFeaturesTo(RuleFeatureSet&) const;
131 129
132 private: 130 private:
133 // CSSFontSelectorClient implementation. 131 // CSSFontSelectorClient implementation.
134 virtual void fontsNeedUpdate(CSSFontSelector*) override; 132 virtual void fontsNeedUpdate(CSSFontSelector*) override;
135 133
136 private: 134 private:
137 StyleEngine(Document&); 135 StyleEngine(Document&);
138 136
139 TreeScopeStyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&); 137 StyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&);
140 TreeScopeStyleSheetCollection* styleSheetCollectionFor(TreeScope&); 138 StyleSheetCollection* styleSheetCollectionFor(TreeScope&);
141 139
142 void markTreeScopeDirty(TreeScope&); 140 void markTreeScopeDirty(TreeScope&);
143 141
144 bool isMaster() const { return m_isMaster; } 142 bool isMaster() const { return m_isMaster; }
145 Document* master(); 143 Document* master();
146 Document& document() const { return *m_document; } 144 Document& document() const { return *m_document; }
147 145
148 typedef ListHashSet<TreeScope*, 16> TreeScopeSet; 146 typedef ListHashSet<TreeScope*, 16> TreeScopeSet;
149 static void insertTreeScopeInDocumentOrder(TreeScopeSet&, TreeScope*); 147 static void insertTreeScopeInDocumentOrder(TreeScopeSet&, TreeScope*);
150 148
151 void createResolver(); 149 void createResolver();
152 150
153 const DocumentStyleSheetCollection* documentStyleSheetCollection() const 151 const StyleSheetCollection* documentStyleSheetCollection() const
154 { 152 {
155 return m_documentStyleSheetCollection.get(); 153 return m_documentStyleSheetCollection.get();
156 } 154 }
157 155
158 DocumentStyleSheetCollection* documentStyleSheetCollection() 156 StyleSheetCollection* documentStyleSheetCollection()
159 { 157 {
160 return m_documentStyleSheetCollection.get(); 158 return m_documentStyleSheetCollection.get();
161 } 159 }
162 160
163 RawPtr<Document> m_document; 161 RawPtr<Document> m_document;
164 bool m_isMaster; 162 bool m_isMaster;
165 163
166 Vector<RefPtr<CSSStyleSheet> > m_authorStyleSheets; 164 // TODO(esprehn): Remove special separate collection for document.
165 OwnPtr<StyleSheetCollection> m_documentStyleSheetCollection;
167 166
168 OwnPtr<DocumentStyleSheetCollection> m_documentStyleSheetCollection; 167 typedef HashMap<RawPtr<TreeScope>, OwnPtr<StyleSheetCollection> > StyleSheet CollectionMap;
169
170 typedef HashMap<RawPtr<TreeScope>, OwnPtr<ShadowTreeStyleSheetCollection> > StyleSheetCollectionMap;
171 StyleSheetCollectionMap m_styleSheetCollectionMap; 168 StyleSheetCollectionMap m_styleSheetCollectionMap;
172 typedef HashSet<RawPtr<const ScopedStyleResolver> > ScopedStyleResolverSet; 169 typedef HashSet<RawPtr<const ScopedStyleResolver> > ScopedStyleResolverSet;
173 ScopedStyleResolverSet m_scopedStyleResolvers; 170 ScopedStyleResolverSet m_scopedStyleResolvers;
174 171
175 bool m_documentScopeDirty; 172 bool m_documentScopeDirty;
176 TreeScopeSet m_dirtyTreeScopes; 173 TreeScopeSet m_dirtyTreeScopes;
177 TreeScopeSet m_activeTreeScopes; 174 TreeScopeSet m_activeTreeScopes;
178 175
179 bool m_ignorePendingStylesheets; 176 bool m_ignorePendingStylesheets;
180 OwnPtr<StyleResolver> m_resolver; 177 OwnPtr<StyleResolver> m_resolver;
181 178
182 RefPtr<CSSFontSelector> m_fontSelector; 179 RefPtr<CSSFontSelector> m_fontSelector;
183 180
184 HashMap<AtomicString, RawPtr<StyleSheetContents> > m_textToSheetCache; 181 HashMap<AtomicString, RawPtr<StyleSheetContents> > m_textToSheetCache;
185 HashMap<RawPtr<StyleSheetContents>, AtomicString> m_sheetToTextCache; 182 HashMap<RawPtr<StyleSheetContents>, AtomicString> m_sheetToTextCache;
186 }; 183 };
187 184
188 } 185 }
189 186
190 #endif // SKY_ENGINE_CORE_DOM_STYLEENGINE_H_ 187 #endif // SKY_ENGINE_CORE_DOM_STYLEENGINE_H_
OLDNEW
« no previous file with comments | « sky/engine/core/dom/ShadowTreeStyleSheetCollection.cpp ('k') | sky/engine/core/dom/StyleEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698