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

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

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) 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 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 return ScrollSnapPoints(); 1387 return ScrollSnapPoints();
1388 } 1388 }
1389 const ScrollSnapPoints& ScrollSnapPointsY() const { 1389 const ScrollSnapPoints& ScrollSnapPointsY() const {
1390 return rare_non_inherited_data_->scroll_snap_data_->y_points_; 1390 return rare_non_inherited_data_->scroll_snap_data_->y_points_;
1391 } 1391 }
1392 void SetScrollSnapPointsY(const ScrollSnapPoints& b) { 1392 void SetScrollSnapPointsY(const ScrollSnapPoints& b) {
1393 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, y_points_, b); 1393 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_data_, y_points_, b);
1394 } 1394 }
1395 1395
1396 // scroll-snap-type 1396 // scroll-snap-type
1397 static ScrollSnapType InitialScrollSnapType() { return kScrollSnapTypeNone; } 1397 static ScrollSnapType InitialScrollSnapType() { return ScrollSnapType(); }
1398 ScrollSnapType GetScrollSnapType() const { 1398 ScrollSnapType GetScrollSnapType() const {
1399 return static_cast<ScrollSnapType>( 1399 return rare_non_inherited_data_->scroll_snap_->type_;
1400 rare_non_inherited_data_->scroll_snap_type_);
1401 } 1400 }
1402 void SetScrollSnapType(ScrollSnapType b) { 1401 void SetScrollSnapType(const ScrollSnapType& b) {
1403 SET_VAR(rare_non_inherited_data_, scroll_snap_type_, b); 1402 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, type_, b);
1403 }
1404
1405 // Scroll Padding properties
1406 static Length InitialScrollPadding() { return Length(kFixed); }
1407
1408 // scroll-padding-top
1409 const Length& ScrollPaddingTop() const {
1410 return rare_non_inherited_data_->scroll_snap_->padding_.top;
1411 }
1412 void SetScrollPaddingTop(const Length& v) {
1413 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, padding_.top, v);
1414 }
1415
1416 // scroll-padding-bottom
1417 const Length& ScrollPaddingBottom() const {
1418 return rare_non_inherited_data_->scroll_snap_->padding_.bottom;
1419 }
1420 void SetScrollPaddingBottom(const Length& v) {
1421 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, padding_.bottom, v);
1422 }
1423
1424 // scroll-padding-left
1425 const Length& ScrollPaddingLeft() const {
1426 return rare_non_inherited_data_->scroll_snap_->padding_.left;
1427 }
1428 void SetScrollPaddingLeft(const Length& v) {
1429 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, padding_.left, v);
1430 }
1431
1432 // scroll-padding-right
1433 const Length& ScrollPaddingRight() const {
1434 return rare_non_inherited_data_->scroll_snap_->padding_.right;
1435 }
1436 void SetScrollPaddingRight(const Length& v) {
1437 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, padding_.right, v);
1438 }
1439
1440 // scroll-padding-block-start
1441 const Length& ScrollPaddingBlockStart() const {
1442 return IsHorizontalWritingMode() ? ScrollPaddingTop() : ScrollPaddingLeft();
1443 }
1444 void SetScrollPaddingBlockStart(const Length& v) {
1445 if (IsHorizontalWritingMode())
1446 SetScrollPaddingTop(v);
1447 else
1448 SetScrollPaddingLeft(v);
1449 }
1450
1451 // scroll-padding-block-end
1452 const Length& ScrollPaddingBlockEnd() const {
1453 return IsHorizontalWritingMode() ? ScrollPaddingBottom()
1454 : ScrollPaddingRight();
1455 }
1456 void SetScrollPaddingBlockEnd(const Length& v) {
1457 if (IsHorizontalWritingMode())
1458 SetScrollPaddingBottom(v);
1459 else
1460 SetScrollPaddingRight(v);
1461 }
1462
1463 // scroll-padding-inline-start
1464 const Length& ScrollPaddingInlineStart() const {
1465 return IsHorizontalWritingMode() ? ScrollPaddingLeft() : ScrollPaddingTop();
1466 }
1467 void SetScrollPaddingInlineStart(const Length& v) {
1468 if (IsHorizontalWritingMode())
1469 SetScrollPaddingLeft(v);
1470 else
1471 SetScrollPaddingTop(v);
1472 }
1473
1474 // scroll-padding-inline-end
1475 const Length& ScrollPaddingInlineEnd() const {
1476 return IsHorizontalWritingMode() ? ScrollPaddingRight()
1477 : ScrollPaddingBottom();
1478 }
1479 void SetScrollPaddingInlineEnd(const Length& v) {
1480 if (IsHorizontalWritingMode())
1481 SetScrollPaddingRight(v);
1482 else
1483 SetScrollPaddingBottom(v);
1484 }
1485
1486 // scroll-snap-margin
1487 static Length InitialScrollSnapMargin() { return Length(kFixed); }
1488
1489 // scroll-snap-margin-top
1490 const Length& ScrollSnapMarginTop() const {
1491 return rare_non_inherited_data_->scroll_snap_->margin_.top;
1492 }
1493 void SetScrollSnapMarginTop(const Length& v) {
1494 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, margin_.top, v);
1495 }
1496
1497 // scroll-snap-margin-bottom
1498 const Length& ScrollSnapMarginBottom() const {
1499 return rare_non_inherited_data_->scroll_snap_->margin_.bottom;
1500 }
1501 void SetScrollSnapMarginBottom(const Length& v) {
1502 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, margin_.bottom, v);
1503 }
1504
1505 // scroll-snap-margin-left
1506 const Length& ScrollSnapMarginLeft() const {
1507 return rare_non_inherited_data_->scroll_snap_->margin_.left;
1508 }
1509 void SetScrollSnapMarginLeft(const Length& v) {
1510 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, margin_.left, v);
1511 }
1512
1513 // scroll-snap-margin-right
1514 const Length& ScrollSnapMarginRight() const {
1515 return rare_non_inherited_data_->scroll_snap_->margin_.right;
1516 }
1517 void SetScrollSnapMarginRight(const Length& v) {
1518 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, margin_.right, v);
1519 }
1520
1521 // scroll-snap-margin-block-start
1522 const Length& ScrollSnapMarginBlockStart() const {
1523 return IsHorizontalWritingMode() ? ScrollSnapMarginTop()
1524 : ScrollSnapMarginLeft();
1525 }
1526 void SetScrollSnapMarginBlockStart(const Length& v) {
1527 if (IsHorizontalWritingMode())
1528 SetScrollSnapMarginTop(v);
1529 else
1530 SetScrollSnapMarginLeft(v);
1531 }
1532
1533 // scroll-snap-margin-block-end
1534 const Length& ScrollSnapMarginBlockEnd() const {
1535 return IsHorizontalWritingMode() ? ScrollSnapMarginBottom()
1536 : ScrollSnapMarginRight();
1537 }
1538 void SetScrollSnapMarginBlockEnd(const Length& v) {
1539 if (IsHorizontalWritingMode())
1540 SetScrollSnapMarginBottom(v);
1541 else
1542 SetScrollSnapMarginRight(v);
1543 }
1544
1545 // scroll-snap-margin-inline-start
1546 const Length& ScrollSnapMarginInlineStart() const {
1547 return IsHorizontalWritingMode() ? ScrollSnapMarginLeft()
1548 : ScrollSnapMarginTop();
1549 }
1550 void SetScrollSnapMarginInlineStart(const Length& v) {
1551 if (IsHorizontalWritingMode())
1552 SetScrollSnapMarginLeft(v);
1553 else
1554 SetScrollSnapMarginTop(v);
1555 }
1556
1557 // scroll-snap-margin-inline-end
1558 const Length& ScrollSnapMarginInlineEnd() const {
1559 return IsHorizontalWritingMode() ? ScrollSnapMarginRight()
1560 : ScrollSnapMarginBottom();
1561 }
1562 void SetScrollSnapMarginInlineEnd(const Length& v) {
1563 if (IsHorizontalWritingMode())
1564 SetScrollSnapMarginRight(v);
1565 else
1566 SetScrollSnapMarginBottom(v);
1567 }
1568
1569 /* // scroll-snap-stop
1570 static ScrollSnapStop InitialScrollSnapStop() { return
1571 kScrollSnapStopNormal; } ScrollSnapStop GetScrollSnapStop() const { return
1572 rare_non_inherited_data_->scroll_snap_->stop_;
1573 }
1574 void SetScrollSnapStop(const ScrollSnapStop& b) {
1575 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, stop_, b);
1576 }*/
1577
1578 // scroll-snap-align
1579 static ScrollSnapAlign InitialScrollSnapAlign() { return ScrollSnapAlign(); }
1580 ScrollSnapAlign GetScrollSnapAlign() const {
1581 return rare_non_inherited_data_->scroll_snap_->align_;
1582 }
1583 void SetScrollSnapAlign(const ScrollSnapAlign& b) {
1584 SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, align_, b);
1404 } 1585 }
1405 1586
1406 // shape-image-threshold (aka -webkit-shape-image-threshold) 1587 // shape-image-threshold (aka -webkit-shape-image-threshold)
1407 static float InitialShapeImageThreshold() { return 0; } 1588 static float InitialShapeImageThreshold() { return 0; }
1408 float ShapeImageThreshold() const { 1589 float ShapeImageThreshold() const {
1409 return rare_non_inherited_data_->shape_image_threshold_; 1590 return rare_non_inherited_data_->shape_image_threshold_;
1410 } 1591 }
1411 void SetShapeImageThreshold(float shape_image_threshold) { 1592 void SetShapeImageThreshold(float shape_image_threshold) {
1412 float clamped_shape_image_threshold = 1593 float clamped_shape_image_threshold =
1413 clampTo<float>(shape_image_threshold, 0, 1); 1594 clampTo<float>(shape_image_threshold, 0, 1);
(...skipping 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after
3592 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); 3773 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId)));
3593 } 3774 }
3594 3775
3595 inline bool ComputedStyle::HasPseudoElementStyle() const { 3776 inline bool ComputedStyle::HasPseudoElementStyle() const {
3596 return PseudoBitsInternal() & kElementPseudoIdMask; 3777 return PseudoBitsInternal() & kElementPseudoIdMask;
3597 } 3778 }
3598 3779
3599 } // namespace blink 3780 } // namespace blink
3600 3781
3601 #endif // ComputedStyle_h 3782 #endif // ComputedStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698