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

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: Rebased Created 7 years, 1 month 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 5431346533c6e5eb4decfe3fe12cafcf3cd3da7d..5de019d31d4a4948aabd358bc5568f62a493d20d 100644
--- a/Source/core/css/resolver/StyleResolver.h
+++ b/Source/core/css/resolver/StyleResolver.h
@@ -40,6 +40,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"
@@ -145,6 +146,11 @@ public:
TreeBoundaryCrossingRules& treeBoundaryCrossingRules() { return m_treeBoundaryCrossingRules; }
void processScopedRules(const RuleSet& authorRules, const KURL&, const ContainerNode* scope = 0);
+ 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; }
+
SelectorFilter& selectorFilter() { return m_selectorFilter; }
void setBuildScopedStyleTreeInDocumentOrder(bool enabled) { m_styleTree.setBuildInDocumentOrder(enabled); }
@@ -198,7 +204,12 @@ public:
// FIXME: StyleResolver should not have this member or method.
InspectorCSSOMWrappers& inspectorCSSOMWrappers() { return m_inspectorCSSOMWrappers; }
- const RuleFeatureSet& ruleFeatureSet() const { return m_features; }
+ const RuleFeatureSet& ensureRuleFeatureSet()
+ {
+ if (hasPendingAuthorStyleSheets())
+ appendPendingAuthorStyleSheets();
+ return m_features;
+ }
StyleSharingList& styleSharingList() { return m_styleSharingList; }
@@ -224,6 +235,10 @@ private:
// FIXME: This should probably go away, folded into FontBuilder.
void updateFont(StyleResolverState&);
+ void filterViewportRules(const Vector<RefPtr<StyleRuleBase> >& rules, bool& needsResolveViewport);
+ void filterViewportRulesFromSheet(StyleSheetContents*, bool& needsResolveViewport);
+ bool filterViewportRulesFromAuthorStyleSheets(unsigned firstNew, const Vector<RefPtr<CSSStyleSheet> >& styleSheets);
+
void collectPseudoRulesForElement(Element*, ElementRuleCollector&, PseudoId, unsigned rulesToInclude);
void matchUARules(ElementRuleCollector&, RuleSet*);
void matchAuthorRules(Element*, ElementRuleCollector&, bool includeEmptyRules);
@@ -235,6 +250,7 @@ private:
void matchWatchSelectorRules(ElementRuleCollector&);
void collectFeatures();
void collectTreeBoundaryCrossingRules(Element*, ElementRuleCollector&, bool includeEmptyRules);
+ void resetRuleFeatures();
bool fastRejectSelector(const RuleData&) const;
@@ -286,6 +302,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
@@ -293,10 +311,13 @@ private:
RuleFeatureSet m_features;
OwnPtr<RuleSet> m_siblingRuleSet;
OwnPtr<RuleSet> m_uncommonAttributeRuleSet;
+
// FIXME: watched selectors should be implemented using injected author stylesheets: http://crbug.com/316960
OwnPtr<RuleSet> m_watchedSelectorsRules;
TreeBoundaryCrossingRules m_treeBoundaryCrossingRules;
+ bool m_needCollectFeatures;
+
InspectorCSSOMWrappers m_inspectorCSSOMWrappers;
StyleResourceLoader m_styleResourceLoader;
@@ -323,6 +344,18 @@ inline bool checkRegionSelector(const CSSSelector* regionSelector, Element* regi
return false;
}
+inline bool isDocumentScope(const ContainerNode* scope)
+{
+ return !scope || scope->isDocumentNode();
+}
+
+inline void appendPendingStyleSheetsIfNeeded(StyleResolver* styleResolver)
+{
+ if (!styleResolver || !styleResolver->hasPendingAuthorStyleSheets())
+ return;
+ styleResolver->appendPendingAuthorStyleSheets();
+}
+
} // namespace WebCore
#endif // StyleResolver_h

Powered by Google App Engine
This is Rietveld 408576698