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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef WebSnapPointList_h
6 #define WebSnapPointList_h
7
8 #include <vector>
9 #include "WebCommon.h"
10
11 namespace blink {
12 enum SnapOrientation { kSnapX, kSnapY };
13
14 struct WebSnapPoint {
15 double offset;
16 bool must_snap;
17 bool is_start;
18 bool is_end;
19 WebSnapPoint(double o, bool m, bool start, bool end)
20 : offset(o), must_snap(m), is_start(start), is_end(end) {}
21 WebSnapPoint(const WebSnapPoint& p)
22 : offset(p.offset),
23 must_snap(p.must_snap),
24 is_start(p.is_start),
25 is_end(p.is_end) {}
26 bool operator<(const WebSnapPoint& b) const { return offset < b.offset; }
27 };
28
29 struct WebSnapPointList {
30 public:
31 WebSnapPointList(){};
32 BLINK_PLATFORM_EXPORT void AddSnapPoint(double,
33 bool,
34 bool,
35 bool,
36 SnapOrientation);
37 BLINK_PLATFORM_EXPORT void Sort();
38
39 const std::vector<WebSnapPoint>& HorizontalOffsets() const {
40 return horizontal_;
41 }
42 const std::vector<WebSnapPoint>& VerticalOffsets() const { return vertical_; }
43
44 private:
45 std::vector<WebSnapPoint> horizontal_;
46 std::vector<WebSnapPoint> vertical_;
47 };
48
49 } // namespace blink
50
51 #endif // WebSnapPointList_h
OLDNEW
« 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