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

Side by Side Diff: ui/gfx/selection_bound.cc

Issue 2034863002: Move SelectionBound from ui/base/touch to ui/gfx to be used by cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated views_unittests Created 4 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 | « ui/gfx/selection_bound.h ('k') | ui/gfx/selection_bound_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « ui/gfx/selection_bound.h ('k') | ui/gfx/selection_bound_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698