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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/style/ComputedStyle.h
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h
index f92778921737c5718bc1a4e24fd13821faba285d..e8b2ae2b90dca7dd781328818d5987f4f5e2209f 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.h
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -1394,13 +1394,194 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
}
// scroll-snap-type
- static ScrollSnapType InitialScrollSnapType() { return kScrollSnapTypeNone; }
+ static ScrollSnapType InitialScrollSnapType() { return ScrollSnapType(); }
ScrollSnapType GetScrollSnapType() const {
- return static_cast<ScrollSnapType>(
- rare_non_inherited_data_->scroll_snap_type_);
+ return rare_non_inherited_data_->scroll_snap_->type_;
}
- void SetScrollSnapType(ScrollSnapType b) {
- SET_VAR(rare_non_inherited_data_, scroll_snap_type_, b);
+ void SetScrollSnapType(const ScrollSnapType& b) {
+ SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, type_, b);
+ }
+
+ // Scroll Padding properties
+ static Length InitialScrollPadding() { return Length(kFixed); }
+
+ // scroll-padding-top
+ const Length& ScrollPaddingTop() const {
+ return rare_non_inherited_data_->scroll_snap_->padding_.top;
+ }
+ void SetScrollPaddingTop(const Length& v) {
+ SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, padding_.top, v);
+ }
+
+ // scroll-padding-bottom
+ const Length& ScrollPaddingBottom() const {
+ return rare_non_inherited_data_->scroll_snap_->padding_.bottom;
+ }
+ void SetScrollPaddingBottom(const Length& v) {
+ SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, padding_.bottom, v);
+ }
+
+ // scroll-padding-left
+ const Length& ScrollPaddingLeft() const {
+ return rare_non_inherited_data_->scroll_snap_->padding_.left;
+ }
+ void SetScrollPaddingLeft(const Length& v) {
+ SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, padding_.left, v);
+ }
+
+ // scroll-padding-right
+ const Length& ScrollPaddingRight() const {
+ return rare_non_inherited_data_->scroll_snap_->padding_.right;
+ }
+ void SetScrollPaddingRight(const Length& v) {
+ SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, padding_.right, v);
+ }
+
+ // scroll-padding-block-start
+ const Length& ScrollPaddingBlockStart() const {
+ return IsHorizontalWritingMode() ? ScrollPaddingTop() : ScrollPaddingLeft();
+ }
+ void SetScrollPaddingBlockStart(const Length& v) {
+ if (IsHorizontalWritingMode())
+ SetScrollPaddingTop(v);
+ else
+ SetScrollPaddingLeft(v);
+ }
+
+ // scroll-padding-block-end
+ const Length& ScrollPaddingBlockEnd() const {
+ return IsHorizontalWritingMode() ? ScrollPaddingBottom()
+ : ScrollPaddingRight();
+ }
+ void SetScrollPaddingBlockEnd(const Length& v) {
+ if (IsHorizontalWritingMode())
+ SetScrollPaddingBottom(v);
+ else
+ SetScrollPaddingRight(v);
+ }
+
+ // scroll-padding-inline-start
+ const Length& ScrollPaddingInlineStart() const {
+ return IsHorizontalWritingMode() ? ScrollPaddingLeft() : ScrollPaddingTop();
+ }
+ void SetScrollPaddingInlineStart(const Length& v) {
+ if (IsHorizontalWritingMode())
+ SetScrollPaddingLeft(v);
+ else
+ SetScrollPaddingTop(v);
+ }
+
+ // scroll-padding-inline-end
+ const Length& ScrollPaddingInlineEnd() const {
+ return IsHorizontalWritingMode() ? ScrollPaddingRight()
+ : ScrollPaddingBottom();
+ }
+ void SetScrollPaddingInlineEnd(const Length& v) {
+ if (IsHorizontalWritingMode())
+ SetScrollPaddingRight(v);
+ else
+ SetScrollPaddingBottom(v);
+ }
+
+ // scroll-snap-margin
+ static Length InitialScrollSnapMargin() { return Length(kFixed); }
+
+ // scroll-snap-margin-top
+ const Length& ScrollSnapMarginTop() const {
+ return rare_non_inherited_data_->scroll_snap_->margin_.top;
+ }
+ void SetScrollSnapMarginTop(const Length& v) {
+ SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, margin_.top, v);
+ }
+
+ // scroll-snap-margin-bottom
+ const Length& ScrollSnapMarginBottom() const {
+ return rare_non_inherited_data_->scroll_snap_->margin_.bottom;
+ }
+ void SetScrollSnapMarginBottom(const Length& v) {
+ SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, margin_.bottom, v);
+ }
+
+ // scroll-snap-margin-left
+ const Length& ScrollSnapMarginLeft() const {
+ return rare_non_inherited_data_->scroll_snap_->margin_.left;
+ }
+ void SetScrollSnapMarginLeft(const Length& v) {
+ SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, margin_.left, v);
+ }
+
+ // scroll-snap-margin-right
+ const Length& ScrollSnapMarginRight() const {
+ return rare_non_inherited_data_->scroll_snap_->margin_.right;
+ }
+ void SetScrollSnapMarginRight(const Length& v) {
+ SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, margin_.right, v);
+ }
+
+ // scroll-snap-margin-block-start
+ const Length& ScrollSnapMarginBlockStart() const {
+ return IsHorizontalWritingMode() ? ScrollSnapMarginTop()
+ : ScrollSnapMarginLeft();
+ }
+ void SetScrollSnapMarginBlockStart(const Length& v) {
+ if (IsHorizontalWritingMode())
+ SetScrollSnapMarginTop(v);
+ else
+ SetScrollSnapMarginLeft(v);
+ }
+
+ // scroll-snap-margin-block-end
+ const Length& ScrollSnapMarginBlockEnd() const {
+ return IsHorizontalWritingMode() ? ScrollSnapMarginBottom()
+ : ScrollSnapMarginRight();
+ }
+ void SetScrollSnapMarginBlockEnd(const Length& v) {
+ if (IsHorizontalWritingMode())
+ SetScrollSnapMarginBottom(v);
+ else
+ SetScrollSnapMarginRight(v);
+ }
+
+ // scroll-snap-margin-inline-start
+ const Length& ScrollSnapMarginInlineStart() const {
+ return IsHorizontalWritingMode() ? ScrollSnapMarginLeft()
+ : ScrollSnapMarginTop();
+ }
+ void SetScrollSnapMarginInlineStart(const Length& v) {
+ if (IsHorizontalWritingMode())
+ SetScrollSnapMarginLeft(v);
+ else
+ SetScrollSnapMarginTop(v);
+ }
+
+ // scroll-snap-margin-inline-end
+ const Length& ScrollSnapMarginInlineEnd() const {
+ return IsHorizontalWritingMode() ? ScrollSnapMarginRight()
+ : ScrollSnapMarginBottom();
+ }
+ void SetScrollSnapMarginInlineEnd(const Length& v) {
+ if (IsHorizontalWritingMode())
+ SetScrollSnapMarginRight(v);
+ else
+ SetScrollSnapMarginBottom(v);
+ }
+
+ /* // scroll-snap-stop
+ static ScrollSnapStop InitialScrollSnapStop() { return
+ kScrollSnapStopNormal; } ScrollSnapStop GetScrollSnapStop() const { return
+ rare_non_inherited_data_->scroll_snap_->stop_;
+ }
+ void SetScrollSnapStop(const ScrollSnapStop& b) {
+ SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, stop_, b);
+ }*/
+
+ // scroll-snap-align
+ static ScrollSnapAlign InitialScrollSnapAlign() { return ScrollSnapAlign(); }
+ ScrollSnapAlign GetScrollSnapAlign() const {
+ return rare_non_inherited_data_->scroll_snap_->align_;
+ }
+ void SetScrollSnapAlign(const ScrollSnapAlign& b) {
+ SET_NESTED_VAR(rare_non_inherited_data_, scroll_snap_, align_, b);
}
// shape-image-threshold (aka -webkit-shape-image-threshold)

Powered by Google App Engine
This is Rietveld 408576698