| Index: third_party/WebKit/Source/core/css/properties/CSSPropertyAlignmentUtils.cpp
|
| diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAlignmentUtils.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAlignmentUtils.cpp
|
| index e8af1bb83d0d2c50984be3c4b375214eac0b2811..0cf74c35270c8d4c16c2cf708ec2446f64f4340f 100644
|
| --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAlignmentUtils.cpp
|
| +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAlignmentUtils.cpp
|
| @@ -10,9 +10,8 @@
|
|
|
| namespace blink {
|
|
|
| -namespace {
|
| -
|
| -CSSIdentifierValue* consumeSelfPositionKeyword(CSSParserTokenRange& range) {
|
| +CSSIdentifierValue* CSSPropertyAlignmentUtils::consumeSelfPositionKeyword(
|
| + CSSParserTokenRange& range) {
|
| CSSValueID id = range.peek().id();
|
| if (id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter ||
|
| id == CSSValueSelfStart || id == CSSValueSelfEnd ||
|
| @@ -22,29 +21,47 @@ CSSIdentifierValue* consumeSelfPositionKeyword(CSSParserTokenRange& range) {
|
| return nullptr;
|
| }
|
|
|
| -bool isContentDistributionKeyword(CSSValueID id) {
|
| +bool CSSPropertyAlignmentUtils::isContentDistributionKeyword(CSSValueID id) {
|
| return CSSPropertyParserHelpers::identMatches<
|
| CSSValueSpaceBetween, CSSValueSpaceAround, CSSValueSpaceEvenly,
|
| CSSValueStretch>(id);
|
| }
|
|
|
| -bool isContentPositionKeyword(CSSValueID id) {
|
| +bool CSSPropertyAlignmentUtils::isContentPositionKeyword(CSSValueID id) {
|
| return CSSPropertyParserHelpers::identMatches<
|
| CSSValueStart, CSSValueEnd, CSSValueCenter, CSSValueFlexStart,
|
| CSSValueFlexEnd, CSSValueLeft, CSSValueRight>(id);
|
| }
|
|
|
| -bool isOverflowKeyword(CSSValueID id) {
|
| +bool CSSPropertyAlignmentUtils::isOverflowKeyword(CSSValueID id) {
|
| return CSSPropertyParserHelpers::identMatches<CSSValueUnsafe, CSSValueSafe>(
|
| id);
|
| }
|
|
|
| -bool isBaselineKeyword(CSSValueID id) {
|
| +bool CSSPropertyAlignmentUtils::isBaselineKeyword(CSSValueID id) {
|
| return CSSPropertyParserHelpers::identMatches<CSSValueFirst, CSSValueLast,
|
| CSSValueBaseline>(id);
|
| }
|
|
|
| -CSSValue* consumeBaselineKeyword(CSSParserTokenRange& range) {
|
| +CSSValueID CSSPropertyAlignmentUtils::getBaselineKeyword(CSSValue& value) {
|
| + if (!value.isValuePair()) {
|
| + DCHECK(toCSSIdentifierValue(value).getValueID() == CSSValueBaseline);
|
| + return CSSValueBaseline;
|
| + }
|
| +
|
| + DCHECK(toCSSIdentifierValue(toCSSValuePair(value).second()).getValueID() ==
|
| + CSSValueBaseline);
|
| + if (toCSSIdentifierValue(toCSSValuePair(value).first()).getValueID() ==
|
| + CSSValueLast) {
|
| + return CSSValueLastBaseline;
|
| + }
|
| + DCHECK(toCSSIdentifierValue(toCSSValuePair(value).first()).getValueID() ==
|
| + CSSValueFirst);
|
| + return CSSValueFirstBaseline;
|
| +}
|
| +
|
| +CSSValue* CSSPropertyAlignmentUtils::consumeBaselineKeyword(
|
| + CSSParserTokenRange& range) {
|
| CSSValueID id = range.peek().id();
|
| if (CSSPropertyParserHelpers::identMatches<CSSValueBaseline>(id))
|
| return CSSPropertyParserHelpers::consumeIdent(range);
|
| @@ -61,8 +78,6 @@ CSSValue* consumeBaselineKeyword(CSSParserTokenRange& range) {
|
| return nullptr;
|
| }
|
|
|
| -} // namespace
|
| -
|
| CSSValue* CSSPropertyAlignmentUtils::consumeSelfPositionOverflowPosition(
|
| CSSParserTokenRange& range) {
|
| if (CSSPropertyParserHelpers::identMatches<CSSValueAuto, CSSValueNormal,
|
| @@ -104,17 +119,8 @@ CSSValue* CSSPropertyAlignmentUtils::consumeContentDistributionOverflowPosition(
|
| CSSValue* baseline = consumeBaselineKeyword(range);
|
| if (!baseline)
|
| return nullptr;
|
| - CSSValueID baselineID = CSSValueBaseline;
|
| - if (baseline->isValuePair()) {
|
| - if (toCSSIdentifierValue(toCSSValuePair(baseline)->first())
|
| - .getValueID() == CSSValueLast) {
|
| - baselineID = CSSValueLastBaseline;
|
| - } else {
|
| - baselineID = CSSValueFirstBaseline;
|
| - }
|
| - }
|
| - return CSSContentDistributionValue::create(CSSValueInvalid, baselineID,
|
| - CSSValueInvalid);
|
| + return CSSContentDistributionValue::create(
|
| + CSSValueInvalid, getBaselineKeyword(*baseline), CSSValueInvalid);
|
| }
|
|
|
| CSSValueID distribution = CSSValueInvalid;
|
|
|