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

Unified Diff: content/browser/renderer_host/input/input_router_impl.cc

Issue 1440923002: Convert the coordinates in WebInputEvent To Viewport in InputRouter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/input/input_router_impl.cc
diff --git a/content/browser/renderer_host/input/input_router_impl.cc b/content/browser/renderer_host/input/input_router_impl.cc
index 7aabd60931cdf3677b88e6e5c573db13bad0fc10..d43c3ea3ec37c3fe04dfc05ccacd2b4206a44f5d 100644
--- a/content/browser/renderer_host/input/input_router_impl.cc
+++ b/content/browser/renderer_host/input/input_router_impl.cc
@@ -15,6 +15,7 @@
#include "content/browser/renderer_host/input/input_router_client.h"
#include "content/browser/renderer_host/input/touch_event_queue.h"
#include "content/browser/renderer_host/input/touchpad_tap_suppression_controller.h"
+#include "content/browser/renderer_host/input/web_input_event_util.h"
#include "content/common/content_constants_internal.h"
#include "content/common/edit_command.h"
#include "content/common/input/input_event_ack_state.h"
@@ -258,6 +259,10 @@ bool InputRouterImpl::HasPendingEvents() const {
active_renderer_fling_count_ > 0;
}
+void InputRouterImpl::SetDeviceScaleFactor(float device_scale_factor) {
+ device_scale_factor_ = device_scale_factor;
+}
+
bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(InputRouterImpl, message)
@@ -412,7 +417,12 @@ bool InputRouterImpl::OfferToClient(const WebInputEvent& input_event,
bool InputRouterImpl::OfferToRenderer(const WebInputEvent& input_event,
const ui::LatencyInfo& latency_info) {
- if (Send(new InputMsg_HandleInputEvent(routing_id(), &input_event,
+ scoped_ptr<blink::WebInputEvent> event_in_viewport =
+ ConvertWebInputEventToViewport(input_event, device_scale_factor_);
+
+ const WebInputEvent* event_to_send =
+ event_in_viewport ? event_in_viewport.get() : &input_event;
+ if (Send(new InputMsg_HandleInputEvent(routing_id(), event_to_send,
latency_info))) {
// Ack messages for ignored ack event types should never be sent by the
// renderer. Consequently, such event types should not affect event time

Powered by Google App Engine
This is Rietveld 408576698