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

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

Issue 2932593004: Update the snap points css properties (Closed)
Patch Set: Add CSS Attributes 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 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 // scroll-behavior 1338 // scroll-behavior
1339 static ScrollBehavior InitialScrollBehavior() { return kScrollBehaviorAuto; } 1339 static ScrollBehavior InitialScrollBehavior() { return kScrollBehaviorAuto; }
1340 ScrollBehavior GetScrollBehavior() const { 1340 ScrollBehavior GetScrollBehavior() const {
1341 return static_cast<ScrollBehavior>( 1341 return static_cast<ScrollBehavior>(
1342 rare_non_inherited_data_->scroll_behavior_); 1342 rare_non_inherited_data_->scroll_behavior_);
1343 } 1343 }
1344 void SetScrollBehavior(ScrollBehavior b) { 1344 void SetScrollBehavior(ScrollBehavior b) {
1345 SET_VAR(rare_non_inherited_data_, scroll_behavior_, b); 1345 SET_VAR(rare_non_inherited_data_, scroll_behavior_, b);
1346 } 1346 }
1347 1347
1348 // scroll-snap-coordinate
1349 static Vector<LengthPoint> InitialScrollSnapCoordinate() {
1350 return Vector<LengthPoint>();
1351 }
1352 const Vector<LengthPoint>& ScrollSnapCoordinate() const {
1353 return rare_non_inherited_data_->scroll_snap_data_->coordinates_;
1354 }
1355 void SetScrollSnapCoordinate(const Vector<LengthPoint>& b) {
1356 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, coordinates_,
1357 b);
1358 }
1359
1360 // scroll-snap-destination
1361 static LengthPoint InitialScrollSnapDestination() {
1362 return LengthPoint(Length(0, kFixed), Length(0, kFixed));
1363 }
1364 const LengthPoint& ScrollSnapDestination() const {
1365 return rare_non_inherited_data_->scroll_snap_data_->destination_;
1366 }
1367 void SetScrollSnapDestination(const LengthPoint& b) {
1368 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, destination_,
1369 b);
1370 }
1371
1372 // scroll-snap-points-x
1373 static ScrollSnapPoints InitialScrollSnapPointsX() {
1374 return ScrollSnapPoints();
1375 }
1376 const ScrollSnapPoints& ScrollSnapPointsX() const {
1377 return rare_non_inherited_data_->scroll_snap_data_->x_points_;
1378 }
1379 void SetScrollSnapPointsX(const ScrollSnapPoints& b) {
1380 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, x_points_, b);
1381 }
1382
1383 // scroll-snap-points-y
1384 static ScrollSnapPoints InitialScrollSnapPointsY() {
1385 return ScrollSnapPoints();
1386 }
1387 const ScrollSnapPoints& ScrollSnapPointsY() const {
1388 return rare_non_inherited_data_->scroll_snap_data_->y_points_;
1389 }
1390 void SetScrollSnapPointsY(const ScrollSnapPoints& b) {
1391 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, y_points_, b);
1392 }
1393
1394 // scroll-snap-type 1348 // scroll-snap-type
1395 static ScrollSnapType InitialScrollSnapType() { return kScrollSnapTypeNone; } 1349 static ScrollSnapType InitialScrollSnapType() { return ScrollSnapType(); }
1396 ScrollSnapType GetScrollSnapType() const { 1350 ScrollSnapType GetScrollSnapType() const {
1397 return static_cast<ScrollSnapType>( 1351 return rare_non_inherited_data_->scroll_snap_data_->type_;
1398 rare_non_inherited_data_->scroll_snap_type_); 1352 }
1399 } 1353 void SetScrollSnapType(const ScrollSnapType& b) {
1400 void SetScrollSnapType(ScrollSnapType b) { 1354 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, type_, b);
1401 SET_VAR(rare_non_inherited_data_, scroll_snap_type_, b); 1355 }
1356
1357 // Scroll Padding properties
1358 static Length InitialScrollPadding() { return Length(kFixed); }
1359
1360 // scroll-padding-top
1361 const Length& ScrollPaddingTop() const {
1362 return rare_non_inherited_data_->scroll_snap_data_->padding_.top;
1363 }
1364 void SetScrollPaddingTop(const Length& v) {
1365 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, padding_.top,
1366 v);
1367 }
1368
1369 // scroll-padding-bottom
1370 const Length& ScrollPaddingBottom() const {
1371 return rare_non_inherited_data_->scroll_snap_data_->padding_.bottom;
1372 }
1373 void SetScrollPaddingBottom(const Length& v) {
1374 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, padding_.bottom,
1375 v);
1376 }
1377
1378 // scroll-padding-left
1379 const Length& ScrollPaddingLeft() const {
1380 return rare_non_inherited_data_->scroll_snap_data_->padding_.left;
1381 }
1382 void SetScrollPaddingLeft(const Length& v) {
1383 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, padding_.left,
1384 v);
1385 }
1386
1387 // scroll-padding-right
1388 const Length& ScrollPaddingRight() const {
1389 return rare_non_inherited_data_->scroll_snap_data_->padding_.right;
1390 }
1391 void SetScrollPaddingRight(const Length& v) {
1392 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, padding_.right,
1393 v);
1394 }
1395
1396 // scroll-padding-block-start
1397 const Length& ScrollPaddingBlockStart() const {
1398 return IsHorizontalWritingMode() ? ScrollPaddingTop() : ScrollPaddingLeft();
1399 }
1400 void SetScrollPaddingBlockStart(const Length& v) {
1401 if (IsHorizontalWritingMode())
1402 SetScrollPaddingTop(v);
1403 else
1404 SetScrollPaddingLeft(v);
1405 }
1406
1407 // scroll-padding-block-end
1408 const Length& ScrollPaddingBlockEnd() const {
1409 return IsHorizontalWritingMode() ? ScrollPaddingBottom()
1410 : ScrollPaddingRight();
1411 }
1412 void SetScrollPaddingBlockEnd(const Length& v) {
1413 if (IsHorizontalWritingMode())
1414 SetScrollPaddingBottom(v);
1415 else
1416 SetScrollPaddingRight(v);
1417 }
1418
1419 // scroll-padding-inline-start
1420 const Length& ScrollPaddingInlineStart() const {
1421 return IsHorizontalWritingMode() ? ScrollPaddingLeft() : ScrollPaddingTop();
1422 }
1423 void SetScrollPaddingInlineStart(const Length& v) {
1424 if (IsHorizontalWritingMode())
1425 SetScrollPaddingLeft(v);
1426 else
1427 SetScrollPaddingTop(v);
1428 }
1429
1430 // scroll-padding-inline-end
1431 const Length& ScrollPaddingInlineEnd() const {
1432 return IsHorizontalWritingMode() ? ScrollPaddingRight()
1433 : ScrollPaddingBottom();
1434 }
1435 void SetScrollPaddingInlineEnd(const Length& v) {
1436 if (IsHorizontalWritingMode())
1437 SetScrollPaddingRight(v);
1438 else
1439 SetScrollPaddingBottom(v);
1440 }
1441
1442 // scroll-snap-margin
1443 static Length InitialScrollSnapMargin() { return Length(kFixed); }
1444
1445 // scroll-snap-margin-top
1446 const Length& ScrollSnapMarginTop() const {
1447 return rare_non_inherited_data_->scroll_snap_data_->margin_.top;
1448 }
1449 void SetScrollSnapMarginTop(const Length& v) {
1450 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, margin_.top, v);
1451 }
1452
1453 // scroll-snap-margin-bottom
1454 const Length& ScrollSnapMarginBottom() const {
1455 return rare_non_inherited_data_->scroll_snap_data_->margin_.bottom;
1456 }
1457 void SetScrollSnapMarginBottom(const Length& v) {
1458 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, margin_.bottom,
1459 v);
1460 }
1461
1462 // scroll-snap-margin-left
1463 const Length& ScrollSnapMarginLeft() const {
1464 return rare_non_inherited_data_->scroll_snap_data_->margin_.left;
1465 }
1466 void SetScrollSnapMarginLeft(const Length& v) {
1467 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, margin_.left,
1468 v);
1469 }
1470
1471 // scroll-snap-margin-right
1472 const Length& ScrollSnapMarginRight() const {
1473 return rare_non_inherited_data_->scroll_snap_data_->margin_.right;
1474 }
1475 void SetScrollSnapMarginRight(const Length& v) {
1476 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, margin_.right,
1477 v);
1478 }
1479
1480 // scroll-snap-margin-block-start
1481 const Length& ScrollSnapMarginBlockStart() const {
1482 return IsHorizontalWritingMode() ? ScrollSnapMarginTop()
1483 : ScrollSnapMarginLeft();
1484 }
1485 void SetScrollSnapMarginBlockStart(const Length& v) {
1486 if (IsHorizontalWritingMode())
1487 SetScrollSnapMarginTop(v);
1488 else
1489 SetScrollSnapMarginLeft(v);
1490 }
1491
1492 // scroll-snap-margin-block-end
1493 const Length& ScrollSnapMarginBlockEnd() const {
1494 return IsHorizontalWritingMode() ? ScrollSnapMarginBottom()
1495 : ScrollSnapMarginRight();
1496 }
1497 void SetScrollSnapMarginBlockEnd(const Length& v) {
1498 if (IsHorizontalWritingMode())
1499 SetScrollSnapMarginBottom(v);
1500 else
1501 SetScrollSnapMarginRight(v);
1502 }
1503
1504 // scroll-snap-margin-inline-start
1505 const Length& ScrollSnapMarginInlineStart() const {
1506 return IsHorizontalWritingMode() ? ScrollSnapMarginLeft()
1507 : ScrollSnapMarginTop();
1508 }
1509 void SetScrollSnapMarginInlineStart(const Length& v) {
1510 if (IsHorizontalWritingMode())
1511 SetScrollSnapMarginLeft(v);
1512 else
1513 SetScrollSnapMarginTop(v);
1514 }
1515
1516 // scroll-snap-margin-inline-end
1517 const Length& ScrollSnapMarginInlineEnd() const {
1518 return IsHorizontalWritingMode() ? ScrollSnapMarginRight()
1519 : ScrollSnapMarginBottom();
1520 }
1521 void SetScrollSnapMarginInlineEnd(const Length& v) {
1522 if (IsHorizontalWritingMode())
1523 SetScrollSnapMarginRight(v);
1524 else
1525 SetScrollSnapMarginBottom(v);
1526 }
1527
1528 /* // scroll-snap-stop
bokan 2017/06/13 01:30:20 Why is this commented out?
sunyunjia 2017/06/13 17:44:59 As declared in CSSProperties.json5, This property
1529 static ScrollSnapStop InitialScrollSnapStop() { return
1530 kScrollSnapStopNormal; } ScrollSnapStop GetScrollSnapStop() const { return
1531 rare_non_inherited_data_->scroll_snap_->stop_;
1532 }
1533 void SetScrollSnapStop(const ScrollSnapStop& b) {
1534 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, stop_, b);
1535 }*/
1536
1537 // scroll-snap-align
1538 static ScrollSnapAlign InitialScrollSnapAlign() { return ScrollSnapAlign(); }
1539 ScrollSnapAlign GetScrollSnapAlign() const {
1540 return rare_non_inherited_data_->scroll_snap_data_->align_;
1541 }
1542 void SetScrollSnapAlign(const ScrollSnapAlign& b) {
1543 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, align_, b);
1402 } 1544 }
1403 1545
1404 // shape-image-threshold (aka -webkit-shape-image-threshold) 1546 // shape-image-threshold (aka -webkit-shape-image-threshold)
1405 static float InitialShapeImageThreshold() { return 0; } 1547 static float InitialShapeImageThreshold() { return 0; }
1406 float ShapeImageThreshold() const { 1548 float ShapeImageThreshold() const {
1407 return rare_non_inherited_data_->shape_image_threshold_; 1549 return rare_non_inherited_data_->shape_image_threshold_;
1408 } 1550 }
1409 void SetShapeImageThreshold(float shape_image_threshold) { 1551 void SetShapeImageThreshold(float shape_image_threshold) {
1410 float clamped_shape_image_threshold = 1552 float clamped_shape_image_threshold =
1411 clampTo<float>(shape_image_threshold, 0, 1); 1553 clampTo<float>(shape_image_threshold, 0, 1);
(...skipping 2162 matching lines...) Expand 10 before | Expand all | Expand 10 after
3574 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); 3716 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId)));
3575 } 3717 }
3576 3718
3577 inline bool ComputedStyle::HasPseudoElementStyle() const { 3719 inline bool ComputedStyle::HasPseudoElementStyle() const {
3578 return PseudoBitsInternal() & kElementPseudoIdMask; 3720 return PseudoBitsInternal() & kElementPseudoIdMask;
3579 } 3721 }
3580 3722
3581 } // namespace blink 3723 } // namespace blink
3582 3724
3583 #endif // ComputedStyle_h 3725 #endif // ComputedStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698