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

Unified Diff: Source/core/css/resolver/StyleResolver.h

Issue 42543007: StyleResolver should update RuleSets lazily. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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
Index: Source/core/css/resolver/StyleResolver.h
diff --git a/Source/core/css/resolver/StyleResolver.h b/Source/core/css/resolver/StyleResolver.h
index 76bd3075b0e4371cc3b8ddf042f85b2a8c3a2202..08aeedd6a69ef2c7b3a3d7b1615c70fbcf4d1d47 100644
--- a/Source/core/css/resolver/StyleResolver.h
+++ b/Source/core/css/resolver/StyleResolver.h
@@ -39,6 +39,7 @@
#include "wtf/Deque.h"
#include "wtf/HashMap.h"
#include "wtf/HashSet.h"
+#include "wtf/ListHashSet.h"
#include "wtf/RefPtr.h"
#include "wtf/Vector.h"
@@ -215,6 +216,11 @@ public:
void resetAtHostRules(const ContainerNode*);
void finishAppendAuthorStyleSheets();
+ void lazyAppendAuthorStyleSheets(unsigned firstNew, const Vector<RefPtr<CSSStyleSheet> >&);
+ void removePendingAuthorStyleSheets(const Vector<RefPtr<CSSStyleSheet> >&);
+ void appendPendingAuthorStyleSheets();
+ bool hasPendingAuthorStyleSheets() const { return m_pendingStyleSheets.size() > 0 || m_needCollectFeatures; }
+
DocumentRuleSets& ruleSets() { return m_ruleSets; }
const DocumentRuleSets& ruleSets() const { return m_ruleSets; }
SelectorFilter& selectorFilter() { return m_selectorFilter; }
@@ -263,6 +269,12 @@ public:
InspectorCSSOMWrappers& inspectorCSSOMWrappers() { return m_inspectorCSSOMWrappers; }
const RuleFeatureSet& ruleFeatureSet() const { return m_features; }
+ const RuleFeatureSet& ensureRuleFeatureSet()
+ {
+ if (hasPendingAuthorStyleSheets())
+ appendPendingAuthorStyleSheets(); // slow path.
+ return m_features;
+ }
StyleSharingList& styleSharingList() { return m_styleSharingList; }
@@ -292,6 +304,7 @@ private:
void matchUARules(ElementRuleCollector&);
void matchUserRules(ElementRuleCollector&, bool includeEmptyRules);
void collectFeatures();
+ void resetRuleFeatures();
bool fastRejectSelector(const RuleData&) const;
@@ -347,6 +360,8 @@ private:
RefPtr<ViewportStyleResolver> m_viewportStyleResolver;
+ ListHashSet<CSSStyleSheet*, 16> m_pendingStyleSheets;
+
ScopedStyleTree m_styleTree;
// FIXME: The entire logic of collecting features on StyleResolver, as well astransferring them
@@ -354,6 +369,7 @@ private:
RuleFeatureSet m_features;
OwnPtr<RuleSet> m_siblingRuleSet;
OwnPtr<RuleSet> m_uncommonAttributeRuleSet;
+ bool m_needCollectFeatures;
InspectorCSSOMWrappers m_inspectorCSSOMWrappers;
« no previous file with comments | « no previous file | Source/core/css/resolver/StyleResolver.cpp » ('j') | Source/core/css/resolver/StyleResolver.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698