Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Unified Diff: third_party/WebKit/Source/core/css/properties/CSSPropertyAlignmentUtils.cpp

Issue 2762623002: [css-align] Adapt the place-content shorthand to the new baseline syntax (Closed)
Patch Set: Keep utility functions private and make consumeSimplifiedXXX public Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/properties/CSSPropertyAlignmentUtils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f878691f6ddd7c1552855214081e9603c7c520c1 100644
--- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAlignmentUtils.cpp
+++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAlignmentUtils.cpp
@@ -44,6 +44,23 @@ bool isBaselineKeyword(CSSValueID id) {
CSSValueBaseline>(id);
}
+CSSValueID 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* consumeBaselineKeyword(CSSParserTokenRange& range) {
CSSValueID id = range.peek().id();
if (CSSPropertyParserHelpers::identMatches<CSSValueBaseline>(id))
@@ -104,17 +121,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;
@@ -153,4 +161,30 @@ CSSValue* CSSPropertyAlignmentUtils::consumeContentDistributionOverflowPosition(
return CSSContentDistributionValue::create(distribution, position, overflow);
}
+CSSValue* CSSPropertyAlignmentUtils::consumeSimplifiedContentPosition(
+ CSSParserTokenRange& range) {
+ CSSValueID id = range.peek().id();
+ if (CSSPropertyParserHelpers::identMatches<CSSValueNormal>(id) ||
Bugs Nash 2017/03/29 21:52:11 Didn't you say you were going to keep CSSValueLast
jfernandez 2017/03/29 22:03:51 Probably I didn't explain it properly. I thought y
+ isContentPositionKeyword(id)) {
+ return CSSContentDistributionValue::create(
+ CSSValueInvalid, range.consumeIncludingWhitespace().id(),
+ CSSValueInvalid);
+ }
+
+ if (isBaselineKeyword(id)) {
+ CSSValue* baseline = consumeBaselineKeyword(range);
+ if (!baseline)
+ return nullptr;
+ return CSSContentDistributionValue::create(
+ CSSValueInvalid, getBaselineKeyword(*baseline), CSSValueInvalid);
+ }
+
+ if (isContentDistributionKeyword(id)) {
+ return CSSContentDistributionValue::create(
+ range.consumeIncludingWhitespace().id(), CSSValueInvalid,
+ CSSValueInvalid);
+ }
+ return nullptr;
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/css/properties/CSSPropertyAlignmentUtils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698