| 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
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 28 matching lines...) Expand all Loading... |
| 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 class StyleRuleNamespace; |
| 48 | 48 |
| 49 class CORE_EXPORT StyleSheetContents : public RefCountedWillBeGarbageCollectedFi
nalized<StyleSheetContents> { | 49 class CORE_EXPORT StyleSheetContents : public GarbageCollectedFinalized<StyleShe
etContents> { |
| 50 public: | 50 public: |
| 51 static PassRefPtrWillBeRawPtr<StyleSheetContents> create(const CSSParserCont
ext& context) | 51 static RawPtr<StyleSheetContents> create(const CSSParserContext& context) |
| 52 { | 52 { |
| 53 return adoptRefWillBeNoop(new StyleSheetContents(0, String(), context)); | 53 return new StyleSheetContents(0, String(), context); |
| 54 } | 54 } |
| 55 static PassRefPtrWillBeRawPtr<StyleSheetContents> create(const String& origi
nalURL, const CSSParserContext& context) | 55 static RawPtr<StyleSheetContents> create(const String& originalURL, const CS
SParserContext& context) |
| 56 { | 56 { |
| 57 return adoptRefWillBeNoop(new StyleSheetContents(0, originalURL, context
)); | 57 return new StyleSheetContents(0, originalURL, context); |
| 58 } | 58 } |
| 59 static PassRefPtrWillBeRawPtr<StyleSheetContents> create(StyleRuleImport* ow
nerRule, const String& originalURL, const CSSParserContext& context) | 59 static RawPtr<StyleSheetContents> create(StyleRuleImport* ownerRule, const S
tring& originalURL, const CSSParserContext& context) |
| 60 { | 60 { |
| 61 return adoptRefWillBeNoop(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*, const SecurityOrigi
n*); | 71 void parseAuthorStyleSheet(const CSSStyleSheetResource*, const SecurityOrigi
n*); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 87 const String& charset() const { return m_parserContext.charset(); } | 87 const String& charset() const { return m_parserContext.charset(); } |
| 88 | 88 |
| 89 bool loadCompleted() const; | 89 bool loadCompleted() const; |
| 90 bool hasFailedOrCanceledSubresources() const; | 90 bool hasFailedOrCanceledSubresources() const; |
| 91 | 91 |
| 92 void setHasSyntacticallyValidCSSHeader(bool isValidCss); | 92 void setHasSyntacticallyValidCSSHeader(bool isValidCss); |
| 93 bool hasSyntacticallyValidCSSHeader() const { return m_hasSyntacticallyValid
CSSHeader; } | 93 bool hasSyntacticallyValidCSSHeader() const { return m_hasSyntacticallyValid
CSSHeader; } |
| 94 | 94 |
| 95 void setHasFontFaceRule(bool b) { m_hasFontFaceRule = b; } | 95 void setHasFontFaceRule(bool b) { m_hasFontFaceRule = b; } |
| 96 bool hasFontFaceRule() const { return m_hasFontFaceRule; } | 96 bool hasFontFaceRule() const { return m_hasFontFaceRule; } |
| 97 void findFontFaceRules(WillBeHeapVector<RawPtrWillBeMember<const StyleRuleFo
ntFace>>& fontFaceRules); | 97 void findFontFaceRules(HeapVector<Member<const StyleRuleFontFace>>& fontFace
Rules); |
| 98 | 98 |
| 99 void parserAddNamespace(const AtomicString& prefix, const AtomicString& uri)
; | 99 void parserAddNamespace(const AtomicString& prefix, const AtomicString& uri)
; |
| 100 void parserAppendRule(PassRefPtrWillBeRawPtr<StyleRuleBase>); | 100 void parserAppendRule(RawPtr<StyleRuleBase>); |
| 101 | 101 |
| 102 void clearRules(); | 102 void clearRules(); |
| 103 | 103 |
| 104 // Rules other than @import. | 104 // Rules other than @import. |
| 105 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>>& childRules() cons
t { return m_childRules; } | 105 const HeapVector<Member<StyleRuleBase>>& childRules() const { return m_child
Rules; } |
| 106 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleImport>>& importRules() c
onst { return m_importRules; } | 106 const HeapVector<Member<StyleRuleImport>>& importRules() const { return m_im
portRules; } |
| 107 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleNamespace>>& namespaceRul
es() const { return m_namespaceRules; } | 107 const HeapVector<Member<StyleRuleNamespace>>& namespaceRules() const { retur
n m_namespaceRules; } |
| 108 | 108 |
| 109 void notifyLoadedSheet(const CSSStyleSheetResource*); | 109 void notifyLoadedSheet(const CSSStyleSheetResource*); |
| 110 | 110 |
| 111 StyleSheetContents* parentStyleSheet() const; | 111 StyleSheetContents* parentStyleSheet() const; |
| 112 StyleRuleImport* ownerRule() const { return m_ownerRule; } | 112 StyleRuleImport* ownerRule() const { return m_ownerRule; } |
| 113 void clearOwnerRule() { m_ownerRule = nullptr; } | 113 void clearOwnerRule() { m_ownerRule = nullptr; } |
| 114 | 114 |
| 115 // 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 |
| 116 // 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 |
| 117 // the JavaScript binding (which needs to use this value for security). | 117 // the JavaScript binding (which needs to use this value for security). |
| 118 String originalURL() const { return m_originalURL; } | 118 String originalURL() const { return m_originalURL; } |
| 119 const KURL& baseURL() const { return m_parserContext.baseURL(); } | 119 const KURL& baseURL() const { return m_parserContext.baseURL(); } |
| 120 | 120 |
| 121 unsigned ruleCount() const; | 121 unsigned ruleCount() const; |
| 122 StyleRuleBase* ruleAt(unsigned index) const; | 122 StyleRuleBase* ruleAt(unsigned index) const; |
| 123 | 123 |
| 124 unsigned estimatedSizeInBytes() const; | 124 unsigned estimatedSizeInBytes() const; |
| 125 | 125 |
| 126 bool wrapperInsertRule(PassRefPtrWillBeRawPtr<StyleRuleBase>, unsigned index
); | 126 bool wrapperInsertRule(RawPtr<StyleRuleBase>, unsigned index); |
| 127 bool wrapperDeleteRule(unsigned index); | 127 bool wrapperDeleteRule(unsigned index); |
| 128 | 128 |
| 129 PassRefPtrWillBeRawPtr<StyleSheetContents> copy() const | 129 RawPtr<StyleSheetContents> copy() const |
| 130 { | 130 { |
| 131 return adoptRefWillBeNoop(new StyleSheetContents(*this)); | 131 return new StyleSheetContents(*this); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void registerClient(CSSStyleSheet*); | 134 void registerClient(CSSStyleSheet*); |
| 135 void unregisterClient(CSSStyleSheet*); | 135 void unregisterClient(CSSStyleSheet*); |
| 136 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(); } |
| 137 bool hasOneClient() { return clientSize() == 1; } | 137 bool hasOneClient() { return clientSize() == 1; } |
| 138 void clientLoadCompleted(CSSStyleSheet*); | 138 void clientLoadCompleted(CSSStyleSheet*); |
| 139 void clientLoadStarted(CSSStyleSheet*); | 139 void clientLoadStarted(CSSStyleSheet*); |
| 140 | 140 |
| 141 bool isMutable() const { return m_isMutable; } | 141 bool isMutable() const { return m_isMutable; } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 162 | 162 |
| 163 private: | 163 private: |
| 164 StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, co
nst CSSParserContext&); | 164 StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, co
nst CSSParserContext&); |
| 165 StyleSheetContents(const StyleSheetContents&); | 165 StyleSheetContents(const StyleSheetContents&); |
| 166 StyleSheetContents() = delete; | 166 StyleSheetContents() = delete; |
| 167 StyleSheetContents& operator=(const StyleSheetContents&) = delete; | 167 StyleSheetContents& operator=(const StyleSheetContents&) = delete; |
| 168 void notifyRemoveFontFaceRule(const StyleRuleFontFace*); | 168 void notifyRemoveFontFaceRule(const StyleRuleFontFace*); |
| 169 | 169 |
| 170 Document* clientSingleOwnerDocument() const; | 170 Document* clientSingleOwnerDocument() const; |
| 171 | 171 |
| 172 RawPtrWillBeMember<StyleRuleImport> m_ownerRule; | 172 Member<StyleRuleImport> m_ownerRule; |
| 173 | 173 |
| 174 String m_originalURL; | 174 String m_originalURL; |
| 175 | 175 |
| 176 WillBeHeapVector<RefPtrWillBeMember<StyleRuleImport>> m_importRules; | 176 HeapVector<Member<StyleRuleImport>> m_importRules; |
| 177 WillBeHeapVector<RefPtrWillBeMember<StyleRuleNamespace>> m_namespaceRules; | 177 HeapVector<Member<StyleRuleNamespace>> m_namespaceRules; |
| 178 WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>> m_childRules; | 178 HeapVector<Member<StyleRuleBase>> m_childRules; |
| 179 using PrefixNamespaceURIMap = HashMap<AtomicString, AtomicString>; | 179 using PrefixNamespaceURIMap = HashMap<AtomicString, AtomicString>; |
| 180 PrefixNamespaceURIMap m_namespaces; | 180 PrefixNamespaceURIMap m_namespaces; |
| 181 AtomicString m_defaultNamespace; | 181 AtomicString m_defaultNamespace; |
| 182 | 182 |
| 183 bool m_hasSyntacticallyValidCSSHeader : 1; | 183 bool m_hasSyntacticallyValidCSSHeader : 1; |
| 184 bool m_didLoadErrorOccur : 1; | 184 bool m_didLoadErrorOccur : 1; |
| 185 bool m_isMutable : 1; | 185 bool m_isMutable : 1; |
| 186 bool m_isInMemoryCache : 1; | 186 bool m_isInMemoryCache : 1; |
| 187 bool m_hasFontFaceRule : 1; | 187 bool m_hasFontFaceRule : 1; |
| 188 bool m_hasMediaQueries : 1; | 188 bool m_hasMediaQueries : 1; |
| 189 bool m_hasSingleOwnerDocument : 1; | 189 bool m_hasSingleOwnerDocument : 1; |
| 190 | 190 |
| 191 CSSParserContext m_parserContext; | 191 CSSParserContext m_parserContext; |
| 192 | 192 |
| 193 WillBeHeapHashSet<RawPtrWillBeWeakMember<CSSStyleSheet>> m_loadingClients; | 193 HeapHashSet<WeakMember<CSSStyleSheet>> m_loadingClients; |
| 194 WillBeHeapHashSet<RawPtrWillBeWeakMember<CSSStyleSheet>> m_completedClients; | 194 HeapHashSet<WeakMember<CSSStyleSheet>> m_completedClients; |
| 195 | 195 |
| 196 OwnPtrWillBeMember<RuleSet> m_ruleSet; | 196 Member<RuleSet> m_ruleSet; |
| 197 String m_sourceMapURL; | 197 String m_sourceMapURL; |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 } // namespace blink | 200 } // namespace blink |
| 201 | 201 |
| 202 #endif | 202 #endif |
| OLD | NEW |