OLD | NEW |
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 | 3 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights |
4 * reserved. | 4 * reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 30 matching lines...) Expand all Loading... |
41 class Node; | 41 class Node; |
42 class SecurityOrigin; | 42 class SecurityOrigin; |
43 class StyleRuleBase; | 43 class StyleRuleBase; |
44 class StyleRuleFontFace; | 44 class StyleRuleFontFace; |
45 class StyleRuleImport; | 45 class StyleRuleImport; |
46 class StyleRuleNamespace; | 46 class StyleRuleNamespace; |
47 | 47 |
48 class CORE_EXPORT StyleSheetContents | 48 class CORE_EXPORT StyleSheetContents |
49 : public GarbageCollectedFinalized<StyleSheetContents> { | 49 : public GarbageCollectedFinalized<StyleSheetContents> { |
50 public: | 50 public: |
51 static StyleSheetContents* create(const CSSParserContext& context) { | 51 static StyleSheetContents* create(const CSSParserContext* context) { |
52 return new StyleSheetContents(0, String(), context); | 52 return new StyleSheetContents(0, String(), context); |
53 } | 53 } |
54 static StyleSheetContents* create(const String& originalURL, | 54 static StyleSheetContents* create(const String& originalURL, |
55 const CSSParserContext& context) { | 55 const CSSParserContext* context) { |
56 return new StyleSheetContents(0, originalURL, context); | 56 return new StyleSheetContents(0, originalURL, context); |
57 } | 57 } |
58 static StyleSheetContents* create(StyleRuleImport* ownerRule, | 58 static StyleSheetContents* create(StyleRuleImport* ownerRule, |
59 const String& originalURL, | 59 const String& originalURL, |
60 const CSSParserContext& context) { | 60 const CSSParserContext* context) { |
61 return new StyleSheetContents(ownerRule, originalURL, context); | 61 return new StyleSheetContents(ownerRule, originalURL, context); |
62 } | 62 } |
63 | 63 |
64 ~StyleSheetContents(); | 64 ~StyleSheetContents(); |
65 | 65 |
66 const CSSParserContext& parserContext() const { return m_parserContext; } | 66 const CSSParserContext* parserContext() const { return m_parserContext; } |
67 | 67 |
68 const AtomicString& defaultNamespace() { return m_defaultNamespace; } | 68 const AtomicString& defaultNamespace() { return m_defaultNamespace; } |
69 const AtomicString& namespaceURIFromPrefix(const AtomicString& prefix); | 69 const AtomicString& namespaceURIFromPrefix(const AtomicString& prefix); |
70 | 70 |
71 void parseAuthorStyleSheet(const CSSStyleSheetResource*, | 71 void parseAuthorStyleSheet(const CSSStyleSheetResource*, |
72 const SecurityOrigin*); | 72 const SecurityOrigin*); |
73 void parseString(const String&); | 73 void parseString(const String&); |
74 void parseStringAtPosition(const String&, const TextPosition&); | 74 void parseStringAtPosition(const String&, const TextPosition&); |
75 | 75 |
76 bool isCacheableForResource() const; | 76 bool isCacheableForResource() const; |
77 bool isCacheableForStyleElement() const; | 77 bool isCacheableForStyleElement() const; |
78 | 78 |
79 bool isLoading() const; | 79 bool isLoading() const; |
80 | 80 |
81 void checkLoaded(); | 81 void checkLoaded(); |
82 void startLoadingDynamicSheet(); | 82 void startLoadingDynamicSheet(); |
83 | 83 |
84 StyleSheetContents* rootStyleSheet() const; | 84 StyleSheetContents* rootStyleSheet() const; |
85 bool hasSingleOwnerNode() const; | 85 bool hasSingleOwnerNode() const; |
86 Node* singleOwnerNode() const; | 86 Node* singleOwnerNode() const; |
87 Document* singleOwnerDocument() const; | 87 Document* singleOwnerDocument() const; |
88 bool hasSingleOwnerDocument() const { return m_hasSingleOwnerDocument; } | 88 bool hasSingleOwnerDocument() const { return m_hasSingleOwnerDocument; } |
89 | 89 |
90 // Gets the first owner document in the list of registered clients, or nullptr | 90 // Gets the first owner document in the list of registered clients, or nullptr |
91 // if there are none. | 91 // if there are none. |
92 Document* anyOwnerDocument() const; | 92 Document* anyOwnerDocument() const; |
93 | 93 |
94 const String& charset() const { return m_parserContext.charset(); } | 94 const String& charset() const { return m_parserContext->charset(); } |
95 | 95 |
96 bool loadCompleted() const; | 96 bool loadCompleted() const; |
97 bool hasFailedOrCanceledSubresources() const; | 97 bool hasFailedOrCanceledSubresources() const; |
98 | 98 |
99 void setHasSyntacticallyValidCSSHeader(bool isValidCss); | 99 void setHasSyntacticallyValidCSSHeader(bool isValidCss); |
100 bool hasSyntacticallyValidCSSHeader() const { | 100 bool hasSyntacticallyValidCSSHeader() const { |
101 return m_hasSyntacticallyValidCSSHeader; | 101 return m_hasSyntacticallyValidCSSHeader; |
102 } | 102 } |
103 | 103 |
104 void setHasFontFaceRule() { m_hasFontFaceRule = true; } | 104 void setHasFontFaceRule() { m_hasFontFaceRule = true; } |
(...skipping 23 matching lines...) Expand all Loading... |
128 void notifyLoadedSheet(const CSSStyleSheetResource*); | 128 void notifyLoadedSheet(const CSSStyleSheetResource*); |
129 | 129 |
130 StyleSheetContents* parentStyleSheet() const; | 130 StyleSheetContents* parentStyleSheet() const; |
131 StyleRuleImport* ownerRule() const { return m_ownerRule; } | 131 StyleRuleImport* ownerRule() const { return m_ownerRule; } |
132 void clearOwnerRule() { m_ownerRule = nullptr; } | 132 void clearOwnerRule() { m_ownerRule = nullptr; } |
133 | 133 |
134 // Note that href is the URL that started the redirect chain that led to | 134 // Note that href is the URL that started the redirect chain that led to |
135 // this style sheet. This property probably isn't useful for much except | 135 // this style sheet. This property probably isn't useful for much except |
136 // the JavaScript binding (which needs to use this value for security). | 136 // the JavaScript binding (which needs to use this value for security). |
137 String originalURL() const { return m_originalURL; } | 137 String originalURL() const { return m_originalURL; } |
138 const KURL& baseURL() const { return m_parserContext.baseURL(); } | 138 const KURL& baseURL() const { return m_parserContext->baseURL(); } |
139 | 139 |
140 unsigned ruleCount() const; | 140 unsigned ruleCount() const; |
141 StyleRuleBase* ruleAt(unsigned index) const; | 141 StyleRuleBase* ruleAt(unsigned index) const; |
142 | 142 |
143 unsigned estimatedSizeInBytes() const; | 143 unsigned estimatedSizeInBytes() const; |
144 | 144 |
145 bool wrapperInsertRule(StyleRuleBase*, unsigned index); | 145 bool wrapperInsertRule(StyleRuleBase*, unsigned index); |
146 bool wrapperDeleteRule(unsigned index); | 146 bool wrapperDeleteRule(unsigned index); |
147 | 147 |
148 StyleSheetContents* copy() const { return new StyleSheetContents(*this); } | 148 StyleSheetContents* copy() const { return new StyleSheetContents(*this); } |
(...skipping 29 matching lines...) Expand all Loading... |
178 RuleSet& ensureRuleSet(const MediaQueryEvaluator&, AddRuleFlags); | 178 RuleSet& ensureRuleSet(const MediaQueryEvaluator&, AddRuleFlags); |
179 void clearRuleSet(); | 179 void clearRuleSet(); |
180 | 180 |
181 String sourceMapURL() const { return m_sourceMapURL; } | 181 String sourceMapURL() const { return m_sourceMapURL; } |
182 | 182 |
183 DECLARE_TRACE(); | 183 DECLARE_TRACE(); |
184 | 184 |
185 private: | 185 private: |
186 StyleSheetContents(StyleRuleImport* ownerRule, | 186 StyleSheetContents(StyleRuleImport* ownerRule, |
187 const String& originalURL, | 187 const String& originalURL, |
188 const CSSParserContext&); | 188 const CSSParserContext*); |
189 StyleSheetContents(const StyleSheetContents&); | 189 StyleSheetContents(const StyleSheetContents&); |
190 StyleSheetContents() = delete; | 190 StyleSheetContents() = delete; |
191 StyleSheetContents& operator=(const StyleSheetContents&) = delete; | 191 StyleSheetContents& operator=(const StyleSheetContents&) = delete; |
192 void notifyRemoveFontFaceRule(const StyleRuleFontFace*); | 192 void notifyRemoveFontFaceRule(const StyleRuleFontFace*); |
193 | 193 |
194 Document* clientSingleOwnerDocument() const; | 194 Document* clientSingleOwnerDocument() const; |
195 Document* clientAnyOwnerDocument() const; | 195 Document* clientAnyOwnerDocument() const; |
196 | 196 |
197 Member<StyleRuleImport> m_ownerRule; | 197 Member<StyleRuleImport> m_ownerRule; |
198 | 198 |
199 String m_originalURL; | 199 String m_originalURL; |
200 | 200 |
201 HeapVector<Member<StyleRuleImport>> m_importRules; | 201 HeapVector<Member<StyleRuleImport>> m_importRules; |
202 HeapVector<Member<StyleRuleNamespace>> m_namespaceRules; | 202 HeapVector<Member<StyleRuleNamespace>> m_namespaceRules; |
203 HeapVector<Member<StyleRuleBase>> m_childRules; | 203 HeapVector<Member<StyleRuleBase>> m_childRules; |
204 using PrefixNamespaceURIMap = HashMap<AtomicString, AtomicString>; | 204 using PrefixNamespaceURIMap = HashMap<AtomicString, AtomicString>; |
205 PrefixNamespaceURIMap m_namespaces; | 205 PrefixNamespaceURIMap m_namespaces; |
206 AtomicString m_defaultNamespace; | 206 AtomicString m_defaultNamespace; |
207 WeakMember<CSSStyleSheetResource> m_referencedFromResource; | 207 WeakMember<CSSStyleSheetResource> m_referencedFromResource; |
208 | 208 |
209 bool m_hasSyntacticallyValidCSSHeader : 1; | 209 bool m_hasSyntacticallyValidCSSHeader : 1; |
210 bool m_didLoadErrorOccur : 1; | 210 bool m_didLoadErrorOccur : 1; |
211 bool m_isMutable : 1; | 211 bool m_isMutable : 1; |
212 bool m_hasFontFaceRule : 1; | 212 bool m_hasFontFaceRule : 1; |
213 bool m_hasViewportRule : 1; | 213 bool m_hasViewportRule : 1; |
214 bool m_hasMediaQueries : 1; | 214 bool m_hasMediaQueries : 1; |
215 bool m_hasSingleOwnerDocument : 1; | 215 bool m_hasSingleOwnerDocument : 1; |
216 bool m_isUsedFromTextCache : 1; | 216 bool m_isUsedFromTextCache : 1; |
217 | 217 |
218 CSSParserContext m_parserContext; | 218 Member<const CSSParserContext> m_parserContext; |
219 | 219 |
220 HeapHashSet<WeakMember<CSSStyleSheet>> m_loadingClients; | 220 HeapHashSet<WeakMember<CSSStyleSheet>> m_loadingClients; |
221 HeapHashSet<WeakMember<CSSStyleSheet>> m_completedClients; | 221 HeapHashSet<WeakMember<CSSStyleSheet>> m_completedClients; |
222 | 222 |
223 Member<RuleSet> m_ruleSet; | 223 Member<RuleSet> m_ruleSet; |
224 String m_sourceMapURL; | 224 String m_sourceMapURL; |
225 }; | 225 }; |
226 | 226 |
227 } // namespace blink | 227 } // namespace blink |
228 | 228 |
229 #endif | 229 #endif |
OLD | NEW |