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

Unified Diff: chrome/browser/android/vr_shell/vr_shell_gl.cc

Issue 2688813004: Enable scrolling of UI elements. (Closed)
Patch Set: Sent scroll events to latest scrolling target Created 3 years, 10 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 | « chrome/browser/android/vr_shell/vr_shell_gl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/vr_shell_gl.cc
diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.cc b/chrome/browser/android/vr_shell/vr_shell_gl.cc
index 4564af0162f5c35aab779ce0b28045de7f093c98..4c147ccd22bd5c3e0444ee77e5c34ae2199c0ae0 100644
--- a/chrome/browser/android/vr_shell/vr_shell_gl.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc
@@ -529,8 +529,19 @@ void VrShellGl::UpdateController(const gvr::Vec3f& forward_vector) {
target_point_ = plane_intersection_point;
target_element_ = plane.get();
- input_target = (plane->fill == Fill::CONTENT) ? InputTarget::CONTENT
- : InputTarget::UI;
+ // For now treat UI elements, which do not show web content, as NONE input
cjgrant 2017/02/14 14:08:25 General comment on comments: It's usually best to
tiborg 2017/02/14 21:44:23 Done.
+ // targets since they cannot make use of the input anyway.
+ switch (plane->fill) {
cjgrant 2017/02/14 14:08:25 The loop is responsible for finding target_element
tiborg 2017/02/14 21:44:23 Done.
+ case Fill::CONTENT:
+ input_target = InputTarget::CONTENT;
+ break;
+ case Fill::SPRITE:
+ input_target = InputTarget::UI;
+ break;
+ default:
+ input_target = InputTarget::NONE;
+ break;
+ }
}
}
SendEventsToTarget(input_target, pixel_x, pixel_y);
@@ -554,21 +565,36 @@ void VrShellGl::SendEventsToTarget(InputTarget input_target,
}
for (const auto& gesture : gesture_list) {
+ gesture->x = pixel_x;
cjgrant 2017/02/14 14:08:25 So here we change gesture, but a line above, gestu
tiborg 2017/02/14 21:44:23 I think the const is referring to the unique_ptr a
cjgrant 2017/02/14 22:37:41 Michael, thoughts on this? The const is misleadin
tiborg 2017/02/14 23:13:52 Ditched const.
+ gesture->y = pixel_y;
+ auto movableGesture = base::WrapUnique(new WebGestureEvent(*gesture));
cjgrant 2017/02/14 14:08:24 This should use MakeUnique() (ie. the new preferre
tiborg 2017/02/14 21:44:23 Done.
+
switch (gesture->type()) {
+ // Once the user starts scrolling sed all the scroll events to this
cjgrant 2017/02/14 14:08:24 /sed/send/
tiborg 2017/02/14 21:44:23 Done.
+ // element until the scrolling stops.
case WebInputEvent::GestureScrollBegin:
- case WebInputEvent::GestureScrollUpdate:
+ current_scroll_target = input_target;
+ if (current_scroll_target != InputTarget::NONE) {
+ SendGesture(current_scroll_target, std::move(movableGesture));
+ }
+ break;
case WebInputEvent::GestureScrollEnd:
+ if (current_scroll_target != InputTarget::NONE) {
+ SendGesture(current_scroll_target, std::move(movableGesture));
+ }
+ current_scroll_target = InputTarget::NONE;
+ break;
+ case WebInputEvent::GestureScrollUpdate:
case WebInputEvent::GestureFlingCancel:
case WebInputEvent::GestureFlingStart:
- SendGesture(InputTarget::CONTENT,
- base::WrapUnique(new WebGestureEvent(*gesture)));
+ if (current_scroll_target != InputTarget::NONE) {
+ SendGesture(current_scroll_target, std::move(movableGesture));
+ }
break;
case WebInputEvent::GestureTapDown:
- gesture->x = pixel_x;
- gesture->y = pixel_y;
- if (input_target != InputTarget::NONE)
- SendGesture(input_target,
- base::WrapUnique(new WebGestureEvent(*gesture)));
+ if (input_target != InputTarget::NONE) {
+ SendGesture(input_target, std::move(movableGesture));
+ }
break;
case WebInputEvent::Undefined:
break;
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_gl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698