| 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" | 8 #include "ui/base/touch/selection_bound.h" |
| 9 #include "ui/gfx/geometry/point_conversions.h" | 9 #include "ui/gfx/geometry/point_conversions.h" |
| 10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 gfx::Point bottom_right(b1.edge_top_rounded()); | 59 gfx::Point bottom_right(b1.edge_top_rounded()); |
| 60 bottom_right.SetToMax(b1.edge_bottom_rounded()); | 60 bottom_right.SetToMax(b1.edge_bottom_rounded()); |
| 61 bottom_right.SetToMax(b2.edge_top_rounded()); | 61 bottom_right.SetToMax(b2.edge_top_rounded()); |
| 62 bottom_right.SetToMax(b2.edge_bottom_rounded()); | 62 bottom_right.SetToMax(b2.edge_bottom_rounded()); |
| 63 | 63 |
| 64 gfx::Vector2d diff = bottom_right - top_left; | 64 gfx::Vector2d diff = bottom_right - top_left; |
| 65 return gfx::Rect(top_left, gfx::Size(diff.x(), diff.y())); | 65 return gfx::Rect(top_left, gfx::Size(diff.x(), diff.y())); |
| 66 } | 66 } |
| 67 | 67 |
| 68 gfx::RectF RectFBetweenSelectionBounds(const SelectionBound& b1, |
| 69 const SelectionBound& b2) { |
| 70 gfx::PointF top_left(b1.edge_top()); |
| 71 top_left.SetToMin(b1.edge_bottom()); |
| 72 top_left.SetToMin(b2.edge_top()); |
| 73 top_left.SetToMin(b2.edge_bottom()); |
| 74 |
| 75 gfx::PointF bottom_right(b1.edge_top()); |
| 76 bottom_right.SetToMax(b1.edge_bottom()); |
| 77 bottom_right.SetToMax(b2.edge_top()); |
| 78 bottom_right.SetToMax(b2.edge_bottom()); |
| 79 |
| 80 gfx::Vector2dF diff = bottom_right - top_left; |
| 81 return gfx::RectF(top_left, gfx::SizeF(diff.x(), diff.y())); |
| 82 } |
| 83 |
| 68 } // namespace ui | 84 } // namespace ui |
| OLD | NEW |