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

Unified Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 1087893003: Support longpress drag selection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 7 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
« no previous file with comments | « no previous file | content/public/common/content_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_android.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index a20849731707fc6014b209a35ff2f86496452d22..f1951f09d3a0e7255ac53d38ca03c63fc5fd613e 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -267,14 +267,16 @@ scoped_ptr<ui::TouchSelectionController> CreateSelectionController(
ContentViewCore* content_view_core) {
DCHECK(client);
DCHECK(content_view_core);
- int tap_timeout_ms = gfx::ViewConfiguration::GetTapTimeoutInMs();
- int touch_slop_pixels = gfx::ViewConfiguration::GetTouchSlopInPixels();
- bool show_on_tap_for_empty_editable = false;
- return make_scoped_ptr(new ui::TouchSelectionController(
- client,
- base::TimeDelta::FromMilliseconds(tap_timeout_ms),
- touch_slop_pixels / content_view_core->GetDpiScale(),
- show_on_tap_for_empty_editable));
+ ui::TouchSelectionController::Config config;
+ config.tap_timeout = base::TimeDelta::FromMilliseconds(
+ gfx::ViewConfiguration::GetTapTimeoutInMs());
+ config.tap_slop = gfx::ViewConfiguration::GetTouchSlopInPixels() /
+ content_view_core->GetDpiScale();
+ config.show_on_tap_for_empty_editable = false;
+ config.enable_longpress_drag_selection =
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableLongpressDragSelection);
+ return make_scoped_ptr(new ui::TouchSelectionController(client, config));
}
scoped_ptr<OverscrollControllerAndroid> CreateOverscrollController(
@@ -1609,13 +1611,25 @@ InputEventAckState RenderWidgetHostViewAndroid::FilterInputEvent(
blink::WebInputEvent::isGestureEventType(input_event.type)) {
const blink::WebGestureEvent& gesture_event =
static_cast<const blink::WebGestureEvent&>(input_event);
- gfx::PointF gesture_location(gesture_event.x, gesture_event.y);
- if (input_event.type == blink::WebInputEvent::GestureLongPress) {
- if (selection_controller_->WillHandleLongPressEvent(gesture_location))
- return INPUT_EVENT_ACK_STATE_CONSUMED;
- } else if (input_event.type == blink::WebInputEvent::GestureTap) {
- if (selection_controller_->WillHandleTapEvent(gesture_location))
- return INPUT_EVENT_ACK_STATE_CONSUMED;
+ switch (gesture_event.type) {
+ case blink::WebInputEvent::GestureLongPress:
+ if (selection_controller_->WillHandleLongPressEvent(
+ base::TimeTicks() +
+ base::TimeDelta::FromSecondsD(input_event.timeStampSeconds),
+ gfx::PointF(gesture_event.x, gesture_event.y))) {
+ return INPUT_EVENT_ACK_STATE_CONSUMED;
+ }
+ break;
+
+ case blink::WebInputEvent::GestureTap:
+ if (selection_controller_->WillHandleTapEvent(
+ gfx::PointF(gesture_event.x, gesture_event.y))) {
+ return INPUT_EVENT_ACK_STATE_CONSUMED;
+ }
+ break;
+
+ default:
+ break;
}
}
« no previous file with comments | « no previous file | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698