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

Side by Side Diff: ui/touch_selection/touch_selection_controller.cc

Issue 1404163004: Swap touch selection handles when they are interchanged (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: linux build error Created 5 years 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
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 "ui/touch_selection/touch_selection_controller.h" 5 #include "ui/touch_selection/touch_selection_controller.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 // Notify if selection bounds have just been established or dissolved. 83 // Notify if selection bounds have just been established or dissolved.
84 if (start.type() != SelectionBound::EMPTY && 84 if (start.type() != SelectionBound::EMPTY &&
85 start_.type() == SelectionBound::EMPTY) { 85 start_.type() == SelectionBound::EMPTY) {
86 client_->OnSelectionEvent(SELECTION_ESTABLISHED); 86 client_->OnSelectionEvent(SELECTION_ESTABLISHED);
87 } else if (start.type() == SelectionBound::EMPTY && 87 } else if (start.type() == SelectionBound::EMPTY &&
88 start_.type() != SelectionBound::EMPTY) { 88 start_.type() != SelectionBound::EMPTY) {
89 client_->OnSelectionEvent(SELECTION_DISSOLVED); 89 client_->OnSelectionEvent(SELECTION_DISSOLVED);
90 } 90 }
91 91
92 // Swap the Handles when the start and end selection points cross each other.
93 if (active_status_ == SELECTION_ACTIVE) {
94 if ((start_selection_handle_->IsActive() &&
95 end_.edge_bottom() == start.edge_bottom()) ||
96 (end_selection_handle_->IsActive() &&
97 end.edge_bottom() == start_.edge_bottom())) {
98 start_selection_handle_.swap(end_selection_handle_);
99 }
100 }
101
92 start_ = start; 102 start_ = start;
93 end_ = end; 103 end_ = end;
94 start_orientation_ = ToTouchHandleOrientation(start_.type()); 104 start_orientation_ = ToTouchHandleOrientation(start_.type());
95 end_orientation_ = ToTouchHandleOrientation(end_.type()); 105 end_orientation_ = ToTouchHandleOrientation(end_.type());
96 force_next_update_ = false; 106 force_next_update_ = false;
97 107
98 if (!activate_selection_automatically_ && 108 if (!activate_selection_automatically_ &&
99 !activate_insertion_automatically_) { 109 !activate_insertion_automatically_) {
100 DCHECK_EQ(INACTIVE, active_status_); 110 DCHECK_EQ(INACTIVE, active_status_);
101 DCHECK_EQ(INPUT_EVENT_TYPE_NONE, response_pending_input_event_); 111 DCHECK_EQ(INPUT_EVENT_TYPE_NONE, response_pending_input_event_);
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 base::TimeDelta duration = base::TimeTicks::Now() - selection_start_time_; 671 base::TimeDelta duration = base::TimeTicks::Now() - selection_start_time_;
662 UMA_HISTOGRAM_CUSTOM_TIMES("Event.TouchSelection.WasDraggedDuration", 672 UMA_HISTOGRAM_CUSTOM_TIMES("Event.TouchSelection.WasDraggedDuration",
663 duration, 673 duration,
664 base::TimeDelta::FromMilliseconds(500), 674 base::TimeDelta::FromMilliseconds(500),
665 base::TimeDelta::FromSeconds(60), 675 base::TimeDelta::FromSeconds(60),
666 60); 676 60);
667 } 677 }
668 } 678 }
669 679
670 } // namespace ui 680 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698