Index: third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp |
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp |
index 56c252edc71bf0f05bcb6bc5fd9340c87efd9e6d..c9adb860c363927abd56f65b56ebfe96f92e30a3 100644 |
--- a/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp |
+++ b/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp |
@@ -36,7 +36,7 @@ |
namespace blink { |
-CSSParserImpl::CSSParserImpl(const CSSParserContext& context, |
+CSSParserImpl::CSSParserImpl(const CSSParserContext* context, |
StyleSheetContents* styleSheet) |
: m_context(context), |
m_styleSheet(styleSheet), |
@@ -47,7 +47,7 @@ MutableStylePropertySet::SetResult CSSParserImpl::parseValue( |
CSSPropertyID unresolvedProperty, |
const String& string, |
bool important, |
- const CSSParserContext& context) { |
+ const CSSParserContext* context) { |
CSSParserImpl parser(context); |
StyleRule::RuleType ruleType = StyleRule::Style; |
if (declaration->cssParserMode() == CSSViewportRuleMode) |
@@ -72,7 +72,7 @@ MutableStylePropertySet::SetResult CSSParserImpl::parseVariableValue( |
const PropertyRegistry* registry, |
const String& value, |
bool important, |
- const CSSParserContext& context, |
+ const CSSParserContext* context, |
bool isAnimationTainted) { |
CSSParserImpl parser(context); |
CSSTokenizer tokenizer(value); |
@@ -153,13 +153,13 @@ ImmutableStylePropertySet* CSSParserImpl::parseInlineStyleDeclaration( |
const String& string, |
Element* element) { |
Document& document = element->document(); |
- CSSParserContext context = |
- CSSParserContext(document.elementSheet().contents()->parserContext(), |
- UseCounter::getFrom(&document)); |
+ CSSParserContext* context = |
+ new CSSParserContext(document.elementSheet().contents()->parserContext(), |
+ UseCounter::getFrom(&document)); |
CSSParserMode mode = element->isHTMLElement() && !document.inQuirksMode() |
? HTMLStandardMode |
: HTMLQuirksMode; |
- context.setMode(mode); |
+ context->setMode(mode); |
CSSParserImpl parser(context, document.elementSheet().contents()); |
CSSTokenizer tokenizer(string); |
parser.consumeDeclarationList(tokenizer.tokenRange(), StyleRule::Style); |
@@ -168,7 +168,7 @@ ImmutableStylePropertySet* CSSParserImpl::parseInlineStyleDeclaration( |
bool CSSParserImpl::parseDeclarationList(MutableStylePropertySet* declaration, |
const String& string, |
- const CSSParserContext& context) { |
+ const CSSParserContext* context) { |
CSSParserImpl parser(context); |
StyleRule::RuleType ruleType = StyleRule::Style; |
if (declaration->cssParserMode() == CSSViewportRuleMode) |
@@ -192,7 +192,7 @@ bool CSSParserImpl::parseDeclarationList(MutableStylePropertySet* declaration, |
} |
StyleRuleBase* CSSParserImpl::parseRule(const String& string, |
- const CSSParserContext& context, |
+ const CSSParserContext* context, |
StyleSheetContents* styleSheet, |
AllowedRulesType allowedRules) { |
CSSParserImpl parser(context, styleSheet); |
@@ -215,12 +215,12 @@ StyleRuleBase* CSSParserImpl::parseRule(const String& string, |
} |
void CSSParserImpl::parseStyleSheet(const String& string, |
- const CSSParserContext& context, |
+ const CSSParserContext* context, |
StyleSheetContents* styleSheet, |
bool deferPropertyParsing) { |
TRACE_EVENT_BEGIN2("blink,blink_style", "CSSParserImpl::parseStyleSheet", |
- "baseUrl", context.baseURL().getString().utf8(), "mode", |
- context.mode()); |
+ "baseUrl", context->baseURL().getString().utf8(), "mode", |
+ context->mode()); |
TRACE_EVENT_BEGIN0("blink,blink_style", |
"CSSParserImpl::parseStyleSheet.tokenize"); |
@@ -334,7 +334,7 @@ bool CSSParserImpl::supportsDeclaration(CSSParserTokenRange& range) { |
void CSSParserImpl::parseDeclarationListForInspector( |
const String& declaration, |
- const CSSParserContext& context, |
+ const CSSParserContext* context, |
CSSParserObserver& observer) { |
CSSParserImpl parser(context); |
CSSParserObserverWrapper wrapper(observer); |
@@ -346,7 +346,7 @@ void CSSParserImpl::parseDeclarationListForInspector( |
} |
void CSSParserImpl::parseStyleSheetForInspector(const String& string, |
- const CSSParserContext& context, |
+ const CSSParserContext* context, |
StyleSheetContents* styleSheet, |
CSSParserObserver& observer) { |
CSSParserImpl parser(context, styleSheet); |
@@ -365,10 +365,10 @@ void CSSParserImpl::parseStyleSheetForInspector(const String& string, |
StylePropertySet* CSSParserImpl::parseDeclarationListForLazyStyle( |
CSSParserTokenRange block, |
- const CSSParserContext& context) { |
+ const CSSParserContext* context) { |
CSSParserImpl parser(context); |
parser.consumeDeclarationList(std::move(block), StyleRule::Style); |
- return createStylePropertySet(parser.m_parsedProperties, context.mode()); |
+ return createStylePropertySet(parser.m_parsedProperties, context->mode()); |
} |
static CSSParserImpl::AllowedRulesType computeNewAllowedRules( |
@@ -450,8 +450,8 @@ StyleRuleBase* CSSParserImpl::consumeAtRule(CSSParserTokenRange& range, |
CSSParserTokenRange prelude = range.makeSubRange(preludeStart, &range.peek()); |
CSSAtRuleID id = cssAtRuleID(name); |
- if (id != CSSAtRuleInvalid && m_context.useCounter()) |
- countAtRule(m_context.useCounter(), id); |
+ if (id != CSSAtRuleInvalid && m_context->isUseCounterRecordingEnabled()) |
+ countAtRule(m_context->useCounter(), id); |
if (range.atEnd() || range.peek().type() == SemicolonToken) { |
range.consume(); |
@@ -639,7 +639,7 @@ StyleRuleViewport* CSSParserImpl::consumeViewportRule( |
CSSParserTokenRange block) { |
// Allow @viewport rules from UA stylesheets even if the feature is disabled. |
if (!RuntimeEnabledFeatures::cssViewportEnabled() && |
- !isUASheetBehavior(m_context.mode())) |
+ !isUASheetBehavior(m_context->mode())) |
return nullptr; |
if (!prelude.atEnd()) |
@@ -699,8 +699,8 @@ StyleRuleKeyframes* CSSParserImpl::consumeKeyframesRule( |
if (nameToken.type() == IdentToken) { |
name = nameToken.value().toString(); |
} else if (nameToken.type() == StringToken && webkitPrefixed) { |
- if (m_context.useCounter()) |
- m_context.useCounter()->count(UseCounter::QuotedKeyframesRule); |
+ if (m_context->isUseCounterRecordingEnabled()) |
+ m_context->useCounter()->count(UseCounter::QuotedKeyframesRule); |
name = nameToken.value().toString(); |
} else { |
return nullptr; // Parse error; expected ident token in @keyframes header |
@@ -744,7 +744,7 @@ StyleRulePage* CSSParserImpl::consumePageRule(CSSParserTokenRange prelude, |
return StyleRulePage::create( |
std::move(selectorList), |
- createStylePropertySet(m_parsedProperties, m_context.mode())); |
+ createStylePropertySet(m_parsedProperties, m_context->mode())); |
} |
void CSSParserImpl::consumeApplyRule(CSSParserTokenRange prelude) { |
@@ -775,7 +775,7 @@ StyleRuleKeyframe* CSSParserImpl::consumeKeyframeStyleRule( |
consumeDeclarationList(block, StyleRule::Keyframe); |
return StyleRuleKeyframe::create( |
std::move(keyList), |
- createStylePropertySet(m_parsedProperties, m_context.mode())); |
+ createStylePropertySet(m_parsedProperties, m_context->mode())); |
} |
static void observeSelectors(CSSParserObserverWrapper& wrapper, |
@@ -821,7 +821,7 @@ StyleRule* CSSParserImpl::consumeStyleRule(CSSParserTokenRange prelude, |
return StyleRule::create( |
std::move(selectorList), |
- createStylePropertySet(m_parsedProperties, m_context.mode())); |
+ createStylePropertySet(m_parsedProperties, m_context->mode())); |
} |
void CSSParserImpl::consumeDeclarationList(CSSParserTokenRange range, |