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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp

Issue 2888283006: CSS: Use count position values with 3 parts (Closed)
Patch Set: use count in the property APIs Created 3 years, 7 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
Index: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index e29b3bc6b9d72f12275fb08782efe52e328bda78..d94d66bb67f0bd890cd8e003705937312e4aab45 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -1646,10 +1646,30 @@ const CSSValue* CSSPropertyParser::ParseSingleValue(
case CSSPropertyWebkitLogicalWidth:
case CSSPropertyWebkitLogicalHeight:
return CSSPropertyLengthUtils::ConsumeWidthOrHeight(range_, *context_);
- case CSSPropertyScrollSnapDestination:
- case CSSPropertyObjectPosition:
- case CSSPropertyPerspectiveOrigin:
- return ConsumePosition(range_, context_->Mode(), UnitlessQuirk::kForbid);
+ case CSSPropertyScrollSnapDestination: {
+ // TODO(crbug.com/724912): Retire scroll-snap-destination
+ auto syntax =
+ CSSPropertyParserHelpers::PositionSyntax::kPermitThreeValues;
+ return ConsumePosition(range_, *context_, UnitlessQuirk::kForbid, syntax);
+ }
+ case CSSPropertyObjectPosition: {
+ auto syntax =
+ CSSPropertyParserHelpers::PositionSyntax::kPermitThreeValues;
+ const CSSValue* result =
+ ConsumePosition(range_, *context_, UnitlessQuirk::kForbid, syntax);
+ if (syntax == CSSPropertyParserHelpers::PositionSyntax::kCountThreeValues)
+ context_->Count(UseCounter::kThreeValuedPositionObjectPosition);
+ return result;
+ }
+ case CSSPropertyPerspectiveOrigin: {
+ auto syntax =
+ CSSPropertyParserHelpers::PositionSyntax::kPermitThreeValues;
+ const CSSValue* result =
+ ConsumePosition(range_, *context_, UnitlessQuirk::kForbid, syntax);
+ if (syntax == CSSPropertyParserHelpers::PositionSyntax::kCountThreeValues)
+ context_->Count(UseCounter::kThreeValuedPositionPerspectiveOrigin);
+ return result;
+ }
case CSSPropertyWebkitHyphenateCharacter:
case CSSPropertyWebkitLocale:
return ConsumeLocale(range_);
@@ -2610,9 +2630,12 @@ static bool ConsumeBackgroundPosition(CSSParserTokenRange& range,
do {
CSSValue* position_x = nullptr;
CSSValue* position_y = nullptr;
- if (!ConsumePosition(range, context->Mode(), unitless, position_x,
+ auto syntax = CSSPropertyParserHelpers::PositionSyntax::kPermitThreeValues;
+ if (!ConsumePosition(range, *context, unitless, syntax, position_x,
position_y))
return false;
+ if (syntax == CSSPropertyParserHelpers::PositionSyntax::kCountThreeValues)
+ context->Count(UseCounter::kThreeValuedPositionBackground);
AddBackgroundValue(result_x, position_x);
AddBackgroundValue(result_y, position_y);
} while (ConsumeCommaIncludingWhitespace(range));
@@ -2691,9 +2714,14 @@ bool CSSPropertyParser::ConsumeBackgroundShorthand(
ConsumeRepeatStyleComponent(range_, value, value_y, implicit);
} else if (property == CSSPropertyBackgroundPositionX ||
property == CSSPropertyWebkitMaskPositionX) {
- if (!ConsumePosition(range_, context_->Mode(), UnitlessQuirk::kForbid,
- value, value_y))
+ auto syntax =
+ CSSPropertyParserHelpers::PositionSyntax::kPermitThreeValues;
+ if (!ConsumePosition(range_, *context_, UnitlessQuirk::kForbid,
+ syntax, value, value_y))
continue;
+ if (syntax ==
+ CSSPropertyParserHelpers::PositionSyntax::kCountThreeValues)
+ context_->Count(UseCounter::kThreeValuedPositionBackground);
} else if (property == CSSPropertyBackgroundSize ||
property == CSSPropertyWebkitMaskSize) {
if (!ConsumeSlashIncludingWhitespace(range_))

Powered by Google App Engine
This is Rietveld 408576698