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

Unified Diff: third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h

Issue 2932593004: Update the snap points css properties (Closed)
Patch Set: update some tests Created 3 years, 6 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/CSSPrimitiveValueMappings.h
diff --git a/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h b/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h
index 35b69468ba6d2f5076aeac1fb39f6e41de379a5b..4ea3a7acd47494dfa6c631d26b65cff4b480f18d 100644
--- a/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h
+++ b/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h
@@ -2685,35 +2685,141 @@ inline ScrollBehavior CSSIdentifierValue::ConvertTo() const {
}
template <>
-inline CSSIdentifierValue::CSSIdentifierValue(ScrollSnapType snap_type)
+inline CSSIdentifierValue::CSSIdentifierValue(SnapAxis axis)
: CSSValue(kIdentifierClass) {
- switch (snap_type) {
- case kScrollSnapTypeNone:
+ switch (axis) {
+ case kSnapAxisNone:
value_id_ = CSSValueNone;
break;
- case kScrollSnapTypeMandatory:
- value_id_ = CSSValueMandatory;
+ case kSnapAxisX:
+ value_id_ = CSSValueX;
break;
- case kScrollSnapTypeProximity:
- value_id_ = CSSValueProximity;
+ case kSnapAxisY:
+ value_id_ = CSSValueY;
+ break;
+ case kSnapAxisBlock:
+ value_id_ = CSSValueBlock;
+ break;
+ case kSnapAxisInline:
+ value_id_ = CSSValueInline;
+ break;
+ case kSnapAxisBoth:
+ value_id_ = CSSValueBoth;
break;
}
}
template <>
-inline ScrollSnapType CSSIdentifierValue::ConvertTo() const {
+inline SnapAxis CSSIdentifierValue::ConvertTo() const {
switch (GetValueID()) {
case CSSValueNone:
- return kScrollSnapTypeNone;
- case CSSValueMandatory:
- return kScrollSnapTypeMandatory;
+ return kSnapAxisNone;
+ case CSSValueX:
+ return kSnapAxisX;
+ case CSSValueY:
+ return kSnapAxisY;
+ case CSSValueBlock:
+ return kSnapAxisBlock;
+ case CSSValueInline:
+ return kSnapAxisInline;
+ case CSSValueBoth:
+ return kSnapAxisBoth;
+ default:
+ break;
+ }
+ NOTREACHED();
+ return kSnapAxisNone;
+}
+
+template <>
+inline CSSIdentifierValue::CSSIdentifierValue(SnapStrictness strictness)
+ : CSSValue(kIdentifierClass) {
+ switch (strictness) {
+ case kSnapStrictnessProximity:
+ value_id_ = CSSValueProximity;
+ break;
+ case kSnapStrictnessMandatory:
+ value_id_ = CSSValueMandatory;
+ break;
+ }
+}
+
+template <>
+inline SnapStrictness CSSIdentifierValue::ConvertTo() const {
+ switch (GetValueID()) {
case CSSValueProximity:
- return kScrollSnapTypeProximity;
+ return kSnapStrictnessProximity;
+ case CSSValueMandatory:
+ return kSnapStrictnessMandatory;
+ default:
+ break;
+ }
+ NOTREACHED();
+ return kSnapStrictnessProximity;
+}
+
+template <>
+inline CSSIdentifierValue::CSSIdentifierValue(SnapAlignment alignment)
+ : CSSValue(kIdentifierClass) {
+ switch (alignment) {
+ case kSnapAlignmentNone:
+ value_id_ = CSSValueNone;
+ break;
+ case kSnapAlignmentStart:
+ value_id_ = CSSValueStart;
+ break;
+ case kSnapAlignmentEnd:
+ value_id_ = CSSValueEnd;
+ break;
+ case kSnapAlignmentCenter:
+ value_id_ = CSSValueCenter;
+ break;
+ }
+}
+
+template <>
+inline SnapAlignment CSSIdentifierValue::ConvertTo() const {
+ switch (GetValueID()) {
+ case CSSValueNone:
+ return kSnapAlignmentNone;
+ case CSSValueStart:
+ return kSnapAlignmentStart;
+ case CSSValueEnd:
+ return kSnapAlignmentEnd;
+ case CSSValueCenter:
+ return kSnapAlignmentCenter;
+ default:
+ break;
+ }
+ NOTREACHED();
+ return kSnapAlignmentNone;
+}
+
+template <>
shend 2017/06/14 01:37:38 (*) You may delete this function.
sunyunjia 2017/06/14 18:36:21 Done.
+inline CSSIdentifierValue::CSSIdentifierValue(EScrollSnapStop stop)
+ : CSSValue(kIdentifierClass) {
+ switch (stop) {
+ case EScrollSnapStop::kNormal:
+ value_id_ = CSSValueNormal;
+ break;
+ case EScrollSnapStop::kAlways:
+ value_id_ = CSSValueAlways;
+ break;
+ }
+}
+
+template <>
shend 2017/06/14 01:37:38 (*) You may delete this function.
sunyunjia 2017/06/14 18:36:21 Done.
+inline EScrollSnapStop CSSIdentifierValue::ConvertTo() const {
+ switch (GetValueID()) {
+ case CSSValueNormal:
+ return EScrollSnapStop::kNormal;
+ case CSSValueAlways:
+ return EScrollSnapStop::kAlways;
default:
break;
}
NOTREACHED();
- return kScrollSnapTypeNone;
+ return EScrollSnapStop::kNormal;
}
template <>

Powered by Google App Engine
This is Rietveld 408576698