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

Unified Diff: Source/core/dom/StyleEngine.h

Issue 1131493008: WIP: Move StyleEngine::m_activeTreeScopes to TreeScope::m_childTreeScopesWithActiveStyleSheets (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reflected kochi's review Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/dom/StyleEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | Source/core/dom/StyleEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698