Index: ui/base/touch/touch_editing_controller.cc |
diff --git a/ui/base/touch/touch_editing_controller.cc b/ui/base/touch/touch_editing_controller.cc |
index 1b84ed929bf2af8ad365bd6974d87ec7e3866bb7..6116aeb7a0375faf2382b9d2ad7672d8d72a8e2a 100644 |
--- a/ui/base/touch/touch_editing_controller.cc |
+++ b/ui/base/touch/touch_editing_controller.cc |
@@ -10,6 +10,36 @@ namespace { |
TouchSelectionControllerFactory* g_shared_instance = NULL; |
} // namespace |
+SelectionBound::SelectionBound() |
+ : type(ui::SelectionBound::EMPTY) { |
+} |
+ |
+SelectionBound::~SelectionBound() { |
+} |
+ |
+int SelectionBound::GetHeight() const { |
+ return edge_bottom.y() - edge_top.y(); |
+} |
+ |
+bool operator==(const SelectionBound& lhs, const SelectionBound& rhs) { |
+ return lhs.type == rhs.type && lhs.edge_top == rhs.edge_top && |
+ lhs.edge_bottom == rhs.edge_bottom; |
+} |
+ |
+bool operator!=(const SelectionBound& lhs, const SelectionBound& rhs) { |
+ return !(lhs == rhs); |
+} |
+ |
+gfx::Rect RectBetweenSelectionBounds(const SelectionBound& b1, |
+ const SelectionBound& b2) { |
mohsen
2014/11/07 16:52:27
Can you rewrite this for general case (where handl
mfomitchev
2014/11/10 04:04:12
Done.
|
+ int left = std::min(b1.edge_top.x(), b2.edge_top.x()); |
+ int top = std::min(b1.edge_top.y(), b2.edge_top.y()); |
+ int right = std::max(b1.edge_top.x(), b2.edge_top.x()); |
+ int bottom = std::max(b1.edge_bottom.y(), b2.edge_bottom.y()); |
+ |
+ return gfx::Rect(left, top, right - left, bottom - top); |
+} |
+ |
TouchSelectionController* TouchSelectionController::create( |
TouchEditable* client_view) { |
if (g_shared_instance) |