| Index: third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
|
| diff --git a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
|
| index 366eb89090332dabe3db45f151bb130c98b5bda5..90137efc361b6465f99130b77bd1ae5697fe7a0b 100644
|
| --- a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
|
| +++ b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
|
| @@ -83,6 +83,7 @@
|
| #include "platform/wtf/Assertions.h"
|
| #include "public/platform/Platform.h"
|
| #include "public/platform/WebClipboard.h"
|
| +#include "public/platform/WebCoalescedInputEvent.h"
|
| #include "public/platform/WebCompositorSupport.h"
|
| #include "public/platform/WebCursorInfo.h"
|
| #include "public/platform/WebDragData.h"
|
| @@ -716,9 +717,9 @@ void WebPluginContainerImpl::HandleMouseEvent(MouseEvent* event) {
|
| FocusPlugin();
|
|
|
| WebCursorInfo cursor_info;
|
| - if (web_plugin_ &&
|
| - web_plugin_->HandleInputEvent(transformed_event, cursor_info) !=
|
| - WebInputEventResult::kNotHandled)
|
| + if (web_plugin_ && web_plugin_->HandleInputEvent(
|
| + WebCoalescedInputEvent(transformed_event),
|
| + cursor_info) != WebInputEventResult::kNotHandled)
|
| event->SetDefaultHandled();
|
|
|
| // A windowless plugin can change the cursor in response to a mouse move
|
| @@ -777,7 +778,8 @@ void WebPluginContainerImpl::HandleWheelEvent(WheelEvent* event) {
|
| translated_event.SetPositionInWidget(local_point.X(), local_point.Y());
|
|
|
| WebCursorInfo cursor_info;
|
| - if (web_plugin_->HandleInputEvent(translated_event, cursor_info) !=
|
| + if (web_plugin_->HandleInputEvent(WebCoalescedInputEvent(translated_event),
|
| + cursor_info) !=
|
| WebInputEventResult::kNotHandled)
|
| event->SetDefaultHandled();
|
| }
|
| @@ -814,11 +816,46 @@ void WebPluginContainerImpl::HandleKeyboardEvent(KeyboardEvent* event) {
|
| web_frame->Client()->HandleCurrentKeyboardEvent();
|
|
|
| WebCursorInfo cursor_info;
|
| - if (web_plugin_->HandleInputEvent(web_event, cursor_info) !=
|
| + if (web_plugin_->HandleInputEvent(WebCoalescedInputEvent(web_event),
|
| + cursor_info) !=
|
| WebInputEventResult::kNotHandled)
|
| event->SetDefaultHandled();
|
| }
|
|
|
| +WebTouchEvent WebPluginContainerImpl::TransformTouchEvent(
|
| + const WebInputEvent& event) {
|
| + DCHECK(blink::WebInputEvent::IsTouchEventType(event.GetType()));
|
| + const WebTouchEvent* touch_event = static_cast<const WebTouchEvent*>(&event);
|
| + WebTouchEvent transformed_event = touch_event->FlattenTransform();
|
| +
|
| + for (unsigned i = 0; i < transformed_event.touches_length; ++i) {
|
| + WebFloatPoint absolute_location = transformed_event.touches[i].position;
|
| +
|
| + // Translate the root frame position to content coordinates.
|
| + if (parent_) {
|
| + absolute_location = parent_->RootFrameToContents(absolute_location);
|
| + }
|
| +
|
| + IntPoint local_point =
|
| + RoundedIntPoint(element_->GetLayoutObject()->AbsoluteToLocal(
|
| + absolute_location, kUseTransforms));
|
| + transformed_event.touches[i].position.x = local_point.X();
|
| + transformed_event.touches[i].position.y = local_point.Y();
|
| + }
|
| + return transformed_event;
|
| +}
|
| +
|
| +WebCoalescedInputEvent WebPluginContainerImpl::TransformCoalescedTouchEvent(
|
| + const WebCoalescedInputEvent& coalesced_event) {
|
| + WebCoalescedInputEvent transformed_event(
|
| + TransformTouchEvent(coalesced_event.Event()));
|
| + for (size_t i = 1; i < coalesced_event.CoalescedEventSize(); ++i) {
|
| + transformed_event.AddCoalescedEvent(
|
| + TransformTouchEvent(coalesced_event.CoalescedEvent(i)));
|
| + }
|
| + return transformed_event;
|
| +}
|
| +
|
| void WebPluginContainerImpl::HandleTouchEvent(TouchEvent* event) {
|
| switch (touch_event_request_type_) {
|
| case kTouchEventRequestTypeNone:
|
| @@ -830,23 +867,8 @@ void WebPluginContainerImpl::HandleTouchEvent(TouchEvent* event) {
|
| if (event->type() == EventTypeNames::touchstart)
|
| FocusPlugin();
|
|
|
| - WebTouchEvent transformed_event =
|
| - event->NativeEvent()->FlattenTransform();
|
| -
|
| - for (unsigned i = 0; i < transformed_event.touches_length; ++i) {
|
| - WebFloatPoint absolute_location = transformed_event.touches[i].position;
|
| -
|
| - // Translate the root frame position to content coordinates.
|
| - if (parent_) {
|
| - absolute_location = parent_->RootFrameToContents(absolute_location);
|
| - }
|
| -
|
| - IntPoint local_point =
|
| - RoundedIntPoint(element_->GetLayoutObject()->AbsoluteToLocal(
|
| - absolute_location, kUseTransforms));
|
| - transformed_event.touches[i].position.x = local_point.X();
|
| - transformed_event.touches[i].position.y = local_point.Y();
|
| - }
|
| + WebCoalescedInputEvent transformed_event =
|
| + TransformCoalescedTouchEvent(*event->NativeEvent());
|
|
|
| WebCursorInfo cursor_info;
|
| if (web_plugin_->HandleInputEvent(transformed_event, cursor_info) !=
|
| @@ -880,7 +902,8 @@ void WebPluginContainerImpl::HandleGestureEvent(GestureEvent* event) {
|
| translated_event.y = local_point.Y();
|
|
|
| WebCursorInfo cursor_info;
|
| - if (web_plugin_->HandleInputEvent(translated_event, cursor_info) !=
|
| + if (web_plugin_->HandleInputEvent(WebCoalescedInputEvent(translated_event),
|
| + cursor_info) !=
|
| WebInputEventResult::kNotHandled) {
|
| event->SetDefaultHandled();
|
| return;
|
| @@ -896,7 +919,8 @@ void WebPluginContainerImpl::SynthesizeMouseEventIfPossible(TouchEvent* event) {
|
| return;
|
|
|
| WebCursorInfo cursor_info;
|
| - if (web_plugin_->HandleInputEvent(web_event, cursor_info) !=
|
| + if (web_plugin_->HandleInputEvent(WebCoalescedInputEvent(web_event),
|
| + cursor_info) !=
|
| WebInputEventResult::kNotHandled)
|
| event->SetDefaultHandled();
|
| }
|
|
|