Index: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp |
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp |
index 2c6c1efdda5aa3c77c31b92e3c24d99d21ade6af..0ab59b22172f9c7e1a40e4efcd0220663fc33b24 100644 |
--- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp |
+++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp |
@@ -1247,41 +1247,35 @@ TransformOrigin StyleBuilderConverter::ConvertTransformOrigin( |
StyleBuilderConverter::ConvertComputedLength<float>(state, list.Item(2))); |
} |
-ScrollSnapPoints StyleBuilderConverter::ConvertSnapPoints( |
- StyleResolverState& state, |
- const CSSValue& value) { |
- // Handles: none | repeat(<length>) |
- ScrollSnapPoints points; |
- points.has_repeat = false; |
- |
- if (!value.IsFunctionValue()) |
- return points; |
- |
- const CSSFunctionValue& repeat_function = ToCSSFunctionValue(value); |
- SECURITY_DCHECK(repeat_function.length() == 1); |
- points.repeat_offset = |
- ConvertLength(state, ToCSSPrimitiveValue(repeat_function.Item(0))); |
- points.has_repeat = true; |
- |
- return points; |
+ScrollSnapType StyleBuilderConverter::ConvertSnapType(StyleResolverState&, |
+ const CSSValue& value) { |
+ ScrollSnapType snapType = ComputedStyle::InitialScrollSnapType(); |
+ if (value.IsValuePair()) { |
+ const CSSValuePair& pair = ToCSSValuePair(value); |
+ snapType.axis = ToCSSIdentifierValue(pair.First()).ConvertTo<SnapAxis>(); |
+ snapType.strictness = |
+ ToCSSIdentifierValue(pair.Second()).ConvertTo<SnapStrictness>(); |
+ } else { |
+ snapType.axis = ToCSSIdentifierValue(value).ConvertTo<SnapAxis>(); |
+ } |
+ return snapType; |
} |
-Vector<LengthPoint> StyleBuilderConverter::ConvertSnapCoordinates( |
- StyleResolverState& state, |
- const CSSValue& value) { |
- // Handles: none | <position># |
- Vector<LengthPoint> coordinates; |
- |
- if (!value.IsValueList()) |
- return coordinates; |
- |
- const CSSValueList& value_list = ToCSSValueList(value); |
- coordinates.ReserveInitialCapacity(value_list.length()); |
- for (auto& snap_coordinate : value_list) { |
- coordinates.UncheckedAppend(ConvertPosition(state, *snap_coordinate)); |
+ScrollSnapAlign StyleBuilderConverter::ConvertSnapAlign(StyleResolverState&, |
+ const CSSValue& value) { |
+ ScrollSnapAlign snapAlign = ComputedStyle::InitialScrollSnapAlign(); |
+ if (value.IsValuePair()) { |
+ const CSSValuePair& pair = ToCSSValuePair(value); |
+ snapAlign.alignmentX = |
+ ToCSSIdentifierValue(pair.First()).ConvertTo<SnapAlignment>(); |
+ snapAlign.alignmentY = |
+ ToCSSIdentifierValue(pair.Second()).ConvertTo<SnapAlignment>(); |
+ } else { |
+ snapAlign.alignmentX = |
+ ToCSSIdentifierValue(value).ConvertTo<SnapAlignment>(); |
+ snapAlign.alignmentY = snapAlign.alignmentX; |
} |
- |
- return coordinates; |
+ return snapAlign; |
} |
PassRefPtr<TranslateTransformOperation> StyleBuilderConverter::ConvertTranslate( |