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

Unified Diff: content/renderer/pepper/pepper_plugin_instance_impl.cc

Issue 2551493002: Don't request wheel or touch events when the view of pepper has no area. (Closed)
Patch Set: Rename method Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/pepper/pepper_plugin_instance_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/pepper_plugin_instance_impl.cc
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc
index c80fe6bd5639e7f1ad68d5478054d3717d3e748e..b5bf409e76a7c52e6e4db044b80eb7bc3a8140ff 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc
@@ -850,7 +850,7 @@ bool PepperPluginInstanceImpl::Initialize(
full_frame_ = full_frame;
UpdateTouchEventRequest();
- container_->setWantsWheelEvents(IsAcceptingWheelEvents());
+ UpdateWheelEventRequest();
SetGPUHistogram(ppapi::Preferences(PpapiPreferencesBuilder::Build(
render_frame_->render_view()->webkit_preferences())),
@@ -1043,7 +1043,7 @@ void PepperPluginInstanceImpl::RequestInputEventsHelper(
if (event_classes & PP_INPUTEVENT_CLASS_TOUCH)
UpdateTouchEventRequest();
if (event_classes & PP_INPUTEVENT_CLASS_WHEEL)
- container_->setWantsWheelEvents(IsAcceptingWheelEvents());
+ UpdateWheelEventRequest();
}
bool PepperPluginInstanceImpl::HandleCompositionStart(
@@ -1292,6 +1292,11 @@ void PepperPluginInstanceImpl::ViewChanged(
view_data_.scroll_offset = PP_MakePoint(scroll_offset.width(),
scroll_offset.height());
+ // The view size may have changed and we might need to update
+ // our registration of event listeners.
+ UpdateTouchEventRequest();
+ UpdateWheelEventRequest();
+
if (desired_fullscreen_state_ || view_data_.is_fullscreen) {
bool is_fullscreen_element = container_->isFullscreenElement();
if (!view_data_.is_fullscreen && desired_fullscreen_state_ &&
@@ -1635,6 +1640,12 @@ void PepperPluginInstanceImpl::SendFocusChangeNotification() {
}
void PepperPluginInstanceImpl::UpdateTouchEventRequest() {
+ // If the view has 0 area don't request touch events.
+ if (view_data_.rect.size.width == 0 || view_data_.rect.size.height == 0) {
+ container_->requestTouchEventType(
+ blink::WebPluginContainer::TouchEventRequestTypeNone);
+ return;
+ }
bool raw_touch = (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH) ||
(input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH);
container_->requestTouchEventType(
@@ -1643,9 +1654,17 @@ void PepperPluginInstanceImpl::UpdateTouchEventRequest() {
: blink::WebPluginContainer::TouchEventRequestTypeSynthesizedMouse);
}
-bool PepperPluginInstanceImpl::IsAcceptingWheelEvents() const {
- return (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_WHEEL) ||
- (input_event_mask_ & PP_INPUTEVENT_CLASS_WHEEL);
+void PepperPluginInstanceImpl::UpdateWheelEventRequest() {
+ // If the view has 0 area don't request wheel events.
+ if (view_data_.rect.size.width == 0 || view_data_.rect.size.height == 0) {
+ container_->setWantsWheelEvents(false);
+ return;
+ }
+
+ bool hasWheelMask =
+ (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_WHEEL) ||
+ (input_event_mask_ & PP_INPUTEVENT_CLASS_WHEEL);
+ container_->setWantsWheelEvents(hasWheelMask);
}
void PepperPluginInstanceImpl::ScheduleAsyncDidChangeView() {
« no previous file with comments | « content/renderer/pepper/pepper_plugin_instance_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698