| 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 ffc73fe80bc83c10d6dd96c826c9646bb7d9eb7e..2c595b9333e078f25e0b6cf3841ffbac6deeed31 100644
|
| --- a/third_party/WebKit/Source/core/css/StyleRule.cpp
|
| +++ b/third_party/WebKit/Source/core/css/StyleRule.cpp
|
| @@ -212,15 +212,31 @@ unsigned StyleRule::averageSizeInBytes()
|
|
|
| StyleRule::StyleRule(CSSSelectorList selectorList, StylePropertySet* properties)
|
| : StyleRuleBase(Style)
|
| + , m_selectorList(std::move(selectorList))
|
| , m_properties(properties)
|
| {
|
| - m_selectorList = std::move(selectorList);
|
| +}
|
| +
|
| +StyleRule::StyleRule(CSSSelectorList selectorList, std::unique_ptr<DeferredPropertiesClosure> deferredProperties)
|
| + : StyleRuleBase(Style)
|
| + , m_selectorList(std::move(selectorList))
|
| + , m_deferred(std::move(deferredProperties))
|
| +{
|
| +}
|
| +
|
| +const StylePropertySet& StyleRule::properties() const
|
| +{
|
| + if (!m_properties) {
|
| + m_properties = (*m_deferred)();
|
| + m_deferred.reset();
|
| + }
|
| + return *m_properties;
|
| }
|
|
|
| StyleRule::StyleRule(const StyleRule& o)
|
| : StyleRuleBase(o)
|
| - , m_properties(o.m_properties->mutableCopy())
|
| , m_selectorList(o.m_selectorList.copy())
|
| + , m_properties(o.properties().mutableCopy())
|
| {
|
| }
|
|
|
| @@ -230,11 +246,24 @@ 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());
|
| +}
|
| +
|
| DEFINE_TRACE_AFTER_DISPATCH(StyleRule)
|
| {
|
| visitor->trace(m_properties);
|
|
|