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

Side by Side Diff: content/browser/frame_host/render_widget_host_view_guest.cc

Issue 2164673002: Queued wheel events should not use ScopedInputScaleDisabler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rescale all necessary attributes. Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/frame_host/render_widget_host_view_guest.h" 5 #include "content/browser/frame_host/render_widget_host_view_guest.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // GestureScrollBegin/End are always consumed by the guest, so we only 548 // GestureScrollBegin/End are always consumed by the guest, so we only
549 // forward GestureScrollUpdate. 549 // forward GestureScrollUpdate.
550 if (event.type == blink::WebInputEvent::GestureScrollUpdate && not_consumed) 550 if (event.type == blink::WebInputEvent::GestureScrollUpdate && not_consumed)
551 guest_->ResendEventToEmbedder(event); 551 guest_->ResendEventToEmbedder(event);
552 } 552 }
553 553
554 void RenderWidgetHostViewGuest::OnHandleInputEvent( 554 void RenderWidgetHostViewGuest::OnHandleInputEvent(
555 RenderWidgetHostImpl* embedder, 555 RenderWidgetHostImpl* embedder,
556 int browser_plugin_instance_id, 556 int browser_plugin_instance_id,
557 const blink::WebInputEvent* event) { 557 const blink::WebInputEvent* event) {
558 // WebMouseWheelEvents go into a queue, and may not be forwarded to the
559 // renderer until after this method goes out of scope. Therefore we need to
560 // explicitly remove the additional device scale factor from the coordinates
561 // before allowing the event to be queued.
562 if (event->type == blink::WebInputEvent::MouseWheel) {
oshima 2016/07/19 21:40:48 you also need to check "IsZoomForDSFEnabled()". A
563 blink::WebMouseWheelEvent rescaled_event =
564 *static_cast<const blink::WebMouseWheelEvent*>(event);
565 rescaled_event.x /= current_device_scale_factor();
566 rescaled_event.y /= current_device_scale_factor();
567 rescaled_event.deltaX /= current_device_scale_factor();
568 rescaled_event.deltaY /= current_device_scale_factor();
569 rescaled_event.wheelTicksX /= current_device_scale_factor();
570 rescaled_event.wheelTicksY /= current_device_scale_factor();
571 host_->ForwardWheelEvent(rescaled_event);
572 return;
573 }
574
558 ScopedInputScaleDisabler disable(host_, current_device_scale_factor()); 575 ScopedInputScaleDisabler disable(host_, current_device_scale_factor());
559 if (blink::WebInputEvent::isMouseEventType(event->type)) { 576 if (blink::WebInputEvent::isMouseEventType(event->type)) {
560 // The mouse events for BrowserPlugin are modified by all 577 // The mouse events for BrowserPlugin are modified by all
561 // the CSS transforms applied on the <object> and embedder. As a result of 578 // the CSS transforms applied on the <object> and embedder. As a result of
562 // this, the coordinates passed on to the guest renderer are potentially 579 // this, the coordinates passed on to the guest renderer are potentially
563 // incorrect to determine the position of the context menu(they are not the 580 // incorrect to determine the position of the context menu(they are not the
564 // actual X, Y of the window). As a hack, we report the last location of a 581 // actual X, Y of the window). As a hack, we report the last location of a
565 // right mouse up to the BrowserPluginGuest to inform it of the next 582 // right mouse up to the BrowserPluginGuest to inform it of the next
566 // potential location for context menu (BUG=470087). 583 // potential location for context menu (BUG=470087).
567 // TODO(ekaramad): Find a better and more fundamental solution. Could the 584 // TODO(ekaramad): Find a better and more fundamental solution. Could the
568 // ContextMenuParams be based on global X, Y? 585 // ContextMenuParams be based on global X, Y?
569 const blink::WebMouseEvent& mouse_event = 586 const blink::WebMouseEvent& mouse_event =
570 static_cast<const blink::WebMouseEvent&>(*event); 587 static_cast<const blink::WebMouseEvent&>(*event);
571 // A MouseDown on the ButtonRight could suggest a ContextMenu. 588 // A MouseDown on the ButtonRight could suggest a ContextMenu.
572 if (guest_ && mouse_event.type == blink::WebInputEvent::MouseDown && 589 if (guest_ && mouse_event.type == blink::WebInputEvent::MouseDown &&
573 mouse_event.button == blink::WebPointerProperties::ButtonRight) 590 mouse_event.button == blink::WebPointerProperties::ButtonRight)
574 guest_->SetContextMenuPosition( 591 guest_->SetContextMenuPosition(
575 gfx::Point(mouse_event.globalX - GetViewBounds().x(), 592 gfx::Point(mouse_event.globalX - GetViewBounds().x(),
576 mouse_event.globalY - GetViewBounds().y())); 593 mouse_event.globalY - GetViewBounds().y()));
577 host_->ForwardMouseEvent(mouse_event); 594 host_->ForwardMouseEvent(mouse_event);
578 return; 595 return;
579 } 596 }
580 597
581 if (event->type == blink::WebInputEvent::MouseWheel) {
582 host_->ForwardWheelEvent(
583 *static_cast<const blink::WebMouseWheelEvent*>(event));
584 return;
585 }
586
587 if (blink::WebInputEvent::isKeyboardEventType(event->type)) { 598 if (blink::WebInputEvent::isKeyboardEventType(event->type)) {
588 if (!embedder->GetLastKeyboardEvent()) 599 if (!embedder->GetLastKeyboardEvent())
589 return; 600 return;
590 NativeWebKeyboardEvent keyboard_event(*embedder->GetLastKeyboardEvent()); 601 NativeWebKeyboardEvent keyboard_event(*embedder->GetLastKeyboardEvent());
591 host_->ForwardKeyboardEvent(keyboard_event); 602 host_->ForwardKeyboardEvent(keyboard_event);
592 return; 603 return;
593 } 604 }
594 605
595 if (blink::WebInputEvent::isTouchEventType(event->type)) { 606 if (blink::WebInputEvent::isTouchEventType(event->type)) {
596 if (event->type == blink::WebInputEvent::TouchStart && 607 if (event->type == blink::WebInputEvent::TouchStart &&
(...skipping 23 matching lines...) Expand all
620 gesture_event.data.scrollUpdate.inertialPhase == 631 gesture_event.data.scrollUpdate.inertialPhase ==
621 blink::WebGestureEvent::MomentumPhase) { 632 blink::WebGestureEvent::MomentumPhase) {
622 return; 633 return;
623 } 634 }
624 host_->ForwardGestureEvent(gesture_event); 635 host_->ForwardGestureEvent(gesture_event);
625 return; 636 return;
626 } 637 }
627 } 638 }
628 639
629 } // namespace content 640 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698