Chromium Code Reviews| 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..d8b135c8238992e941d7eea781b33355edbe7e09 100644 |
| --- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp |
| +++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp |
| @@ -1247,41 +1247,42 @@ 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; |
| +ScrollSnapType StyleBuilderConverter::ConvertSnapType(StyleResolverState&, |
| + const CSSValue& value) { |
| + ScrollSnapType snapType = ComputedStyle::InitialScrollSnapType(); |
| + if (value.IsValuePair()) { |
| + const CSSValuePair& pair = ToCSSValuePair(value); |
| + snapType.is_none = false; |
| + snapType.axis = ToCSSIdentifierValue(pair.First()).ConvertTo<SnapAxis>(); |
| + snapType.strictness = |
| + ToCSSIdentifierValue(pair.Second()).ConvertTo<SnapStrictness>(); |
| + } else { |
|
majidvp
2017/06/15 13:57:11
nit: my preference is to use a more consistent if/
|
| + if (ToCSSIdentifierValue(value).GetValueID() == CSSValueNone) { |
| + snapType.is_none = true; |
| + return snapType; |
| + } |
| - return points; |
| + snapType.is_none = false; |
| + 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( |