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

Unified Diff: third_party/WebKit/public/platform/WebSnapPointList.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
« no previous file with comments | « third_party/WebKit/public/platform/WebLayer.h ('k') | ui/events/android/scroller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/public/platform/WebSnapPointList.h
diff --git a/third_party/WebKit/public/platform/WebSnapPointList.h b/third_party/WebKit/public/platform/WebSnapPointList.h
new file mode 100644
index 0000000000000000000000000000000000000000..b68b2aa7f508a3917214371e4c3248dd1fdd1fc6
--- /dev/null
+++ b/third_party/WebKit/public/platform/WebSnapPointList.h
@@ -0,0 +1,51 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WebSnapPointList_h
+#define WebSnapPointList_h
+
+#include <vector>
+#include "WebCommon.h"
+
+namespace blink {
+enum SnapOrientation { kSnapX, kSnapY };
+
+struct WebSnapPoint {
+ double offset;
+ bool must_snap;
+ bool is_start;
+ bool is_end;
+ WebSnapPoint(double o, bool m, bool start, bool end)
+ : offset(o), must_snap(m), is_start(start), is_end(end) {}
+ WebSnapPoint(const WebSnapPoint& p)
+ : offset(p.offset),
+ must_snap(p.must_snap),
+ is_start(p.is_start),
+ is_end(p.is_end) {}
+ bool operator<(const WebSnapPoint& b) const { return offset < b.offset; }
+};
+
+struct WebSnapPointList {
+ public:
+ WebSnapPointList(){};
+ BLINK_PLATFORM_EXPORT void AddSnapPoint(double,
+ bool,
+ bool,
+ bool,
+ SnapOrientation);
+ BLINK_PLATFORM_EXPORT void Sort();
+
+ const std::vector<WebSnapPoint>& HorizontalOffsets() const {
+ return horizontal_;
+ }
+ const std::vector<WebSnapPoint>& VerticalOffsets() const { return vertical_; }
+
+ private:
+ std::vector<WebSnapPoint> horizontal_;
+ std::vector<WebSnapPoint> vertical_;
+};
+
+} // namespace blink
+
+#endif // WebSnapPointList_h
« no previous file with comments | « third_party/WebKit/public/platform/WebLayer.h ('k') | ui/events/android/scroller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698