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

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

Issue 2168773002: Queued wheel events should not use ScopedInputScaleDisabler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 // GestureScrollBegin/End are always consumed by the guest, so we only 559 // GestureScrollBegin/End are always consumed by the guest, so we only
560 // forward GestureScrollUpdate. 560 // forward GestureScrollUpdate.
561 if (event.type == blink::WebInputEvent::GestureScrollUpdate && not_consumed) 561 if (event.type == blink::WebInputEvent::GestureScrollUpdate && not_consumed)
562 guest_->ResendEventToEmbedder(event); 562 guest_->ResendEventToEmbedder(event);
563 } 563 }
564 564
565 void RenderWidgetHostViewGuest::OnHandleInputEvent( 565 void RenderWidgetHostViewGuest::OnHandleInputEvent(
566 RenderWidgetHostImpl* embedder, 566 RenderWidgetHostImpl* embedder,
567 int browser_plugin_instance_id, 567 int browser_plugin_instance_id,
568 const blink::WebInputEvent* event) { 568 const blink::WebInputEvent* event) {
569 // WebMouseWheelEvents go into a queue, and may not be forwarded to the
570 // renderer until after this method goes out of scope. Therefore we need to
571 // explicitly remove the additional device scale factor from the coordinates
572 // before allowing the event to be queued.
573 if (IsUseZoomForDSFEnabled() &&
574 event->type == blink::WebInputEvent::MouseWheel) {
575 blink::WebMouseWheelEvent rescaled_event =
576 *static_cast<const blink::WebMouseWheelEvent*>(event);
577 rescaled_event.x /= current_device_scale_factor();
578 rescaled_event.y /= current_device_scale_factor();
579 rescaled_event.deltaX /= current_device_scale_factor();
580 rescaled_event.deltaY /= current_device_scale_factor();
581 rescaled_event.wheelTicksX /= current_device_scale_factor();
582 rescaled_event.wheelTicksY /= current_device_scale_factor();
583 host_->ForwardWheelEvent(rescaled_event);
584 return;
585 }
586
569 ScopedInputScaleDisabler disable(host_, current_device_scale_factor()); 587 ScopedInputScaleDisabler disable(host_, current_device_scale_factor());
570 if (blink::WebInputEvent::isMouseEventType(event->type)) { 588 if (blink::WebInputEvent::isMouseEventType(event->type)) {
571 // The mouse events for BrowserPlugin are modified by all 589 // The mouse events for BrowserPlugin are modified by all
572 // the CSS transforms applied on the <object> and embedder. As a result of 590 // the CSS transforms applied on the <object> and embedder. As a result of
573 // this, the coordinates passed on to the guest renderer are potentially 591 // this, the coordinates passed on to the guest renderer are potentially
574 // incorrect to determine the position of the context menu(they are not the 592 // incorrect to determine the position of the context menu(they are not the
575 // actual X, Y of the window). As a hack, we report the last location of a 593 // actual X, Y of the window). As a hack, we report the last location of a
576 // right mouse up to the BrowserPluginGuest to inform it of the next 594 // right mouse up to the BrowserPluginGuest to inform it of the next
577 // potential location for context menu (BUG=470087). 595 // potential location for context menu (BUG=470087).
578 // TODO(ekaramad): Find a better and more fundamental solution. Could the 596 // TODO(ekaramad): Find a better and more fundamental solution. Could the
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 gesture_event.data.scrollUpdate.inertialPhase == 649 gesture_event.data.scrollUpdate.inertialPhase ==
632 blink::WebGestureEvent::MomentumPhase) { 650 blink::WebGestureEvent::MomentumPhase) {
633 return; 651 return;
634 } 652 }
635 host_->ForwardGestureEvent(gesture_event); 653 host_->ForwardGestureEvent(gesture_event);
636 return; 654 return;
637 } 655 }
638 } 656 }
639 657
640 } // namespace content 658 } // 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