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

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

Issue 2315923002: Lazy Parse CSS (Closed)
Patch Set: Remove the closure and refactor logic into a separate file 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 1cfe952aee2ffaf2da6f2f76c598554c86f03136..e6cedf031ccf9b0bb3c192e912f8ea13527f2c54 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 {

Powered by Google App Engine
This is Rietveld 408576698