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

Unified Diff: ui/touch_selection/touch_selection_controller.cc

Issue 698253004: Reland: Implement Aura side of unified touch text selection for contents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed test failures on Mac Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ui/touch_selection/touch_selection_controller.cc
diff --git a/ui/touch_selection/touch_selection_controller.cc b/ui/touch_selection/touch_selection_controller.cc
index 3d52b4c3e423f276b65541c1491b0e260411fb86..87f09e142bb6bb3508420bb99e67cfe2dd6a3dcd 100644
--- a/ui/touch_selection/touch_selection_controller.cc
+++ b/ui/touch_selection/touch_selection_controller.cc
@@ -66,11 +66,11 @@ TouchSelectionController::TouchSelectionController(
TouchSelectionController::~TouchSelectionController() {
}
-void TouchSelectionController::OnSelectionBoundsChanged(
+bool TouchSelectionController::OnSelectionBoundsUpdated(
const SelectionBound& start,
const SelectionBound& end) {
if (start == start_ && end_ == end)
- return;
+ return false;
start_ = start;
end_ = end;
@@ -80,7 +80,7 @@ void TouchSelectionController::OnSelectionBoundsChanged(
if (!activate_selection_automatically_ &&
!activate_insertion_automatically_) {
DCHECK_EQ(INPUT_EVENT_TYPE_NONE, response_pending_input_event_);
- return;
+ return false;
}
// Ensure that |response_pending_input_event_| is cleared after the method
@@ -113,16 +113,17 @@ void TouchSelectionController::OnSelectionBoundsChanged(
start_orientation_ != TouchHandleOrientation::UNDEFINED &&
end_orientation_ != TouchHandleOrientation::UNDEFINED)) {
OnSelectionChanged();
- return;
+ return true;
}
if (start_orientation_ == TouchHandleOrientation::CENTER &&
selection_editable_) {
OnInsertionChanged();
- return;
+ return true;
}
HideAndDisallowShowingAutomatically();
+ return true;
}
bool TouchSelectionController::WillHandleTouchEvent(const MotionEvent& event) {
@@ -217,6 +218,13 @@ void TouchSelectionController::OnSelectionEmpty(bool empty) {
ResetCachedValuesIfInactive();
}
+void TouchSelectionController::OnNativeViewMoved() {
+ if (is_selection_active_)
+ client_->OnSelectionEvent(SELECTION_MOVED);
+ else if (is_insertion_active_)
+ client_->OnSelectionEvent(INSERTION_MOVED);
+}
+
bool TouchSelectionController::Animate(base::TimeTicks frame_time) {
if (is_insertion_active_)
return insertion_handle_->Animate(frame_time);
@@ -299,11 +307,10 @@ void TouchSelectionController::OnHandleDragUpdate(const TouchHandle& handle,
? GetStartLineOffset()
: GetEndLineOffset();
gfx::PointF line_position = position + line_offset;
- if (&handle == insertion_handle_.get()) {
+ if (&handle == insertion_handle_.get())
client_->MoveCaret(line_position);
- } else {
+ else
client_->MoveRangeSelectionExtent(line_position);
- }
}
void TouchSelectionController::OnHandleDragEnd(const TouchHandle& handle) {

Powered by Google App Engine
This is Rietveld 408576698