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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.h

Issue 2932593004: Update the snap points css properties (Closed)
Patch Set: Fix nits 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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 // scroll-behavior 1304 // scroll-behavior
1305 static ScrollBehavior InitialScrollBehavior() { return kScrollBehaviorAuto; } 1305 static ScrollBehavior InitialScrollBehavior() { return kScrollBehaviorAuto; }
1306 ScrollBehavior GetScrollBehavior() const { 1306 ScrollBehavior GetScrollBehavior() const {
1307 return static_cast<ScrollBehavior>( 1307 return static_cast<ScrollBehavior>(
1308 rare_non_inherited_data_->scroll_behavior_); 1308 rare_non_inherited_data_->scroll_behavior_);
1309 } 1309 }
1310 void SetScrollBehavior(ScrollBehavior b) { 1310 void SetScrollBehavior(ScrollBehavior b) {
1311 SET_VAR(rare_non_inherited_data_, scroll_behavior_, b); 1311 SET_VAR(rare_non_inherited_data_, scroll_behavior_, b);
1312 } 1312 }
1313 1313
1314 // scroll-snap-coordinate 1314 // scroll-snap-type
1315 static Vector<LengthPoint> InitialScrollSnapCoordinate() { 1315 static ScrollSnapType InitialScrollSnapType() { return ScrollSnapType(); }
1316 return Vector<LengthPoint>(); 1316 ScrollSnapType GetScrollSnapType() const {
1317 return rare_non_inherited_data_->scroll_snap_data_->type_;
1317 } 1318 }
1318 const Vector<LengthPoint>& ScrollSnapCoordinate() const { 1319 void SetScrollSnapType(const ScrollSnapType& b) {
1319 return rare_non_inherited_data_->scroll_snap_data_->coordinates_; 1320 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, type_, b);
1320 }
1321 void SetScrollSnapCoordinate(const Vector<LengthPoint>& b) {
1322 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, coordinates_,
1323 b);
1324 } 1321 }
1325 1322
1326 // scroll-snap-destination 1323 // Scroll Padding properties
1327 static LengthPoint InitialScrollSnapDestination() { 1324 static Length InitialScrollPadding() { return Length(); }
1328 return LengthPoint(Length(0, kFixed), Length(0, kFixed)); 1325
1326 // scroll-padding-top
1327 const Length& ScrollPaddingTop() const {
1328 return rare_non_inherited_data_->scroll_snap_data_->padding_.top;
1329 } 1329 }
1330 const LengthPoint& ScrollSnapDestination() const { 1330 void SetScrollPaddingTop(const Length& v) {
1331 return rare_non_inherited_data_->scroll_snap_data_->destination_; 1331 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, padding_.top,
1332 } 1332 v);
1333 void SetScrollSnapDestination(const LengthPoint& b) {
1334 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, destination_,
1335 b);
1336 } 1333 }
1337 1334
1338 // scroll-snap-points-x 1335 // scroll-padding-bottom
1339 static ScrollSnapPoints InitialScrollSnapPointsX() { 1336 const Length& ScrollPaddingBottom() const {
1340 return ScrollSnapPoints(); 1337 return rare_non_inherited_data_->scroll_snap_data_->padding_.bottom;
1341 } 1338 }
1342 const ScrollSnapPoints& ScrollSnapPointsX() const { 1339 void SetScrollPaddingBottom(const Length& v) {
1343 return rare_non_inherited_data_->scroll_snap_data_->x_points_; 1340 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, padding_.bottom,
1344 } 1341 v);
1345 void SetScrollSnapPointsX(const ScrollSnapPoints& b) {
1346 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, x_points_, b);
1347 } 1342 }
1348 1343
1349 // scroll-snap-points-y 1344 // scroll-padding-left
1350 static ScrollSnapPoints InitialScrollSnapPointsY() { 1345 const Length& ScrollPaddingLeft() const {
1351 return ScrollSnapPoints(); 1346 return rare_non_inherited_data_->scroll_snap_data_->padding_.left;
1352 } 1347 }
1353 const ScrollSnapPoints& ScrollSnapPointsY() const { 1348 void SetScrollPaddingLeft(const Length& v) {
1354 return rare_non_inherited_data_->scroll_snap_data_->y_points_; 1349 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, padding_.left,
1355 } 1350 v);
1356 void SetScrollSnapPointsY(const ScrollSnapPoints& b) {
1357 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, y_points_, b);
1358 } 1351 }
1359 1352
1360 // scroll-snap-type 1353 // scroll-padding-right
1361 static ScrollSnapType InitialScrollSnapType() { return kScrollSnapTypeNone; } 1354 const Length& ScrollPaddingRight() const {
1362 ScrollSnapType GetScrollSnapType() const { 1355 return rare_non_inherited_data_->scroll_snap_data_->padding_.right;
1363 return static_cast<ScrollSnapType>(
1364 rare_non_inherited_data_->scroll_snap_type_);
1365 } 1356 }
1366 void SetScrollSnapType(ScrollSnapType b) { 1357 void SetScrollPaddingRight(const Length& v) {
1367 SET_VAR(rare_non_inherited_data_, scroll_snap_type_, b); 1358 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, padding_.right,
1359 v);
1360 }
1361
1362 // scroll-padding-block-start
1363 const Length& ScrollPaddingBlockStart() const {
Xianzhu 2017/06/30 20:02:16 Why isn't this the same as other mappings between
1364 return IsHorizontalWritingMode() ? ScrollPaddingTop() : ScrollPaddingLeft();
1365 }
1366 void SetScrollPaddingBlockStart(const Length& v) {
1367 if (IsHorizontalWritingMode())
1368 SetScrollPaddingTop(v);
1369 else
1370 SetScrollPaddingLeft(v);
1371 }
1372
1373 // scroll-padding-block-end
1374 const Length& ScrollPaddingBlockEnd() const {
1375 return IsHorizontalWritingMode() ? ScrollPaddingBottom()
1376 : ScrollPaddingRight();
1377 }
1378 void SetScrollPaddingBlockEnd(const Length& v) {
1379 if (IsHorizontalWritingMode())
1380 SetScrollPaddingBottom(v);
1381 else
1382 SetScrollPaddingRight(v);
1383 }
1384
1385 // scroll-padding-inline-start
1386 const Length& ScrollPaddingInlineStart() const {
1387 return IsHorizontalWritingMode() ? ScrollPaddingLeft() : ScrollPaddingTop();
1388 }
1389 void SetScrollPaddingInlineStart(const Length& v) {
1390 if (IsHorizontalWritingMode())
1391 SetScrollPaddingLeft(v);
1392 else
1393 SetScrollPaddingTop(v);
1394 }
1395
1396 // scroll-padding-inline-end
1397 const Length& ScrollPaddingInlineEnd() const {
1398 return IsHorizontalWritingMode() ? ScrollPaddingRight()
1399 : ScrollPaddingBottom();
1400 }
1401 void SetScrollPaddingInlineEnd(const Length& v) {
1402 if (IsHorizontalWritingMode())
1403 SetScrollPaddingRight(v);
1404 else
1405 SetScrollPaddingBottom(v);
1406 }
1407
1408 // scroll-snap-margin
1409 static Length InitialScrollSnapMargin() { return Length(); }
1410
1411 // scroll-snap-margin-top
1412 const Length& ScrollSnapMarginTop() const {
1413 return rare_non_inherited_data_->scroll_snap_data_->margin_.top;
1414 }
1415 void SetScrollSnapMarginTop(const Length& v) {
1416 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, margin_.top, v);
1417 }
1418
1419 // scroll-snap-margin-bottom
1420 const Length& ScrollSnapMarginBottom() const {
1421 return rare_non_inherited_data_->scroll_snap_data_->margin_.bottom;
1422 }
1423 void SetScrollSnapMarginBottom(const Length& v) {
1424 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, margin_.bottom,
1425 v);
1426 }
1427
1428 // scroll-snap-margin-left
1429 const Length& ScrollSnapMarginLeft() const {
1430 return rare_non_inherited_data_->scroll_snap_data_->margin_.left;
1431 }
1432 void SetScrollSnapMarginLeft(const Length& v) {
1433 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, margin_.left,
1434 v);
1435 }
1436
1437 // scroll-snap-margin-right
1438 const Length& ScrollSnapMarginRight() const {
1439 return rare_non_inherited_data_->scroll_snap_data_->margin_.right;
1440 }
1441 void SetScrollSnapMarginRight(const Length& v) {
1442 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, margin_.right,
1443 v);
1444 }
1445
1446 // scroll-snap-margin-block-start
1447 const Length& ScrollSnapMarginBlockStart() const {
1448 return IsHorizontalWritingMode() ? ScrollSnapMarginTop()
1449 : ScrollSnapMarginLeft();
1450 }
1451 void SetScrollSnapMarginBlockStart(const Length& v) {
1452 if (IsHorizontalWritingMode())
1453 SetScrollSnapMarginTop(v);
1454 else
1455 SetScrollSnapMarginLeft(v);
1456 }
1457
1458 // scroll-snap-margin-block-end
1459 const Length& ScrollSnapMarginBlockEnd() const {
1460 return IsHorizontalWritingMode() ? ScrollSnapMarginBottom()
1461 : ScrollSnapMarginRight();
1462 }
1463 void SetScrollSnapMarginBlockEnd(const Length& v) {
1464 if (IsHorizontalWritingMode())
1465 SetScrollSnapMarginBottom(v);
1466 else
1467 SetScrollSnapMarginRight(v);
1468 }
1469
1470 // scroll-snap-margin-inline-start
1471 const Length& ScrollSnapMarginInlineStart() const {
1472 return IsHorizontalWritingMode() ? ScrollSnapMarginLeft()
1473 : ScrollSnapMarginTop();
1474 }
1475 void SetScrollSnapMarginInlineStart(const Length& v) {
1476 if (IsHorizontalWritingMode())
1477 SetScrollSnapMarginLeft(v);
1478 else
1479 SetScrollSnapMarginTop(v);
1480 }
1481
1482 // scroll-snap-margin-inline-end
1483 const Length& ScrollSnapMarginInlineEnd() const {
1484 return IsHorizontalWritingMode() ? ScrollSnapMarginRight()
1485 : ScrollSnapMarginBottom();
1486 }
1487 void SetScrollSnapMarginInlineEnd(const Length& v) {
1488 if (IsHorizontalWritingMode())
1489 SetScrollSnapMarginRight(v);
1490 else
1491 SetScrollSnapMarginBottom(v);
1492 }
1493
1494 // scroll-snap-align
1495 static ScrollSnapAlign InitialScrollSnapAlign() { return ScrollSnapAlign(); }
1496 ScrollSnapAlign GetScrollSnapAlign() const {
1497 return rare_non_inherited_data_->scroll_snap_data_->align_;
1498 }
1499 void SetScrollSnapAlign(const ScrollSnapAlign& b) {
1500 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, align_, b);
1368 } 1501 }
1369 1502
1370 // shape-image-threshold (aka -webkit-shape-image-threshold) 1503 // shape-image-threshold (aka -webkit-shape-image-threshold)
1371 static float InitialShapeImageThreshold() { return 0; } 1504 static float InitialShapeImageThreshold() { return 0; }
1372 float ShapeImageThreshold() const { 1505 float ShapeImageThreshold() const {
1373 return rare_non_inherited_data_->shape_image_threshold_; 1506 return rare_non_inherited_data_->shape_image_threshold_;
1374 } 1507 }
1375 void SetShapeImageThreshold(float shape_image_threshold) { 1508 void SetShapeImageThreshold(float shape_image_threshold) {
1376 float clamped_shape_image_threshold = 1509 float clamped_shape_image_threshold =
1377 clampTo<float>(shape_image_threshold, 0, 1); 1510 clampTo<float>(shape_image_threshold, 0, 1);
(...skipping 2186 matching lines...) Expand 10 before | Expand all | Expand 10 after
3564 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); 3697 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId)));
3565 } 3698 }
3566 3699
3567 inline bool ComputedStyle::HasPseudoElementStyle() const { 3700 inline bool ComputedStyle::HasPseudoElementStyle() const {
3568 return PseudoBitsInternal() & kElementPseudoIdMask; 3701 return PseudoBitsInternal() & kElementPseudoIdMask;
3569 } 3702 }
3570 3703
3571 } // namespace blink 3704 } // namespace blink
3572 3705
3573 #endif // ComputedStyle_h 3706 #endif // ComputedStyle_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/BUILD.gn ('k') | third_party/WebKit/Source/core/style/ComputedStyleConstants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698