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

Unified Diff: third_party/WebKit/Source/core/css/StyleRule.h

Issue 2315923002: Lazy Parse CSS (Closed)
Patch Set: esprehn review Created 4 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: third_party/WebKit/Source/core/css/StyleRule.h
diff --git a/third_party/WebKit/Source/core/css/StyleRule.h b/third_party/WebKit/Source/core/css/StyleRule.h
index 2f01d8e67aa0cc93d2854e64d0a039a6494fcdc2..a2f16cf2026d2ff4a8e03f9737531f5afedbddcc 100644
--- a/third_party/WebKit/Source/core/css/StyleRule.h
+++ b/third_party/WebKit/Source/core/css/StyleRule.h
@@ -99,11 +99,15 @@ class CORE_EXPORT StyleRule : public StyleRuleBase {
StylePropertySet* properties) {
return new StyleRule(std::move(selectorList), properties);
}
+ static StyleRule* createLazy(CSSSelectorList selectorList,
+ CSSLazyPropertyParser* lazyPropertyParser) {
+ return new StyleRule(std::move(selectorList), lazyPropertyParser);
+ }
~StyleRule();
const CSSSelectorList& selectorList() const { return m_selectorList; }
- const StylePropertySet& properties() const { return *m_properties; }
+ const StylePropertySet& properties() const;
MutableStylePropertySet& mutableProperties();
void wrapperAdoptSelectorList(CSSSelectorList selectors) {
@@ -114,14 +118,20 @@ class CORE_EXPORT StyleRule : public StyleRuleBase {
static unsigned averageSizeInBytes();
+ // Helper methods to avoid parsing lazy properties when not needed.
+ bool propertiesHaveFailedOrCanceledSubresources() const;
+ bool shouldConsiderForMatchingRules(bool includeEmptyRules) const;
+
DECLARE_TRACE_AFTER_DISPATCH();
private:
StyleRule(CSSSelectorList, StylePropertySet*);
+ StyleRule(CSSSelectorList, CSSLazyPropertyParser*);
StyleRule(const StyleRule&);
- Member<StylePropertySet> m_properties; // Cannot be null.
CSSSelectorList m_selectorList;
+ mutable Member<StylePropertySet> m_properties;
+ mutable Member<CSSLazyPropertyParser> m_lazyPropertyParser;
};
class StyleRuleFontFace : public StyleRuleBase {
« no previous file with comments | « third_party/WebKit/Source/core/css/StylePropertySet.cpp ('k') | third_party/WebKit/Source/core/css/StyleRule.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698