Index: Source/core/dom/StyleEngine.h |
diff --git a/Source/core/dom/StyleEngine.h b/Source/core/dom/StyleEngine.h |
index ffe7ae975ae10cf81d7b82192fab07cd3e2455f7..7609e66c594085d90c1e729155db254381ddb2a4 100644 |
--- a/Source/core/dom/StyleEngine.h |
+++ b/Source/core/dom/StyleEngine.h |
@@ -81,7 +81,7 @@ public: |
const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet>>& documentAuthorStyleSheets() const { return m_authorStyleSheets; } |
- const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet>> activeStyleSheetsForInspector() const; |
+ const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet>> activeStyleSheetsForInspector(); |
void modifiedStyleSheet(StyleSheet*); |
void addStyleSheetCandidateNode(Node*, bool createdByParser); |
@@ -177,6 +177,8 @@ public: |
void idChangedForElement(const AtomicString& oldId, const AtomicString& newId, Element&); |
void pseudoStateChangedForElement(CSSSelector::PseudoType, Element&); |
+ TreeScopeStyleSheetCollection* styleSheetCollectionFor(TreeScope&); |
+ |
DECLARE_VIRTUAL_TRACE(); |
private: |
@@ -187,7 +189,6 @@ private: |
StyleEngine(Document&); |
TreeScopeStyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&); |
- TreeScopeStyleSheetCollection* styleSheetCollectionFor(TreeScope&); |
bool shouldUpdateDocumentStyleSheetCollection(StyleResolverUpdateMode) const; |
bool shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode) const; |
@@ -199,52 +200,6 @@ private: |
void scheduleInvalidationSetsForElement(const InvalidationSetVector&, Element&); |
- typedef WillBeHeapHashSet<RawPtrWillBeMember<TreeScope>> UnorderedTreeScopeSet; |
- |
- // A class which holds document-ordered treescopes which have stylesheets. |
- // ListHashSet allows only sequential access, not random access. |
- // So it gets slow when the size of treescopes gets larger when finding |
- // the best place to insert a treescope into the document-ordered |
- // treescopes (requires linear search). |
- // To solve this, use a vector for the document-ordered treescopes and |
- // use a hashset for quickly checking whether a given treescope is |
- // in the document-ordered treescopes or not. |
- class OrderedTreeScopeSet final { |
- DISALLOW_ALLOCATION(); |
- WTF_MAKE_NONCOPYABLE(OrderedTreeScopeSet); |
- public: |
- OrderedTreeScopeSet() { } |
- |
- void insert(TreeScope*); |
- void remove(TreeScope*); |
- |
- // When we don't need to consider document-order, use this iterator. |
- // Otherwise, use [] operator. |
- UnorderedTreeScopeSet::iterator beginUnordered() { return m_hash.begin(); } |
- UnorderedTreeScopeSet::iterator endUnordered() { return m_hash.end(); } |
- |
- bool isEmpty() const { return m_treeScopes.isEmpty(); } |
- void clear() |
- { |
- m_treeScopes.clear(); |
- m_hash.clear(); |
- } |
- |
- size_t size() const { return m_treeScopes.size(); } |
- |
- TreeScope* operator[](size_t i) { return m_treeScopes[i]; } |
- const TreeScope* operator[](size_t i) const { return m_treeScopes[i]; } |
- |
- DECLARE_TRACE(); |
- |
- private: |
- WillBeHeapVector<RawPtrWillBeMember<TreeScope>, 16> m_treeScopes; |
- UnorderedTreeScopeSet m_hash; |
- }; |
- |
- static void insertTreeScopeInDocumentOrder(OrderedTreeScopeSet&, TreeScope*); |
- void clearMediaQueryRuleSetOnTreeScopeStyleSheets(UnorderedTreeScopeSet::iterator begin, UnorderedTreeScopeSet::iterator end); |
- |
void createResolver(); |
static PassRefPtrWillBeRawPtr<CSSStyleSheet> parseSheet(Element*, const String& text, TextPosition startPosition, bool createdByParser); |
@@ -259,7 +214,7 @@ private: |
return m_documentStyleSheetCollection.get(); |
} |
- void updateActiveStyleSheetsInShadow(StyleResolverUpdateMode, TreeScope*, UnorderedTreeScopeSet& treeScopesRemoved); |
+ void updateActiveStyleSheetsInShadow(StyleResolverUpdateMode, TreeScope*, TreeScope::UnorderedTreeScopeSet& treeScopesRemoved); |
RawPtrWillBeMember<Document> m_document; |
bool m_isMaster; |
@@ -278,8 +233,7 @@ private: |
StyleSheetCollectionMap m_styleSheetCollectionMap; |
bool m_documentScopeDirty; |
- UnorderedTreeScopeSet m_dirtyTreeScopes; |
- OrderedTreeScopeSet m_activeTreeScopes; |
+ TreeScope::UnorderedTreeScopeSet m_dirtyTreeScopes; |
String m_preferredStylesheetSetName; |
String m_selectedStylesheetSetName; |