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

Unified Diff: ui/base/touch/touch_editing_controller.cc

Issue 700563002: Implementing directional text selection handles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new_assets_text
Patch Set: Addressing review feedback. Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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..f3ddf917e82e30894eabf65a2ab09817481a593f 100644
--- a/ui/base/touch/touch_editing_controller.cc
+++ b/ui/base/touch/touch_editing_controller.cc
@@ -10,6 +10,33 @@ 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) {
+ gfx::Rect rect_1 = gfx::BoundingRect(b1.edge_top, b2.edge_bottom);
+ gfx::Rect rect_2 = gfx::BoundingRect(b1.edge_bottom, b2.edge_top);
+ return gfx::UnionRects(rect_1, rect_2);
mohsen 2014/11/10 22:25:59 This might not work properly if width of one of re
mfomitchev 2014/11/10 23:07:29 One of {rect_1, rect_2} will be equal to the union
mohsen 2014/11/11 01:24:39 At least, if both have width of zero (which for ex
mfomitchev 2014/11/12 18:32:49 Yes, good point. Ok, I'll just go with the straigh
+}
+
TouchSelectionController* TouchSelectionController::create(
TouchEditable* client_view) {
if (g_shared_instance)

Powered by Google App Engine
This is Rietveld 408576698