| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "ui/base/touch/selection_bound.h" | |
| 9 #include "ui/gfx/geometry/point_conversions.h" | 8 #include "ui/gfx/geometry/point_conversions.h" |
| 10 #include "ui/gfx/geometry/rect.h" | 9 #include "ui/gfx/geometry/rect.h" |
| 11 #include "ui/gfx/geometry/rect_f.h" | 10 #include "ui/gfx/geometry/rect_f.h" |
| 11 #include "ui/gfx/selection_bound.h" |
| 12 | 12 |
| 13 namespace ui { | 13 namespace gfx { |
| 14 | 14 |
| 15 SelectionBound::SelectionBound() : type_(EMPTY), visible_(false) { | 15 SelectionBound::SelectionBound() : type_(EMPTY), visible_(false) {} |
| 16 } | |
| 17 | 16 |
| 18 SelectionBound::SelectionBound(const SelectionBound& other) = default; | 17 SelectionBound::SelectionBound(const SelectionBound& other) = default; |
| 19 | 18 |
| 20 SelectionBound::~SelectionBound() { | 19 SelectionBound::~SelectionBound() {} |
| 21 } | |
| 22 | 20 |
| 23 void SelectionBound::SetEdgeTop(const gfx::PointF& value) { | 21 void SelectionBound::SetEdgeTop(const gfx::PointF& value) { |
| 24 edge_top_ = value; | 22 edge_top_ = value; |
| 25 edge_top_rounded_ = gfx::ToRoundedPoint(value); | 23 edge_top_rounded_ = gfx::ToRoundedPoint(value); |
| 26 } | 24 } |
| 27 | 25 |
| 28 void SelectionBound::SetEdgeBottom(const gfx::PointF& value) { | 26 void SelectionBound::SetEdgeBottom(const gfx::PointF& value) { |
| 29 edge_bottom_ = value; | 27 edge_bottom_ = value; |
| 30 edge_bottom_rounded_ = gfx::ToRoundedPoint(value); | 28 edge_bottom_rounded_ = gfx::ToRoundedPoint(value); |
| 31 } | 29 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 73 |
| 76 gfx::PointF bottom_right(b1.edge_top()); | 74 gfx::PointF bottom_right(b1.edge_top()); |
| 77 bottom_right.SetToMax(b1.edge_bottom()); | 75 bottom_right.SetToMax(b1.edge_bottom()); |
| 78 bottom_right.SetToMax(b2.edge_top()); | 76 bottom_right.SetToMax(b2.edge_top()); |
| 79 bottom_right.SetToMax(b2.edge_bottom()); | 77 bottom_right.SetToMax(b2.edge_bottom()); |
| 80 | 78 |
| 81 gfx::Vector2dF diff = bottom_right - top_left; | 79 gfx::Vector2dF diff = bottom_right - top_left; |
| 82 return gfx::RectF(top_left, gfx::SizeF(diff.x(), diff.y())); | 80 return gfx::RectF(top_left, gfx::SizeF(diff.x(), diff.y())); |
| 83 } | 81 } |
| 84 | 82 |
| 85 } // namespace ui | 83 } // namespace gfx |
| OLD | NEW |