| OLD | NEW |
| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 { | 61 { |
| 62 } | 62 } |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 friend class IgnoringPendingStylesheet; | 65 friend class IgnoringPendingStylesheet; |
| 66 | 66 |
| 67 static PassOwnPtr<StyleEngine> create(Document& document) { return adoptPtr(
new StyleEngine(document)); } | 67 static PassOwnPtr<StyleEngine> create(Document& document) { return adoptPtr(
new StyleEngine(document)); } |
| 68 | 68 |
| 69 ~StyleEngine(); | 69 ~StyleEngine(); |
| 70 | 70 |
| 71 #if !ENABLE(OILPAN) | |
| 72 void detachFromDocument(); | 71 void detachFromDocument(); |
| 73 #endif | |
| 74 | 72 |
| 75 const Vector<RefPtr<CSSStyleSheet>>& activeAuthorStyleSheetsFor(TreeScope&); | 73 const Vector<RefPtr<CSSStyleSheet>>& activeAuthorStyleSheetsFor(TreeScope&); |
| 76 | 74 |
| 77 void modifiedStyleSheet(CSSStyleSheet*); | 75 void modifiedStyleSheet(CSSStyleSheet*); |
| 78 void addStyleSheetCandidateNode(Node*, bool createdByParser); | 76 void addStyleSheetCandidateNode(Node*, bool createdByParser); |
| 79 void removeStyleSheetCandidateNode(Node*, ContainerNode* scopingNode, TreeSc
ope&); | 77 void removeStyleSheetCandidateNode(Node*, ContainerNode* scopingNode, TreeSc
ope&); |
| 80 | 78 |
| 81 void updateActiveStyleSheets(); | 79 void updateActiveStyleSheets(); |
| 82 | 80 |
| 83 bool ignoringPendingStylesheets() const { return m_ignorePendingStylesheets;
} | 81 bool ignoringPendingStylesheets() const { return m_ignorePendingStylesheets;
} |
| (...skipping 14 matching lines...) Expand all Loading... |
| 98 if (!m_resolver) { | 96 if (!m_resolver) { |
| 99 createResolver(); | 97 createResolver(); |
| 100 } else if (m_resolver->hasPendingAuthorStyleSheets()) { | 98 } else if (m_resolver->hasPendingAuthorStyleSheets()) { |
| 101 m_resolver->appendPendingAuthorStyleSheets(); | 99 m_resolver->appendPendingAuthorStyleSheets(); |
| 102 } | 100 } |
| 103 return *m_resolver.get(); | 101 return *m_resolver.get(); |
| 104 } | 102 } |
| 105 | 103 |
| 106 bool hasResolver() const { return m_resolver.get(); } | 104 bool hasResolver() const { return m_resolver.get(); } |
| 107 void clearResolver(); | 105 void clearResolver(); |
| 108 void clearMasterResolver(); | |
| 109 | 106 |
| 110 CSSFontSelector* fontSelector() { return m_fontSelector.get(); } | 107 CSSFontSelector* fontSelector() { return m_fontSelector.get(); } |
| 111 void removeFontFaceRules(const Vector<RawPtr<const StyleRuleFontFace> >&); | 108 void removeFontFaceRules(const Vector<RawPtr<const StyleRuleFontFace> >&); |
| 112 void clearFontCache(); | 109 void clearFontCache(); |
| 113 // updateGenericFontFamilySettings is used from WebSettingsImpl. | 110 // updateGenericFontFamilySettings is used from WebSettingsImpl. |
| 114 void updateGenericFontFamilySettings(); | 111 void updateGenericFontFamilySettings(); |
| 115 | 112 |
| 116 void didDetach(); | 113 void didDetach(); |
| 117 void resolverChanged(); | 114 void resolverChanged(); |
| 118 unsigned resolverAccessCount() const; | 115 unsigned resolverAccessCount() const; |
| 119 | 116 |
| 120 void markDocumentDirty(); | |
| 121 | |
| 122 PassRefPtr<CSSStyleSheet> createSheet(Element*, const String& text); | 117 PassRefPtr<CSSStyleSheet> createSheet(Element*, const String& text); |
| 123 void removeSheet(StyleSheetContents*); | 118 void removeSheet(StyleSheetContents*); |
| 124 | 119 |
| 125 void addScopedStyleResolver(const ScopedStyleResolver* resolver) { m_scopedS
tyleResolvers.add(resolver); } | 120 void addScopedStyleResolver(const ScopedStyleResolver* resolver) { m_scopedS
tyleResolvers.add(resolver); } |
| 126 void removeScopedStyleResolver(const ScopedStyleResolver* resolver) { m_scop
edStyleResolvers.remove(resolver); } | 121 void removeScopedStyleResolver(const ScopedStyleResolver* resolver) { m_scop
edStyleResolvers.remove(resolver); } |
| 127 bool hasOnlyScopedResolverForDocument() const { return m_scopedStyleResolver
s.size() == 1; } | 122 bool hasOnlyScopedResolverForDocument() const { return m_scopedStyleResolver
s.size() == 1; } |
| 128 void collectScopedStyleFeaturesTo(RuleFeatureSet&) const; | 123 void collectScopedStyleFeaturesTo(RuleFeatureSet&) const; |
| 129 | 124 |
| 130 private: | 125 private: |
| 131 // CSSFontSelectorClient implementation. | 126 // CSSFontSelectorClient implementation. |
| 132 virtual void fontsNeedUpdate(CSSFontSelector*) override; | 127 virtual void fontsNeedUpdate(CSSFontSelector*) override; |
| 133 | 128 |
| 134 private: | 129 private: |
| 135 StyleEngine(Document&); | 130 StyleEngine(Document&); |
| 136 | 131 |
| 137 StyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&); | 132 StyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&); |
| 138 StyleSheetCollection* styleSheetCollectionFor(TreeScope&); | 133 StyleSheetCollection* styleSheetCollectionFor(TreeScope&); |
| 139 | 134 |
| 140 void markTreeScopeDirty(TreeScope&); | 135 void markTreeScopeDirty(TreeScope&); |
| 141 | 136 |
| 142 bool isMaster() const { return m_isMaster; } | |
| 143 Document* master(); | |
| 144 Document& document() const { return *m_document; } | |
| 145 | |
| 146 typedef ListHashSet<TreeScope*, 16> TreeScopeSet; | 137 typedef ListHashSet<TreeScope*, 16> TreeScopeSet; |
| 147 static void insertTreeScopeInDocumentOrder(TreeScopeSet&, TreeScope*); | 138 static void insertTreeScopeInDocumentOrder(TreeScopeSet&, TreeScope*); |
| 148 | 139 |
| 149 void createResolver(); | 140 void createResolver(); |
| 150 | 141 |
| 151 const StyleSheetCollection* documentStyleSheetCollection() const | 142 const StyleSheetCollection* documentStyleSheetCollection() const |
| 152 { | 143 { |
| 153 return m_documentStyleSheetCollection.get(); | 144 return m_documentStyleSheetCollection.get(); |
| 154 } | 145 } |
| 155 | 146 |
| 156 StyleSheetCollection* documentStyleSheetCollection() | 147 StyleSheetCollection* documentStyleSheetCollection() |
| 157 { | 148 { |
| 158 return m_documentStyleSheetCollection.get(); | 149 return m_documentStyleSheetCollection.get(); |
| 159 } | 150 } |
| 160 | 151 |
| 161 RawPtr<Document> m_document; | 152 RawPtr<Document> m_document; |
| 162 bool m_isMaster; | |
| 163 | 153 |
| 164 // TODO(esprehn): Remove special separate collection for document. | 154 // TODO(esprehn): Remove special separate collection for document. |
| 165 OwnPtr<StyleSheetCollection> m_documentStyleSheetCollection; | 155 OwnPtr<StyleSheetCollection> m_documentStyleSheetCollection; |
| 166 | 156 |
| 167 typedef HashMap<RawPtr<TreeScope>, OwnPtr<StyleSheetCollection> > StyleSheet
CollectionMap; | 157 typedef HashMap<RawPtr<TreeScope>, OwnPtr<StyleSheetCollection> > StyleSheet
CollectionMap; |
| 168 StyleSheetCollectionMap m_styleSheetCollectionMap; | 158 StyleSheetCollectionMap m_styleSheetCollectionMap; |
| 169 typedef HashSet<RawPtr<const ScopedStyleResolver> > ScopedStyleResolverSet; | 159 typedef HashSet<RawPtr<const ScopedStyleResolver> > ScopedStyleResolverSet; |
| 170 ScopedStyleResolverSet m_scopedStyleResolvers; | 160 ScopedStyleResolverSet m_scopedStyleResolvers; |
| 171 | 161 |
| 172 bool m_documentScopeDirty; | |
| 173 TreeScopeSet m_dirtyTreeScopes; | 162 TreeScopeSet m_dirtyTreeScopes; |
| 174 TreeScopeSet m_activeTreeScopes; | 163 TreeScopeSet m_activeTreeScopes; |
| 175 | 164 |
| 176 bool m_ignorePendingStylesheets; | 165 bool m_ignorePendingStylesheets; |
| 177 OwnPtr<StyleResolver> m_resolver; | 166 OwnPtr<StyleResolver> m_resolver; |
| 178 | 167 |
| 179 RefPtr<CSSFontSelector> m_fontSelector; | 168 RefPtr<CSSFontSelector> m_fontSelector; |
| 180 | 169 |
| 181 HashMap<AtomicString, RawPtr<StyleSheetContents> > m_textToSheetCache; | 170 HashMap<AtomicString, RawPtr<StyleSheetContents> > m_textToSheetCache; |
| 182 HashMap<RawPtr<StyleSheetContents>, AtomicString> m_sheetToTextCache; | 171 HashMap<RawPtr<StyleSheetContents>, AtomicString> m_sheetToTextCache; |
| 183 }; | 172 }; |
| 184 | 173 |
| 185 } | 174 } |
| 186 | 175 |
| 187 #endif // SKY_ENGINE_CORE_DOM_STYLEENGINE_H_ | 176 #endif // SKY_ENGINE_CORE_DOM_STYLEENGINE_H_ |
| OLD | NEW |