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

Side by Side Diff: content/renderer/pepper/pepper_plugin_instance_impl.cc

Issue 2844823002: Support Coalesced Touch in ppapi (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/pepper/pepper_plugin_instance_impl.h" 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bit_cast.h" 10 #include "base/bit_cast.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 #include "ppapi/shared_impl/scoped_pp_resource.h" 90 #include "ppapi/shared_impl/scoped_pp_resource.h"
91 #include "ppapi/shared_impl/scoped_pp_var.h" 91 #include "ppapi/shared_impl/scoped_pp_var.h"
92 #include "ppapi/shared_impl/time_conversion.h" 92 #include "ppapi/shared_impl/time_conversion.h"
93 #include "ppapi/shared_impl/url_request_info_data.h" 93 #include "ppapi/shared_impl/url_request_info_data.h"
94 #include "ppapi/shared_impl/var.h" 94 #include "ppapi/shared_impl/var.h"
95 #include "ppapi/thunk/enter.h" 95 #include "ppapi/thunk/enter.h"
96 #include "ppapi/thunk/ppb_buffer_api.h" 96 #include "ppapi/thunk/ppb_buffer_api.h"
97 #include "printing/features/features.h" 97 #include "printing/features/features.h"
98 #include "skia/ext/platform_canvas.h" 98 #include "skia/ext/platform_canvas.h"
99 #include "third_party/WebKit/public/platform/URLConversion.h" 99 #include "third_party/WebKit/public/platform/URLConversion.h"
100 #include "third_party/WebKit/public/platform/WebCoalescedInputEvent.h"
100 #include "third_party/WebKit/public/platform/WebCursorInfo.h" 101 #include "third_party/WebKit/public/platform/WebCursorInfo.h"
101 #include "third_party/WebKit/public/platform/WebFloatRect.h" 102 #include "third_party/WebKit/public/platform/WebFloatRect.h"
102 #include "third_party/WebKit/public/platform/WebInputEvent.h" 103 #include "third_party/WebKit/public/platform/WebInputEvent.h"
103 #include "third_party/WebKit/public/platform/WebKeyboardEvent.h" 104 #include "third_party/WebKit/public/platform/WebKeyboardEvent.h"
104 #include "third_party/WebKit/public/platform/WebMouseEvent.h" 105 #include "third_party/WebKit/public/platform/WebMouseEvent.h"
105 #include "third_party/WebKit/public/platform/WebRect.h" 106 #include "third_party/WebKit/public/platform/WebRect.h"
106 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 107 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
107 #include "third_party/WebKit/public/platform/WebString.h" 108 #include "third_party/WebKit/public/platform/WebString.h"
108 #include "third_party/WebKit/public/platform/WebURL.h" 109 #include "third_party/WebKit/public/platform/WebURL.h"
109 #include "third_party/WebKit/public/platform/WebURLError.h" 110 #include "third_party/WebKit/public/platform/WebURLError.h"
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 // some platforms, an "exclude rectangle" where candidate window 1109 // some platforms, an "exclude rectangle" where candidate window
1109 // must avoid the region can be passed to IME. Currently, we pass 1110 // must avoid the region can be passed to IME. Currently, we pass
1110 // only the caret rectangle because it is the only information 1111 // only the caret rectangle because it is the only information
1111 // supported uniformly in Chromium. 1112 // supported uniformly in Chromium.
1112 gfx::Rect caret(text_input_caret_); 1113 gfx::Rect caret(text_input_caret_);
1113 caret.Offset(view_data_.rect.point.x, view_data_.rect.point.y); 1114 caret.Offset(view_data_.rect.point.x, view_data_.rect.point.y);
1114 ConvertDIPToViewport(&caret); 1115 ConvertDIPToViewport(&caret);
1115 return caret; 1116 return caret;
1116 } 1117 }
1117 1118
1119 bool PepperPluginInstanceImpl::HandleCoalescedInputEvent(
1120 const blink::WebCoalescedInputEvent& event,
1121 WebCursorInfo* cursor_info) {
1122 bool result = HandleInputEvent(event.Event(), cursor_info);
1123
1124 if (blink::WebInputEvent::IsTouchEventType(event.Event().GetType()) &&
1125 ((filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_COALESCED_TOUCH) ||
1126 (input_event_mask_ & PP_INPUTEVENT_CLASS_COALESCED_TOUCH))) {
1127 // Handle all the Touch Events one by one. The event at index 0 is
1128 // event.Event().
Navid Zolghadr 2017/05/01 15:53:33 Is there any reason you are only doing this for to
jkwang 2017/05/02 18:59:15 There is no reason to not do it for mouse events.
1129 for (size_t i = 1; i < event.CoalescedEventSize(); ++i) {
1130 HandleInputEvent(event.CoalescedEvent(i), cursor_info);
1131 }
1132 }
1133 return result;
1134 }
1135
1118 bool PepperPluginInstanceImpl::HandleInputEvent( 1136 bool PepperPluginInstanceImpl::HandleInputEvent(
1119 const blink::WebInputEvent& event, 1137 const blink::WebInputEvent& event,
1120 WebCursorInfo* cursor_info) { 1138 WebCursorInfo* cursor_info) {
1121 TRACE_EVENT0("ppapi", "PepperPluginInstanceImpl::HandleInputEvent"); 1139 TRACE_EVENT0("ppapi", "PepperPluginInstanceImpl::HandleInputEvent");
1122 1140
1123 if (!has_been_clicked_ && is_flash_plugin_ && 1141 if (!has_been_clicked_ && is_flash_plugin_ &&
1124 event.GetType() == blink::WebInputEvent::kMouseDown && 1142 event.GetType() == blink::WebInputEvent::kMouseDown &&
1125 (event.GetModifiers() & blink::WebInputEvent::kLeftButtonDown)) { 1143 (event.GetModifiers() & blink::WebInputEvent::kLeftButtonDown)) {
1126 has_been_clicked_ = true; 1144 has_been_clicked_ = true;
1127 blink::WebRect bounds = container()->GetElement().BoundsInViewport(); 1145 blink::WebRect bounds = container()->GetElement().BoundsInViewport();
(...skipping 2325 matching lines...) Expand 10 before | Expand all | Expand 10 after
3453 const cc::TextureMailbox& mailbox) const { 3471 const cc::TextureMailbox& mailbox) const {
3454 auto it = 3472 auto it =
3455 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), 3473 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(),
3456 [&mailbox](const TextureMailboxRefCount& ref_count) { 3474 [&mailbox](const TextureMailboxRefCount& ref_count) {
3457 return ref_count.first.mailbox() == mailbox.mailbox(); 3475 return ref_count.first.mailbox() == mailbox.mailbox();
3458 }); 3476 });
3459 return it != texture_ref_counts_.end(); 3477 return it != texture_ref_counts_.end();
3460 } 3478 }
3461 3479
3462 } // namespace content 3480 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698