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

Unified Diff: third_party/WebKit/Source/core/style/StyleScrollSnapData.h

Issue 2932593004: Update the snap points css properties (Closed)
Patch Set: rebase 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/StyleScrollSnapData.h
diff --git a/third_party/WebKit/Source/core/style/StyleScrollSnapData.h b/third_party/WebKit/Source/core/style/StyleScrollSnapData.h
index 517f57b52660b114a6c33e07baa4ff1533141b97..0414c939adba77303074c3c26998f19bded00b37 100644
--- a/third_party/WebKit/Source/core/style/StyleScrollSnapData.h
+++ b/third_party/WebKit/Source/core/style/StyleScrollSnapData.h
@@ -26,7 +26,7 @@
#ifndef StyleScrollSnapData_h
#define StyleScrollSnapData_h
-#include "core/style/ScrollSnapPoints.h"
+#include "core/style/ComputedStyleConstants.h"
#include "platform/LengthPoint.h"
#include "platform/wtf/Allocator.h"
#include "platform/wtf/RefCounted.h"
@@ -34,6 +34,107 @@
namespace blink {
+struct ScrollSnapType {
+ DISALLOW_NEW();
+
+ ScrollSnapType()
+ : axis(kSnapAxisNone), strictness(kSnapStrictnessProximity) {}
majidvp 2017/06/13 19:20:54 snap type value grammar is "none | [ x | y | block
sunyunjia 2017/06/14 18:36:21 Done.
+
+ ScrollSnapType(const ScrollSnapType& other)
+ : axis(other.axis), strictness(other.strictness) {}
+
+ bool operator==(const ScrollSnapType& other) const {
+ return axis == other.axis && strictness == other.strictness;
+ }
+
+ bool operator!=(const ScrollSnapType& other) const {
+ return !(*this == other);
+ }
+
+ SnapAxis axis;
+ SnapStrictness strictness;
+};
+
+struct ScrollSnapAlign {
+ DISALLOW_NEW();
+
+ ScrollSnapAlign()
+ : alignmentX(kSnapAlignmentNone), alignmentY(kSnapAlignmentNone) {}
+
+ ScrollSnapAlign(const ScrollSnapAlign& other)
+ : alignmentX(other.alignmentX), alignmentY(other.alignmentY) {}
+
+ bool operator==(const ScrollSnapAlign& other) const {
+ return alignmentX == other.alignmentX && alignmentY == other.alignmentY;
+ }
+
+ bool operator!=(const ScrollSnapAlign& other) const {
+ return !(*this == other);
+ }
+
+ SnapAlignment alignmentX;
+ SnapAlignment alignmentY;
+};
+
+struct ScrollPadding {
+ DISALLOW_NEW();
+
+ ScrollPadding() : top(kFixed), right(kFixed), bottom(kFixed), left(kFixed) {}
majidvp 2017/06/13 19:20:53 I don't think you should be initializing this to a
sunyunjia 2017/06/14 18:36:21 Done.
+
+ explicit ScrollPadding(Length length)
+ : top(length), right(length), bottom(length), left(length) {}
+
+ ScrollPadding(const ScrollPadding& other)
+ : top(other.top),
+ right(other.right),
+ bottom(other.bottom),
+ left(other.left) {}
+
+ bool operator==(const ScrollPadding& other) const {
+ return top == other.top && right == other.right && bottom == other.bottom &&
+ left == other.left;
+ }
+
+ bool operator!=(const ScrollPadding& other) const {
+ return !(*this == other);
+ }
+
+ Length top;
+ Length right;
+ Length bottom;
+ Length left;
+};
+
+struct ScrollSnapMargin {
majidvp 2017/06/13 19:20:54 I think you can factor out a common class for both
sunyunjia 2017/06/14 18:36:21 Done.
+ DISALLOW_NEW();
+
+ ScrollSnapMargin()
+ : top(kFixed), right(kFixed), bottom(kFixed), left(kFixed) {}
+
+ explicit ScrollSnapMargin(Length length)
+ : top(length), right(length), bottom(length), left(length) {}
+
+ ScrollSnapMargin(const ScrollSnapMargin& other)
+ : top(other.top),
+ right(other.right),
+ bottom(other.bottom),
+ left(other.left) {}
+
+ bool operator==(const ScrollSnapMargin& other) const {
+ return top == other.top && right == other.right && bottom == other.bottom &&
+ left == other.left;
+ }
+
+ bool operator!=(const ScrollSnapMargin& other) const {
+ return !(*this == other);
+ }
+
+ Length top;
+ Length right;
+ Length bottom;
+ Length left;
+};
+
class StyleScrollSnapData : public RefCounted<StyleScrollSnapData> {
public:
static PassRefPtr<StyleScrollSnapData> Create() {
@@ -43,14 +144,14 @@ class StyleScrollSnapData : public RefCounted<StyleScrollSnapData> {
return AdoptRef(new StyleScrollSnapData(*this));
}
- ScrollSnapPoints x_points_;
- ScrollSnapPoints y_points_;
- LengthPoint destination_;
- Vector<LengthPoint> coordinates_;
+ ScrollSnapType type_;
+ ScrollSnapAlign align_;
+ ScrollPadding padding_;
+ ScrollSnapMargin margin_;
private:
StyleScrollSnapData();
- StyleScrollSnapData(const StyleScrollSnapData&);
+ StyleScrollSnapData(const StyleScrollSnapData& other);
};
bool operator==(const StyleScrollSnapData&, const StyleScrollSnapData&);

Powered by Google App Engine
This is Rietveld 408576698