| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/web_contents/touch_editable_impl_aura.h" | 5 #include "content/browser/web_contents/touch_editable_impl_aura.h" |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/render_widget_host_impl.h" | 7 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 8 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 8 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 9 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
| 10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 selection_gesture_in_process_ = true; | 152 selection_gesture_in_process_ = true; |
| 153 // When the user taps, we want to show touch editing handles if user | 153 // When the user taps, we want to show touch editing handles if user |
| 154 // tapped on selected text. | 154 // tapped on selected text. |
| 155 if (selection_anchor_rect_ != selection_focus_rect_) { | 155 if (selection_anchor_rect_ != selection_focus_rect_) { |
| 156 // UnionRects only works for rects with non-zero width. | 156 // UnionRects only works for rects with non-zero width. |
| 157 gfx::Rect anchor(selection_anchor_rect_.origin(), | 157 gfx::Rect anchor(selection_anchor_rect_.origin(), |
| 158 gfx::Size(1, selection_anchor_rect_.height())); | 158 gfx::Size(1, selection_anchor_rect_.height())); |
| 159 gfx::Rect focus(selection_focus_rect_.origin(), | 159 gfx::Rect focus(selection_focus_rect_.origin(), |
| 160 gfx::Size(1, selection_focus_rect_.height())); | 160 gfx::Size(1, selection_focus_rect_.height())); |
| 161 gfx::Rect selection_rect = gfx::UnionRects(anchor, focus); | 161 gfx::Rect selection_rect = gfx::UnionRects(anchor, focus); |
| 162 if (selection_rect.Contains(gesture_event->location())) { | 162 if (selection_rect.Contains( |
| 163 gfx::ToFlooredPoint(gesture_event->location()))) { |
| 163 StartTouchEditing(); | 164 StartTouchEditing(); |
| 164 return true; | 165 return true; |
| 165 } | 166 } |
| 166 } | 167 } |
| 167 // For single taps, not inside selected region, we want to show handles | 168 // For single taps, not inside selected region, we want to show handles |
| 168 // only when the tap is on an already focused textfield. | 169 // only when the tap is on an already focused textfield. |
| 169 textfield_was_focused_on_tap_ = false; | 170 textfield_was_focused_on_tap_ = false; |
| 170 if (gesture_event->details().tap_count() == 1 && | 171 if (gesture_event->details().tap_count() == 1 && |
| 171 text_input_type_ != ui::TEXT_INPUT_TYPE_NONE) | 172 text_input_type_ != ui::TEXT_INPUT_TYPE_NONE) |
| 172 textfield_was_focused_on_tap_ = true; | 173 textfield_was_focused_on_tap_ = true; |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 } | 374 } |
| 374 text_input_type_ = ui::TEXT_INPUT_TYPE_NONE; | 375 text_input_type_ = ui::TEXT_INPUT_TYPE_NONE; |
| 375 EndTouchEditing(true); | 376 EndTouchEditing(true); |
| 376 selection_gesture_in_process_ = false; | 377 selection_gesture_in_process_ = false; |
| 377 handles_hidden_due_to_scroll_ = false; | 378 handles_hidden_due_to_scroll_ = false; |
| 378 scroll_in_progress_ = false; | 379 scroll_in_progress_ = false; |
| 379 overscroll_in_progress_ = false; | 380 overscroll_in_progress_ = false; |
| 380 } | 381 } |
| 381 | 382 |
| 382 } // namespace content | 383 } // namespace content |
| OLD | NEW |