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

Unified Diff: third_party/WebKit/Source/core/style/StyleScrollSnapData.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 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..ea02b9773b43b789b48e669ce84840b3d05d17d7 100644
--- a/third_party/WebKit/Source/core/style/StyleScrollSnapData.h
+++ b/third_party/WebKit/Source/core/style/StyleScrollSnapData.h
@@ -26,7 +26,8 @@
#ifndef StyleScrollSnapData_h
#define StyleScrollSnapData_h
-#include "core/style/ScrollSnapPoints.h"
+#include "core/style/ComputedStyleConstants.h"
+#include "core/style/QuadLengthValue.h"
#include "platform/LengthPoint.h"
#include "platform/wtf/Allocator.h"
#include "platform/wtf/RefCounted.h"
@@ -34,6 +35,57 @@
namespace blink {
+using ScrollPadding = QuadLengthValue;
+using ScrollSnapMargin = QuadLengthValue;
+
+struct ScrollSnapType {
+ DISALLOW_NEW();
+
+ ScrollSnapType()
+ : is_none(true),
+ axis(kSnapAxisBoth),
+ strictness(kSnapStrictnessProximity) {}
+
+ ScrollSnapType(const ScrollSnapType& other)
+ : is_none(other.is_none),
+ axis(other.axis),
+ strictness(other.strictness) {}
+
+ bool operator==(const ScrollSnapType& other) const {
+ return is_none == other.is_none && axis == other.axis &&
+ strictness == other.strictness;
+ }
+
+ bool operator!=(const ScrollSnapType& other) const {
+ return !(*this == other);
+ }
+
+ bool is_none;
+ 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;
+};
+
class StyleScrollSnapData : public RefCounted<StyleScrollSnapData> {
public:
static PassRefPtr<StyleScrollSnapData> Create() {
@@ -43,14 +95,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