Commit b58fb795 authored by bugsnash's avatar bugsnash Committed by Commit bot

Refactored out need to pass property to IsValidAnimationPropertyList.

Part of project Ribbon

This refactor is one step in the process of refactoring out property
specific logic inside switch cases in
CSSPropertyParser::ParseSingleValue. This is required to implement the
parseSingleValue methods in the property APIs without passing property
ID to the API.

Given that the IsValidAnimationPropertyList function only ever returned
false if the property passed was CSSPropertyTransitionProperty, this
check was moved to the calling methods.

The next step in this process will be to refactor out the need to pass
property to the ConsumeAnimationPropertyList function. At this stage the
call to IsValidAnimationPropertyList will be moved to the
CSSPropertyTransitionProperty case only and the check for this property
will be removed.

The check for this property in
CSSPropertyParser::ConsumeAnimationShorthand will be refactored out at a
later stage in project Ribbon.


Cr-Commit-Position: refs/heads/master@{#467277}
parent 40c92451
......@@ -490,9 +490,8 @@ static CSSValue* ConsumeAnimationValue(CSSPropertyID property,
static bool IsValidAnimationPropertyList(CSSPropertyID property,
const CSSValueList& value_list) {
if (property != CSSPropertyTransitionProperty || value_list.length() < 2)
static bool IsValidAnimationPropertyList(const CSSValueList& value_list) {
if (value_list.length() < 2)
return true;
for (auto& value : value_list) {
if (value->IsIdentifierValue() &&
......@@ -515,7 +514,8 @@ static CSSValueList* ConsumeAnimationPropertyList(
return nullptr;
} while (ConsumeCommaIncludingWhitespace(range));
if (!IsValidAnimationPropertyList(property, *list))
if (property == CSSPropertyTransitionProperty &&
return nullptr;
return list;
......@@ -561,7 +561,11 @@ bool CSSPropertyParser::ConsumeAnimationShorthand(
} while (ConsumeCommaIncludingWhitespace(range_));
for (size_t i = 0; i < longhand_count; ++i) {
if (!IsValidAnimationPropertyList([i], *longhands[i]))
// TODO(bugsnash): Refactor out the need to check for
// CSSPropertyTransitionProperty here when this is method implemented in the
// property APIs
if ([i] == CSSPropertyTransitionProperty &&
return false;
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