| OLD | NEW |
| (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 |
| OLD | NEW |