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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 2767213003: First Implementation of Snapped Points
Patch Set: Rebase and format 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 unified diff | Download patch
OLDNEW
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
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 ScrollSnapType StyleBuilderConverter::ConvertSnapType(StyleResolverState&,
1251 const CSSValue& value) {
1252 ScrollSnapType snapType = ComputedStyle::InitialScrollSnapType();
1253 if (value.IsValuePair()) {
1254 const CSSValuePair& pair = ToCSSValuePair(value);
1255 snapType.axis = ToCSSIdentifierValue(pair.First()).ConvertTo<SnapAxis>();
1256 snapType.strictness =
1257 ToCSSIdentifierValue(pair.Second()).ConvertTo<SnapStrictness>();
1258 } else {
1259 snapType.axis = ToCSSIdentifierValue(value).ConvertTo<SnapAxis>();
1260 }
1261 return snapType;
1262 }
1263
1264 ScrollSnapAlign StyleBuilderConverter::ConvertSnapAlign(StyleResolverState&,
1265 const CSSValue& value) {
1266 ScrollSnapAlign snapAlign = ComputedStyle::InitialScrollSnapAlign();
1267 if (value.IsValuePair()) {
1268 const CSSValuePair& pair = ToCSSValuePair(value);
1269 snapAlign.alignmentX =
1270 ToCSSIdentifierValue(pair.First()).ConvertTo<SnapAlignment>();
1271 snapAlign.alignmentY =
1272 ToCSSIdentifierValue(pair.Second()).ConvertTo<SnapAlignment>();
1273 } else {
1274 snapAlign.alignmentX =
1275 ToCSSIdentifierValue(value).ConvertTo<SnapAlignment>();
1276 snapAlign.alignmentY = snapAlign.alignmentX;
1277 }
1278 return snapAlign;
1279 }
1280
1250 ScrollSnapPoints StyleBuilderConverter::ConvertSnapPoints( 1281 ScrollSnapPoints StyleBuilderConverter::ConvertSnapPoints(
1251 StyleResolverState& state, 1282 StyleResolverState& state,
1252 const CSSValue& value) { 1283 const CSSValue& value) {
1253 // Handles: none | repeat(<length>) 1284 // Handles: none | repeat(<length>)
1254 ScrollSnapPoints points; 1285 ScrollSnapPoints points;
1255 points.has_repeat = false; 1286 points.has_repeat = false;
1256 1287
1257 if (!value.IsFunctionValue()) 1288 if (!value.IsFunctionValue())
1258 return points; 1289 return points;
1259 1290
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 } 1454 }
1424 1455
1425 const CSSValue& StyleBuilderConverter::ConvertRegisteredPropertyValue( 1456 const CSSValue& StyleBuilderConverter::ConvertRegisteredPropertyValue(
1426 const StyleResolverState& state, 1457 const StyleResolverState& state,
1427 const CSSValue& value) { 1458 const CSSValue& value) {
1428 return ComputeRegisteredPropertyValue(state.CssToLengthConversionData(), 1459 return ComputeRegisteredPropertyValue(state.CssToLengthConversionData(),
1429 value); 1460 value);
1430 } 1461 }
1431 1462
1432 } // namespace blink 1463 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h ('k') | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698