| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * * Redistributions of source code must retain the above copyright | 4 * * Redistributions of source code must retain the above copyright |
| 5 * notice, this list of conditions and the following disclaimer. | 5 * notice, this list of conditions and the following disclaimer. |
| 6 * * Redistributions in binary form must reproduce the above | 6 * * Redistributions in binary form must reproduce the above |
| 7 * copyright notice, this list of conditions and the following disclaimer | 7 * copyright notice, this list of conditions and the following disclaimer |
| 8 * in the documentation and/or other materials provided with the | 8 * in the documentation and/or other materials provided with the |
| 9 * distribution. | 9 * distribution. |
| 10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
| (...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 DCHECK(list.Item(0).IsPrimitiveValue() || list.Item(0).IsIdentifierValue()); | 1240 DCHECK(list.Item(0).IsPrimitiveValue() || list.Item(0).IsIdentifierValue()); |
| 1241 DCHECK(list.Item(1).IsPrimitiveValue() || list.Item(1).IsIdentifierValue()); | 1241 DCHECK(list.Item(1).IsPrimitiveValue() || list.Item(1).IsIdentifierValue()); |
| 1242 DCHECK(list.Item(2).IsPrimitiveValue()); | 1242 DCHECK(list.Item(2).IsPrimitiveValue()); |
| 1243 | 1243 |
| 1244 return TransformOrigin( | 1244 return TransformOrigin( |
| 1245 ConvertPositionLength<CSSValueLeft, CSSValueRight>(state, list.Item(0)), | 1245 ConvertPositionLength<CSSValueLeft, CSSValueRight>(state, list.Item(0)), |
| 1246 ConvertPositionLength<CSSValueTop, CSSValueBottom>(state, list.Item(1)), | 1246 ConvertPositionLength<CSSValueTop, CSSValueBottom>(state, list.Item(1)), |
| 1247 StyleBuilderConverter::ConvertComputedLength<float>(state, list.Item(2))); | 1247 StyleBuilderConverter::ConvertComputedLength<float>(state, list.Item(2))); |
| 1248 } | 1248 } |
| 1249 | 1249 |
| 1250 ScrollSnapPoints StyleBuilderConverter::ConvertSnapPoints( | 1250 ScrollSnapType StyleBuilderConverter::ConvertSnapType(StyleResolverState&, |
| 1251 StyleResolverState& state, | 1251 const CSSValue& value) { |
| 1252 const CSSValue& value) { | 1252 ScrollSnapType snapType = ComputedStyle::InitialScrollSnapType(); |
| 1253 // Handles: none | repeat(<length>) | 1253 if (value.IsValuePair()) { |
| 1254 ScrollSnapPoints points; | 1254 const CSSValuePair& pair = ToCSSValuePair(value); |
| 1255 points.has_repeat = false; | 1255 snapType.axis = ToCSSIdentifierValue(pair.First()).ConvertTo<SnapAxis>(); |
| 1256 | 1256 snapType.strictness = |
| 1257 if (!value.IsFunctionValue()) | 1257 ToCSSIdentifierValue(pair.Second()).ConvertTo<SnapStrictness>(); |
| 1258 return points; | 1258 } else { |
| 1259 | 1259 snapType.axis = ToCSSIdentifierValue(value).ConvertTo<SnapAxis>(); |
| 1260 const CSSFunctionValue& repeat_function = ToCSSFunctionValue(value); | 1260 } |
| 1261 SECURITY_DCHECK(repeat_function.length() == 1); | 1261 return snapType; |
| 1262 points.repeat_offset = | |
| 1263 ConvertLength(state, ToCSSPrimitiveValue(repeat_function.Item(0))); | |
| 1264 points.has_repeat = true; | |
| 1265 | |
| 1266 return points; | |
| 1267 } | 1262 } |
| 1268 | 1263 |
| 1269 Vector<LengthPoint> StyleBuilderConverter::ConvertSnapCoordinates( | 1264 ScrollSnapAlign StyleBuilderConverter::ConvertSnapAlign(StyleResolverState&, |
| 1270 StyleResolverState& state, | 1265 const CSSValue& value) { |
| 1271 const CSSValue& value) { | 1266 ScrollSnapAlign snapAlign = ComputedStyle::InitialScrollSnapAlign(); |
| 1272 // Handles: none | <position># | 1267 if (value.IsValuePair()) { |
| 1273 Vector<LengthPoint> coordinates; | 1268 const CSSValuePair& pair = ToCSSValuePair(value); |
| 1274 | 1269 snapAlign.alignmentX = |
| 1275 if (!value.IsValueList()) | 1270 ToCSSIdentifierValue(pair.First()).ConvertTo<SnapAlignment>(); |
| 1276 return coordinates; | 1271 snapAlign.alignmentY = |
| 1277 | 1272 ToCSSIdentifierValue(pair.Second()).ConvertTo<SnapAlignment>(); |
| 1278 const CSSValueList& value_list = ToCSSValueList(value); | 1273 } else { |
| 1279 coordinates.ReserveInitialCapacity(value_list.length()); | 1274 snapAlign.alignmentX = |
| 1280 for (auto& snap_coordinate : value_list) { | 1275 ToCSSIdentifierValue(value).ConvertTo<SnapAlignment>(); |
| 1281 coordinates.UncheckedAppend(ConvertPosition(state, *snap_coordinate)); | 1276 snapAlign.alignmentY = snapAlign.alignmentX; |
| 1282 } | 1277 } |
| 1283 | 1278 return snapAlign; |
| 1284 return coordinates; | |
| 1285 } | 1279 } |
| 1286 | 1280 |
| 1287 PassRefPtr<TranslateTransformOperation> StyleBuilderConverter::ConvertTranslate( | 1281 PassRefPtr<TranslateTransformOperation> StyleBuilderConverter::ConvertTranslate( |
| 1288 StyleResolverState& state, | 1282 StyleResolverState& state, |
| 1289 const CSSValue& value) { | 1283 const CSSValue& value) { |
| 1290 if (value.IsIdentifierValue()) { | 1284 if (value.IsIdentifierValue()) { |
| 1291 DCHECK_EQ(ToCSSIdentifierValue(value).GetValueID(), CSSValueNone); | 1285 DCHECK_EQ(ToCSSIdentifierValue(value).GetValueID(), CSSValueNone); |
| 1292 return nullptr; | 1286 return nullptr; |
| 1293 } | 1287 } |
| 1294 const CSSValueList& list = ToCSSValueList(value); | 1288 const CSSValueList& list = ToCSSValueList(value); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1423 } | 1417 } |
| 1424 | 1418 |
| 1425 const CSSValue& StyleBuilderConverter::ConvertRegisteredPropertyValue( | 1419 const CSSValue& StyleBuilderConverter::ConvertRegisteredPropertyValue( |
| 1426 const StyleResolverState& state, | 1420 const StyleResolverState& state, |
| 1427 const CSSValue& value) { | 1421 const CSSValue& value) { |
| 1428 return ComputeRegisteredPropertyValue(state.CssToLengthConversionData(), | 1422 return ComputeRegisteredPropertyValue(state.CssToLengthConversionData(), |
| 1429 value); | 1423 value); |
| 1430 } | 1424 } |
| 1431 | 1425 |
| 1432 } // namespace blink | 1426 } // namespace blink |
| OLD | NEW |