Commit b88c137e authored by Rob Buis's avatar Rob Buis Committed by Commit Bot

Simplify and cleanup CSSPropertyParser

No need for ParseShorthand or InQuirksMode.

Bug: None

Change-Id: I739a2f2e244cb21c11fe3a7b79ddcc95a655b4e8
Reviewed-on: https://chromium-review.googlesource.com/660757
Commit-Queue: Rob Buis <rob.buis@samsung.com>
Reviewed-by: default avatarmeade_UTC10 <meade@chromium.org>
Reviewed-by: default avatarBugs Nash <bugsnash@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501270}
parent fddbc779
...@@ -81,8 +81,8 @@ const CSSValue* CSSPropertyParser::ParseSingleValue( ...@@ -81,8 +81,8 @@ const CSSValue* CSSPropertyParser::ParseSingleValue(
const CSSParserContext* context) { const CSSParserContext* context) {
DCHECK(context); DCHECK(context);
CSSPropertyParser parser(range, context, nullptr); CSSPropertyParser parser(range, context, nullptr);
const CSSValue* value = CSSPropertyParserHelpers::ParseLonghandViaAPI( const CSSValue* value = ParseLonghandViaAPI(property, CSSPropertyInvalid,
property, CSSPropertyInvalid, *parser.context_, parser.range_); *parser.context_, parser.range_);
if (!value || !parser.range_.AtEnd()) if (!value || !parser.range_.AtEnd())
return nullptr; return nullptr;
return value; return value;
...@@ -97,16 +97,20 @@ bool CSSPropertyParser::ParseValueStart(CSSPropertyID unresolved_property, ...@@ -97,16 +97,20 @@ bool CSSPropertyParser::ParseValueStart(CSSPropertyID unresolved_property,
CSSPropertyID property_id = resolveCSSPropertyID(unresolved_property); CSSPropertyID property_id = resolveCSSPropertyID(unresolved_property);
bool is_shorthand = isShorthandProperty(property_id); bool is_shorthand = isShorthandProperty(property_id);
DCHECK(context_);
if (is_shorthand) { if (is_shorthand) {
// Variable references will fail to parse here and will fall out to the // Variable references will fail to parse here and will fall out to the
// variable ref parser below. // variable ref parser below.
if (ParseShorthand(unresolved_property, important)) if (CSSPropertyAPI::Get(property_id)
.ParseShorthand(
property_id, important, range_, *context_,
CSSParserLocalContext(isPropertyAlias(unresolved_property),
property_id),
*parsed_properties_))
return true; return true;
} else { } else {
DCHECK(context_); if (const CSSValue* parsed_value = ParseLonghandViaAPI(
if (const CSSValue* parsed_value = unresolved_property, CSSPropertyInvalid, *context_, range_)) {
CSSPropertyParserHelpers::ParseLonghandViaAPI(
unresolved_property, CSSPropertyInvalid, *context_, range_)) {
if (range_.AtEnd()) { if (range_.AtEnd()) {
AddProperty(property_id, CSSPropertyInvalid, *parsed_value, important, AddProperty(property_id, CSSPropertyInvalid, *parsed_value, important,
IsImplicitProperty::kNotImplicit, *parsed_properties_); IsImplicitProperty::kNotImplicit, *parsed_properties_);
...@@ -504,14 +508,4 @@ bool CSSPropertyParser::ParseViewportDescriptor(CSSPropertyID prop_id, ...@@ -504,14 +508,4 @@ bool CSSPropertyParser::ParseViewportDescriptor(CSSPropertyID prop_id,
} }
} }
bool CSSPropertyParser::ParseShorthand(CSSPropertyID unresolved_property,
bool important) {
DCHECK(context_);
CSSPropertyID property = resolveCSSPropertyID(unresolved_property);
return CSSPropertyAPI::Get(property).ParseShorthand(
property, important, range_, *context_,
CSSParserLocalContext(isPropertyAlias(unresolved_property), property),
*parsed_properties_);
}
} // namespace blink } // namespace blink
...@@ -64,12 +64,9 @@ class CSSPropertyParser { ...@@ -64,12 +64,9 @@ class CSSPropertyParser {
bool ParseValueStart(CSSPropertyID unresolved_property, bool important); bool ParseValueStart(CSSPropertyID unresolved_property, bool important);
bool ConsumeCSSWideKeyword(CSSPropertyID unresolved_property, bool important); bool ConsumeCSSWideKeyword(CSSPropertyID unresolved_property, bool important);
bool InQuirksMode() const { return IsQuirksModeBehavior(context_->Mode()); }
bool ParseViewportDescriptor(CSSPropertyID prop_id, bool important); bool ParseViewportDescriptor(CSSPropertyID prop_id, bool important);
bool ParseFontFaceDescriptor(CSSPropertyID); bool ParseFontFaceDescriptor(CSSPropertyID);
bool ParseShorthand(CSSPropertyID, bool important);
private: private:
// Inputs: // Inputs:
CSSParserTokenRange range_; CSSParserTokenRange range_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment