Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/StyleRule.cpp |
| diff --git a/third_party/WebKit/Source/core/css/StyleRule.cpp b/third_party/WebKit/Source/core/css/StyleRule.cpp |
| index ba0557f66cda937fd0365a65cd2389af9d83220d..677cb17e9013c9260dc682e699160a47aeea4d24 100644 |
| --- a/third_party/WebKit/Source/core/css/StyleRule.cpp |
| +++ b/third_party/WebKit/Source/core/css/StyleRule.cpp |
| @@ -208,25 +208,51 @@ unsigned StyleRule::averageSizeInBytes() { |
| } |
| StyleRule::StyleRule(CSSSelectorList selectorList, StylePropertySet* properties) |
| - : StyleRuleBase(Style), m_properties(properties) { |
| - m_selectorList = std::move(selectorList); |
| + : StyleRuleBase(Style), |
| + m_selectorList(std::move(selectorList)), |
| + m_properties(properties) {} |
| + |
| +StyleRule::StyleRule(CSSSelectorList selectorList, |
| + CSSLazyPropertyParser* lazyPropertyParser) |
| + : StyleRuleBase(Style), |
| + m_selectorList(std::move(selectorList)), |
| + m_lazyPropertyParser(lazyPropertyParser) {} |
| + |
| +const StylePropertySet& StyleRule::properties() const { |
| + if (!m_properties) { |
| + m_properties = m_lazyPropertyParser->parseProperties(); |
| + m_lazyPropertyParser.clear(); |
| + } |
| + return *m_properties; |
| } |
| StyleRule::StyleRule(const StyleRule& o) |
| : StyleRuleBase(o), |
| - m_properties(o.m_properties->mutableCopy()), |
| - m_selectorList(o.m_selectorList.copy()) {} |
| + m_selectorList(o.m_selectorList.copy()), |
| + m_properties(o.properties().mutableCopy()) {} |
| StyleRule::~StyleRule() {} |
| MutableStylePropertySet& StyleRule::mutableProperties() { |
| - if (!m_properties->isMutable()) |
| + // Ensure m_properties is initialized. |
| + if (!properties().isMutable()) |
| m_properties = m_properties->mutableCopy(); |
| return *toMutableStylePropertySet(m_properties.get()); |
| } |
| +bool StyleRule::propertiesHaveFailedOrCanceledSubresources() const { |
| + return m_properties && m_properties->hasFailedOrCanceledSubresources(); |
| +} |
| + |
| +bool StyleRule::shouldConsiderForMatchingRules(bool includeEmptyRules) const { |
| + // Consider all non-empty property sets if parsing has not been deferred. |
| + // Otherwise, consider all StyleRules with non-null deferred closures. |
| + return includeEmptyRules || !(m_properties && m_properties->isEmpty()); |
|
esprehn
2016/10/24 21:20:20
run demorgans
includeEmptyRules || !m_properties
Charlie Harrison
2016/10/25 15:56:55
Done.
|
| +} |
| + |
| DEFINE_TRACE_AFTER_DISPATCH(StyleRule) { |
| visitor->trace(m_properties); |
| + visitor->trace(m_lazyPropertyParser); |
| StyleRuleBase::traceAfterDispatch(visitor); |
| } |