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 815653002: Remove global list map of TreeScope to StyleSheetCollection. (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
« no previous file with comments | « no previous file | sky/engine/core/dom/StyleEngine.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12 matching lines...) Expand all
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 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"
34 #include "sky/engine/core/dom/DocumentOrderedList.h"
35 #include "sky/engine/core/dom/StyleSheetCollection.h"
36 #include "sky/engine/platform/heap/Handle.h"
37 #include "sky/engine/wtf/FastAllocBase.h" 33 #include "sky/engine/wtf/FastAllocBase.h"
38 #include "sky/engine/wtf/ListHashSet.h" 34 #include "sky/engine/wtf/ListHashSet.h"
39 #include "sky/engine/wtf/RefPtr.h" 35 #include "sky/engine/wtf/RefPtr.h"
40 #include "sky/engine/wtf/TemporaryChange.h" 36 #include "sky/engine/wtf/TemporaryChange.h"
41 #include "sky/engine/wtf/Vector.h" 37 #include "sky/engine/wtf/Vector.h"
42 #include "sky/engine/wtf/text/WTFString.h" 38 #include "sky/engine/wtf/text/WTFString.h"
43 39
44 namespace blink { 40 namespace blink {
45 41
46 class CSSFontSelector; 42 class CSSFontSelector;
47 class CSSStyleSheet; 43 class CSSStyleSheet;
44 class Document;
48 class Node; 45 class Node;
49 class RuleFeatureSet; 46 class RuleFeatureSet;
50 class StyleRuleFontFace; 47 class StyleRuleFontFace;
51 class StyleSheetContents; 48 class StyleSheetContents;
52 49
53 class StyleEngine final : public CSSFontSelectorClient { 50 class StyleEngine final : public CSSFontSelectorClient {
54 WTF_MAKE_FAST_ALLOCATED; 51 WTF_MAKE_FAST_ALLOCATED;
55 public: 52 public:
56 53
57 class IgnoringPendingStylesheet : public TemporaryChange<bool> { 54 class IgnoringPendingStylesheet : public TemporaryChange<bool> {
58 public: 55 public:
59 IgnoringPendingStylesheet(StyleEngine* engine) 56 IgnoringPendingStylesheet(StyleEngine* engine)
60 : TemporaryChange<bool>(engine->m_ignorePendingStylesheets, true) 57 : TemporaryChange<bool>(engine->m_ignorePendingStylesheets, true)
61 { 58 {
62 } 59 }
63 }; 60 };
64 61
65 friend class IgnoringPendingStylesheet; 62 friend class IgnoringPendingStylesheet;
66 63
67 static PassOwnPtr<StyleEngine> create(Document& document) { return adoptPtr( new StyleEngine(document)); } 64 static PassOwnPtr<StyleEngine> create(Document& document) { return adoptPtr( new StyleEngine(document)); }
68 65
69 ~StyleEngine(); 66 ~StyleEngine();
70 67
71 void detachFromDocument(); 68 void detachFromDocument();
72 69
73 const Vector<RefPtr<CSSStyleSheet>>& activeAuthorStyleSheetsFor(TreeScope&);
74
75 void addStyleSheetCandidateNode(Node*, bool createdByParser); 70 void addStyleSheetCandidateNode(Node*, bool createdByParser);
76 void removeStyleSheetCandidateNode(Node*, ContainerNode* scopingNode, TreeSc ope&); 71 void removeStyleSheetCandidateNode(Node*, ContainerNode* scopingNode, TreeSc ope&);
77 72
78 void updateActiveStyleSheets(); 73 void updateActiveStyleSheets();
79 74
80 bool ignoringPendingStylesheets() const { return m_ignorePendingStylesheets; } 75 bool ignoringPendingStylesheets() const { return m_ignorePendingStylesheets; }
81 76
82 // FIXME(sky): Remove this and ::first-line. 77 // FIXME(sky): Remove this and ::first-line.
83 bool usesFirstLineRules() const { return false; } 78 bool usesFirstLineRules() const { return false; }
84 79
85 void didRemoveShadowRoot(ShadowRoot*);
86 void appendActiveAuthorStyleSheets(); 80 void appendActiveAuthorStyleSheets();
87 81
88 StyleResolver* resolver() const 82 StyleResolver* resolver() const
89 { 83 {
90 return m_resolver.get(); 84 return m_resolver.get();
91 } 85 }
92 86
93 StyleResolver& ensureResolver() 87 StyleResolver& ensureResolver()
94 { 88 {
95 if (!m_resolver) { 89 if (!m_resolver) {
(...skipping 20 matching lines...) Expand all
116 PassRefPtr<CSSStyleSheet> createSheet(Element*, const String& text); 110 PassRefPtr<CSSStyleSheet> createSheet(Element*, const String& text);
117 void removeSheet(StyleSheetContents*); 111 void removeSheet(StyleSheetContents*);
118 112
119 void collectScopedStyleFeaturesTo(RuleFeatureSet&) const; 113 void collectScopedStyleFeaturesTo(RuleFeatureSet&) const;
120 114
121 private: 115 private:
122 // CSSFontSelectorClient implementation. 116 // CSSFontSelectorClient implementation.
123 virtual void fontsNeedUpdate(CSSFontSelector*) override; 117 virtual void fontsNeedUpdate(CSSFontSelector*) override;
124 118
125 private: 119 private:
126 StyleEngine(Document&); 120 explicit StyleEngine(Document&);
127
128 StyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&);
129 StyleSheetCollection* styleSheetCollectionFor(TreeScope&);
130 121
131 void createResolver(); 122 void createResolver();
132 123
133 const StyleSheetCollection* documentStyleSheetCollection() const
134 {
135 return m_documentStyleSheetCollection.get();
136 }
137
138 StyleSheetCollection* documentStyleSheetCollection()
139 {
140 return m_documentStyleSheetCollection.get();
141 }
142
143 RawPtr<Document> m_document; 124 RawPtr<Document> m_document;
144 125
145 // TODO(esprehn): Remove special separate collection for document.
146 OwnPtr<StyleSheetCollection> m_documentStyleSheetCollection;
147
148 typedef HashMap<RawPtr<TreeScope>, OwnPtr<StyleSheetCollection> > StyleSheet CollectionMap;
149 StyleSheetCollectionMap m_styleSheetCollectionMap;
150
151 typedef ListHashSet<TreeScope*, 16> TreeScopeSet; 126 typedef ListHashSet<TreeScope*, 16> TreeScopeSet;
152 TreeScopeSet m_activeTreeScopes; 127 TreeScopeSet m_activeTreeScopes;
153 128
154 bool m_ignorePendingStylesheets; 129 bool m_ignorePendingStylesheets;
155 OwnPtr<StyleResolver> m_resolver; 130 OwnPtr<StyleResolver> m_resolver;
156 131
157 RefPtr<CSSFontSelector> m_fontSelector; 132 RefPtr<CSSFontSelector> m_fontSelector;
158 133
159 HashMap<AtomicString, StyleSheetContents*> m_textToSheetCache; 134 HashMap<AtomicString, StyleSheetContents*> m_textToSheetCache;
160 HashMap<StyleSheetContents*, AtomicString> m_sheetToTextCache; 135 HashMap<StyleSheetContents*, AtomicString> m_sheetToTextCache;
161 }; 136 };
162 137
163 } 138 }
164 139
165 #endif // SKY_ENGINE_CORE_DOM_STYLEENGINE_H_ 140 #endif // SKY_ENGINE_CORE_DOM_STYLEENGINE_H_
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/dom/StyleEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698