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(
const CSSParserContext* context) {
DCHECK(context);
CSSPropertyParser parser(range, context, nullptr);
const CSSValue* value = CSSPropertyParserHelpers::ParseLonghandViaAPI(
property, CSSPropertyInvalid, *parser.context_, parser.range_);
const CSSValue* value = ParseLonghandViaAPI(property, CSSPropertyInvalid,
*parser.context_, parser.range_);
if (!value || !parser.range_.AtEnd())
return nullptr;
return value;
......@@ -97,16 +97,20 @@ bool CSSPropertyParser::ParseValueStart(CSSPropertyID unresolved_property,
CSSPropertyID property_id = resolveCSSPropertyID(unresolved_property);
bool is_shorthand = isShorthandProperty(property_id);
DCHECK(context_);
if (is_shorthand) {
// Variable references will fail to parse here and will fall out to the
// 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;
} else {
DCHECK(context_);
if (const CSSValue* parsed_value =
CSSPropertyParserHelpers::ParseLonghandViaAPI(
unresolved_property, CSSPropertyInvalid, *context_, range_)) {
if (const CSSValue* parsed_value = ParseLonghandViaAPI(
unresolved_property, CSSPropertyInvalid, *context_, range_)) {
if (range_.AtEnd()) {
AddProperty(property_id, CSSPropertyInvalid, *parsed_value, important,
IsImplicitProperty::kNotImplicit, *parsed_properties_);
......@@ -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
......@@ -64,12 +64,9 @@ class CSSPropertyParser {
bool ParseValueStart(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 ParseFontFaceDescriptor(CSSPropertyID);
bool ParseShorthand(CSSPropertyID, bool important);
private:
// Inputs:
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