| OLD | NEW |
| 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 Loading... |
| 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 (IsUseZoomForDSFEnabled() && |
| 563 event->type == blink::WebInputEvent::MouseWheel) { |
| 564 blink::WebMouseWheelEvent rescaled_event = |
| 565 *static_cast<const blink::WebMouseWheelEvent*>(event); |
| 566 rescaled_event.x /= current_device_scale_factor(); |
| 567 rescaled_event.y /= current_device_scale_factor(); |
| 568 rescaled_event.deltaX /= current_device_scale_factor(); |
| 569 rescaled_event.deltaY /= current_device_scale_factor(); |
| 570 rescaled_event.wheelTicksX /= current_device_scale_factor(); |
| 571 rescaled_event.wheelTicksY /= current_device_scale_factor(); |
| 572 host_->ForwardWheelEvent(rescaled_event); |
| 573 return; |
| 574 } |
| 575 |
| 558 ScopedInputScaleDisabler disable(host_, current_device_scale_factor()); | 576 ScopedInputScaleDisabler disable(host_, current_device_scale_factor()); |
| 559 if (blink::WebInputEvent::isMouseEventType(event->type)) { | 577 if (blink::WebInputEvent::isMouseEventType(event->type)) { |
| 560 // The mouse events for BrowserPlugin are modified by all | 578 // The mouse events for BrowserPlugin are modified by all |
| 561 // the CSS transforms applied on the <object> and embedder. As a result of | 579 // 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 | 580 // 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 | 581 // 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 | 582 // 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 | 583 // right mouse up to the BrowserPluginGuest to inform it of the next |
| 566 // potential location for context menu (BUG=470087). | 584 // potential location for context menu (BUG=470087). |
| 567 // TODO(ekaramad): Find a better and more fundamental solution. Could the | 585 // TODO(ekaramad): Find a better and more fundamental solution. Could the |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 gesture_event.data.scrollUpdate.inertialPhase == | 638 gesture_event.data.scrollUpdate.inertialPhase == |
| 621 blink::WebGestureEvent::MomentumPhase) { | 639 blink::WebGestureEvent::MomentumPhase) { |
| 622 return; | 640 return; |
| 623 } | 641 } |
| 624 host_->ForwardGestureEvent(gesture_event); | 642 host_->ForwardGestureEvent(gesture_event); |
| 625 return; | 643 return; |
| 626 } | 644 } |
| 627 } | 645 } |
| 628 | 646 |
| 629 } // namespace content | 647 } // namespace content |
| OLD | NEW |