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

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

Issue 1729373003: Implement touch events for site-isolation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 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
Index: content/browser/renderer_host/render_widget_host_input_event_router.cc
diff --git a/content/browser/renderer_host/render_widget_host_input_event_router.cc b/content/browser/renderer_host/render_widget_host_input_event_router.cc
index 92b07666a80d3b3c46a51db126c86faad0e43ccb..c00ceabf5e0a00599a591f0359640fad24b67583 100644
--- a/content/browser/renderer_host/render_widget_host_input_event_router.cc
+++ b/content/browser/renderer_host/render_widget_host_input_event_router.cc
@@ -11,6 +11,18 @@
#include "content/common/frame_messages.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
+namespace {
+
+void TransformEventTouchPositions(blink::WebTouchEvent* event,
+ const gfx::Vector2d& delta) {
+ for (unsigned i = 0; i < event->touchesLength; ++i) {
+ event->touches[i].position.x += delta.x();
+ event->touches[i].position.y += delta.y();
+ }
+}
+
+} // anonymous namespace
+
namespace content {
RenderWidgetHostInputEventRouter::HittestDelegate::HittestDelegate(
@@ -127,27 +139,42 @@ void RenderWidgetHostInputEventRouter::RouteTouchEvent(
if (!target)
return;
+ // TODO(wjmaclean): Instead of just computing a delta, we should extract
+ // the complete transform. We assume it doesn't change for the duration
+ // of the touch sequence, though this could be wrong; a better approach
+ // might be to always transform each point to the current_touch_target_
+ // for the duration of the sequence.
+ touch_delta_ = transformed_point - original_point;
+
// Store the weak-ptr to the target, since it could disappear in the
// middle of a touch sequence.
current_touch_target_ = target->GetWeakPtr();
}
++active_touches_;
- if (current_touch_target_)
+ if (current_touch_target_) {
+ TransformEventTouchPositions(event, touch_delta_);
current_touch_target_->ProcessTouchEvent(*event, latency);
+ }
break;
}
case blink::WebInputEvent::TouchMove:
- if (current_touch_target_)
+ if (current_touch_target_) {
+ TransformEventTouchPositions(event, touch_delta_);
current_touch_target_->ProcessTouchEvent(*event, latency);
+ }
break;
case blink::WebInputEvent::TouchEnd:
case blink::WebInputEvent::TouchCancel:
DCHECK(active_touches_);
- if (current_touch_target_)
+ if (current_touch_target_) {
+ TransformEventTouchPositions(event, touch_delta_);
current_touch_target_->ProcessTouchEvent(*event, latency);
+ }
--active_touches_;
- if (!active_touches_)
+ if (!active_touches_) {
current_touch_target_ = WeakTarget();
+ touch_delta_ = gfx::Vector2d();
+ }
break;
default:
NOTREACHED();

Powered by Google App Engine
This is Rietveld 408576698