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

Side by Side Diff: Source/core/dom/StyleSheetCollections.h

Issue 23516012: Rename StyleSheetCollections to StyleEngine. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/StyleSheetCollection.cpp ('k') | Source/core/dom/StyleSheetCollections.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.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.
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)
9 * Copyright (C) 2011 Google Inc. All rights reserved.
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
20 *
21 * You should have received a copy of the GNU Library General Public License
22 * along with this library; see the file COPYING.LIB. If not, write to
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301, USA.
25 *
26 */
27
28 #ifndef StyleSheetCollections_h
29 #define StyleSheetCollections_h
30
31 #include "core/dom/Document.h"
32 #include "core/dom/DocumentOrderedList.h"
33 #include "core/dom/DocumentStyleSheetCollection.h"
34 #include "wtf/FastAllocBase.h"
35 #include "wtf/ListHashSet.h"
36 #include "wtf/RefPtr.h"
37 #include "wtf/Vector.h"
38 #include "wtf/text/WTFString.h"
39
40 namespace WebCore {
41
42 class CSSStyleSheet;
43 class Node;
44 class RuleFeatureSet;
45 class ShadowTreeStyleSheetCollection;
46 class StyleSheet;
47 class StyleSheetCollection;
48 class StyleSheetContents;
49 class StyleSheetList;
50
51 class StyleSheetCollections {
52 WTF_MAKE_FAST_ALLOCATED;
53 public:
54 static PassOwnPtr<StyleSheetCollections> create(Document& document) { return adoptPtr(new StyleSheetCollections(document)); }
55
56 ~StyleSheetCollections();
57
58 const Vector<RefPtr<StyleSheet> >& styleSheetsForStyleSheetList();
59 const Vector<RefPtr<CSSStyleSheet> >& activeAuthorStyleSheets() const;
60
61 CSSStyleSheet* pageUserSheet();
62 const Vector<RefPtr<CSSStyleSheet> >& documentUserStyleSheets() const { retu rn m_userStyleSheets; }
63 const Vector<RefPtr<CSSStyleSheet> >& documentAuthorStyleSheets() const { re turn m_authorStyleSheets; }
64 const Vector<RefPtr<CSSStyleSheet> >& injectedUserStyleSheets() const;
65 const Vector<RefPtr<CSSStyleSheet> >& injectedAuthorStyleSheets() const;
66
67 void addStyleSheetCandidateNode(Node*, bool createdByParser);
68 void removeStyleSheetCandidateNode(Node*, ContainerNode* scopingNode = 0);
69 void modifiedStyleSheetCandidateNode(Node*);
70
71 void clearPageUserSheet();
72 void updatePageUserSheet();
73 void invalidateInjectedStyleSheetCache();
74 void updateInjectedStyleSheetCache() const;
75
76 void addAuthorSheet(PassRefPtr<StyleSheetContents> authorSheet);
77 void addUserSheet(PassRefPtr<StyleSheetContents> userSheet);
78
79 bool needsUpdateActiveStylesheetsOnStyleRecalc() const { return m_needsUpdat eActiveStylesheetsOnStyleRecalc; }
80
81 bool updateActiveStyleSheets(StyleResolverUpdateMode);
82
83 String preferredStylesheetSetName() const { return m_preferredStylesheetSetN ame; }
84 String selectedStylesheetSetName() const { return m_selectedStylesheetSetNam e; }
85 void setPreferredStylesheetSetName(const String& name) { m_preferredStyleshe etSetName = name; }
86 void setSelectedStylesheetSetName(const String& name) { m_selectedStylesheet SetName = name; }
87
88 void addPendingSheet() { m_pendingStylesheets++; }
89 enum RemovePendingSheetNotificationType {
90 RemovePendingSheetNotifyImmediately,
91 RemovePendingSheetNotifyLater
92 };
93 void removePendingSheet(Node* styleSheetCandidateNode, RemovePendingSheetNot ificationType = RemovePendingSheetNotifyImmediately);
94
95 bool hasPendingSheets() const { return m_pendingStylesheets > 0; }
96
97 bool usesSiblingRules() const { return m_usesSiblingRules || m_usesSiblingRu lesOverride; }
98 void setUsesSiblingRulesOverride(bool b) { m_usesSiblingRulesOverride = b; }
99 bool usesFirstLineRules() const { return m_usesFirstLineRules; }
100 bool usesFirstLetterRules() const { return m_usesFirstLetterRules; }
101 void setUsesFirstLetterRules(bool b) { m_usesFirstLetterRules = b; }
102 bool usesRemUnits() const { return m_usesRemUnits; }
103 void setUsesRemUnit(bool b) { m_usesRemUnits = b; }
104 bool hasScopedStyleSheet() { return m_documentStyleSheetCollection.scopingNo desForStyleScoped(); }
105
106 void combineCSSFeatureFlags(const RuleFeatureSet&);
107 void resetCSSFeatureFlags(const RuleFeatureSet&);
108
109 void didModifySeamlessParentStyleSheet() { m_needsDocumentStyleSheetsUpdate = true; }
110 void didRemoveShadowRoot(ShadowRoot*);
111 void appendActiveAuthorStyleSheets(StyleResolver*);
112 void getActiveAuthorStyleSheets(Vector<const Vector<RefPtr<CSSStyleSheet> >* >& activeAuthorStyleSheets) const;
113
114 private:
115 StyleSheetCollections(Document&);
116
117 StyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&);
118 StyleSheetCollection* styleSheetCollectionFor(TreeScope&);
119 void activeStyleSheetsUpdatedForInspector();
120 bool shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode);
121
122 typedef ListHashSet<TreeScope*, 16> TreeScopeSet;
123 static void insertTreeScopeInDocumentOrder(TreeScopeSet&, TreeScope*);
124
125 Document& m_document;
126
127 // Track the number of currently loading top-level stylesheets needed for re ndering.
128 // Sheets loaded using the @import directive are not included in this count.
129 // We use this count of pending sheets to detect when we can begin attaching
130 // elements and when it is safe to execute scripts.
131 int m_pendingStylesheets;
132
133 RefPtr<CSSStyleSheet> m_pageUserSheet;
134
135 mutable Vector<RefPtr<CSSStyleSheet> > m_injectedUserStyleSheets;
136 mutable Vector<RefPtr<CSSStyleSheet> > m_injectedAuthorStyleSheets;
137 mutable bool m_injectedStyleSheetCacheValid;
138
139 Vector<RefPtr<CSSStyleSheet> > m_userStyleSheets;
140 Vector<RefPtr<CSSStyleSheet> > m_authorStyleSheets;
141
142 bool m_needsUpdateActiveStylesheetsOnStyleRecalc;
143
144 DocumentStyleSheetCollection m_documentStyleSheetCollection;
145 HashMap<TreeScope*, OwnPtr<StyleSheetCollection> > m_styleSheetCollectionMap ;
146
147 TreeScopeSet m_dirtyTreeScopes;
148 TreeScopeSet m_activeTreeScopes;
149 bool m_needsDocumentStyleSheetsUpdate;
150
151 String m_preferredStylesheetSetName;
152 String m_selectedStylesheetSetName;
153
154 bool m_usesSiblingRules;
155 bool m_usesSiblingRulesOverride;
156 bool m_usesFirstLineRules;
157 bool m_usesFirstLetterRules;
158 bool m_usesRemUnits;
159 };
160
161 }
162
163 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/StyleSheetCollection.cpp ('k') | Source/core/dom/StyleSheetCollections.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698