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

Side by Side Diff: Source/core/css/StyleSheetContents.h

Issue 1321943002: Support for CSSOM CSSNamespaceRule interface (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated as per review comments Created 5 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
« no previous file with comments | « Source/core/css/StyleRule.cpp ('k') | Source/core/css/StyleSheetContents.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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 26 matching lines...) Expand all
37 namespace blink { 37 namespace blink {
38 38
39 class CSSStyleSheet; 39 class CSSStyleSheet;
40 class CSSStyleSheetResource; 40 class CSSStyleSheetResource;
41 class Document; 41 class Document;
42 class Node; 42 class Node;
43 class SecurityOrigin; 43 class SecurityOrigin;
44 class StyleRuleBase; 44 class StyleRuleBase;
45 class StyleRuleFontFace; 45 class StyleRuleFontFace;
46 class StyleRuleImport; 46 class StyleRuleImport;
47 class StyleRuleNamespace;
47 48
48 class CORE_EXPORT StyleSheetContents : public RefCountedWillBeGarbageCollectedFi nalized<StyleSheetContents> { 49 class CORE_EXPORT StyleSheetContents : public RefCountedWillBeGarbageCollectedFi nalized<StyleSheetContents> {
49 public: 50 public:
50 static PassRefPtrWillBeRawPtr<StyleSheetContents> create(const CSSParserCont ext& context) 51 static PassRefPtrWillBeRawPtr<StyleSheetContents> create(const CSSParserCont ext& context)
51 { 52 {
52 return adoptRefWillBeNoop(new StyleSheetContents(0, String(), context)); 53 return adoptRefWillBeNoop(new StyleSheetContents(0, String(), context));
53 } 54 }
54 static PassRefPtrWillBeRawPtr<StyleSheetContents> create(const String& origi nalURL, const CSSParserContext& context) 55 static PassRefPtrWillBeRawPtr<StyleSheetContents> create(const String& origi nalURL, const CSSParserContext& context)
55 { 56 {
56 return adoptRefWillBeNoop(new StyleSheetContents(0, originalURL, context )); 57 return adoptRefWillBeNoop(new StyleSheetContents(0, originalURL, context ));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 void findFontFaceRules(WillBeHeapVector<RawPtrWillBeMember<const StyleRuleFo ntFace>>& fontFaceRules); 97 void findFontFaceRules(WillBeHeapVector<RawPtrWillBeMember<const StyleRuleFo ntFace>>& fontFaceRules);
97 98
98 void parserAddNamespace(const AtomicString& prefix, const AtomicString& uri) ; 99 void parserAddNamespace(const AtomicString& prefix, const AtomicString& uri) ;
99 void parserAppendRule(PassRefPtrWillBeRawPtr<StyleRuleBase>); 100 void parserAppendRule(PassRefPtrWillBeRawPtr<StyleRuleBase>);
100 101
101 void clearRules(); 102 void clearRules();
102 103
103 // Rules other than @import. 104 // Rules other than @import.
104 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>>& childRules() cons t { return m_childRules; } 105 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>>& childRules() cons t { return m_childRules; }
105 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleImport>>& importRules() c onst { return m_importRules; } 106 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleImport>>& importRules() c onst { return m_importRules; }
107 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleNamespace>>& namespaceRul es() const { return m_namespaceRules; }
106 108
107 void notifyLoadedSheet(const CSSStyleSheetResource*); 109 void notifyLoadedSheet(const CSSStyleSheetResource*);
108 110
109 StyleSheetContents* parentStyleSheet() const; 111 StyleSheetContents* parentStyleSheet() const;
110 StyleRuleImport* ownerRule() const { return m_ownerRule; } 112 StyleRuleImport* ownerRule() const { return m_ownerRule; }
111 void clearOwnerRule() { m_ownerRule = nullptr; } 113 void clearOwnerRule() { m_ownerRule = nullptr; }
112 114
113 // Note that href is the URL that started the redirect chain that led to 115 // Note that href is the URL that started the redirect chain that led to
114 // this style sheet. This property probably isn't useful for much except 116 // this style sheet. This property probably isn't useful for much except
115 // the JavaScript binding (which needs to use this value for security). 117 // the JavaScript binding (which needs to use this value for security).
116 String originalURL() const { return m_originalURL; } 118 String originalURL() const { return m_originalURL; }
117 const KURL& baseURL() const { return m_parserContext.baseURL(); } 119 const KURL& baseURL() const { return m_parserContext.baseURL(); }
118 120
119 unsigned ruleCount() const; 121 unsigned ruleCount() const;
120 StyleRuleBase* ruleAt(unsigned index) const; 122 StyleRuleBase* ruleAt(unsigned index) const;
121 123
122 unsigned estimatedSizeInBytes() const; 124 unsigned estimatedSizeInBytes() const;
123 125
124 bool wrapperInsertRule(PassRefPtrWillBeRawPtr<StyleRuleBase>, unsigned index ); 126 bool wrapperInsertRule(PassRefPtrWillBeRawPtr<StyleRuleBase>, unsigned index );
125 void wrapperDeleteRule(unsigned index); 127 bool wrapperDeleteRule(unsigned index);
126 128
127 PassRefPtrWillBeRawPtr<StyleSheetContents> copy() const 129 PassRefPtrWillBeRawPtr<StyleSheetContents> copy() const
128 { 130 {
129 return adoptRefWillBeNoop(new StyleSheetContents(*this)); 131 return adoptRefWillBeNoop(new StyleSheetContents(*this));
130 } 132 }
131 133
132 void registerClient(CSSStyleSheet*); 134 void registerClient(CSSStyleSheet*);
133 void unregisterClient(CSSStyleSheet*); 135 void unregisterClient(CSSStyleSheet*);
134 size_t clientSize() const { return m_loadingClients.size() + m_completedClie nts.size(); } 136 size_t clientSize() const { return m_loadingClients.size() + m_completedClie nts.size(); }
135 bool hasOneClient() { return clientSize() == 1; } 137 bool hasOneClient() { return clientSize() == 1; }
(...skipping 29 matching lines...) Expand all
165 StyleSheetContents& operator=(const StyleSheetContents&) = delete; 167 StyleSheetContents& operator=(const StyleSheetContents&) = delete;
166 void notifyRemoveFontFaceRule(const StyleRuleFontFace*); 168 void notifyRemoveFontFaceRule(const StyleRuleFontFace*);
167 169
168 Document* clientSingleOwnerDocument() const; 170 Document* clientSingleOwnerDocument() const;
169 171
170 RawPtrWillBeMember<StyleRuleImport> m_ownerRule; 172 RawPtrWillBeMember<StyleRuleImport> m_ownerRule;
171 173
172 String m_originalURL; 174 String m_originalURL;
173 175
174 WillBeHeapVector<RefPtrWillBeMember<StyleRuleImport>> m_importRules; 176 WillBeHeapVector<RefPtrWillBeMember<StyleRuleImport>> m_importRules;
177 WillBeHeapVector<RefPtrWillBeMember<StyleRuleNamespace>> m_namespaceRules;
175 WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>> m_childRules; 178 WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>> m_childRules;
176 typedef HashMap<AtomicString, AtomicString> PrefixNamespaceURIMap; 179 typedef HashMap<AtomicString, AtomicString> PrefixNamespaceURIMap;
177 PrefixNamespaceURIMap m_namespaces; 180 PrefixNamespaceURIMap m_namespaces;
178 AtomicString m_defaultNamespace; 181 AtomicString m_defaultNamespace;
179 182
180 bool m_hasSyntacticallyValidCSSHeader : 1; 183 bool m_hasSyntacticallyValidCSSHeader : 1;
181 bool m_didLoadErrorOccur : 1; 184 bool m_didLoadErrorOccur : 1;
182 bool m_isMutable : 1; 185 bool m_isMutable : 1;
183 bool m_isInMemoryCache : 1; 186 bool m_isInMemoryCache : 1;
184 bool m_hasFontFaceRule : 1; 187 bool m_hasFontFaceRule : 1;
185 bool m_hasMediaQueries : 1; 188 bool m_hasMediaQueries : 1;
186 bool m_hasSingleOwnerDocument : 1; 189 bool m_hasSingleOwnerDocument : 1;
187 190
188 CSSParserContext m_parserContext; 191 CSSParserContext m_parserContext;
189 192
190 WillBeHeapHashSet<RawPtrWillBeWeakMember<CSSStyleSheet>> m_loadingClients; 193 WillBeHeapHashSet<RawPtrWillBeWeakMember<CSSStyleSheet>> m_loadingClients;
191 WillBeHeapHashSet<RawPtrWillBeWeakMember<CSSStyleSheet>> m_completedClients; 194 WillBeHeapHashSet<RawPtrWillBeWeakMember<CSSStyleSheet>> m_completedClients;
192 195
193 OwnPtrWillBeMember<RuleSet> m_ruleSet; 196 OwnPtrWillBeMember<RuleSet> m_ruleSet;
194 String m_sourceMapURL; 197 String m_sourceMapURL;
195 }; 198 };
196 199
197 } // namespace 200 } // namespace
198 201
199 #endif 202 #endif
OLDNEW
« no previous file with comments | « Source/core/css/StyleRule.cpp ('k') | Source/core/css/StyleSheetContents.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698