| 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..9e954b738e9d18ecc9443fbfc7f6a172412e31de 100644
|
| --- a/third_party/WebKit/Source/core/css/StyleRule.cpp
|
| +++ b/third_party/WebKit/Source/core/css/StyleRule.cpp
|
| @@ -33,6 +33,7 @@
|
| #include "core/css/StyleRuleImport.h"
|
| #include "core/css/StyleRuleKeyframe.h"
|
| #include "core/css/StyleRuleNamespace.h"
|
| +#include "core/css/parser/CSSParserImpl.h"
|
|
|
| namespace blink {
|
|
|
| @@ -217,10 +218,30 @@ StyleRule::StyleRule(CSSSelectorList selectorList, StylePropertySet* properties)
|
| m_selectorList = std::move(selectorList);
|
| }
|
|
|
| +const StylePropertySet& StyleRule::properties() const
|
| +{
|
| + if (!m_properties) {
|
| + m_properties = CSSParserImpl::parseDeclarationListForLazyStyle(m_lazyTokens, *m_context);
|
| + m_lazyTokens.clear();
|
| + }
|
| + return *m_properties;
|
| +}
|
| +
|
| +StyleRule::StyleRule(CSSSelectorList selectorList, CSSParserTokenRange block, const CSSParserContext* context)
|
| + : StyleRuleBase(Style)
|
| + , m_selectorList(std::move(selectorList))
|
| + , m_properties(nullptr)
|
| + , m_context(context)
|
| +{
|
| + while (!block.atEnd()) {
|
| + m_lazyTokens.append(block.consume());
|
| + }
|
| +}
|
| +
|
| 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,8 +251,9 @@ StyleRule::~StyleRule()
|
|
|
| MutableStylePropertySet& StyleRule::mutableProperties()
|
| {
|
| - if (!m_properties->isMutable())
|
| - m_properties = m_properties->mutableCopy();
|
| + const StylePropertySet& props = properties();
|
| + if (!props.isMutable())
|
| + m_properties = props.mutableCopy();
|
| return *toMutableStylePropertySet(m_properties.get());
|
| }
|
|
|
|
|