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

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: 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 | « no previous file | 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..9657823ce8b66f7cd3c08018e3d1cbd686d94c1c 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc
@@ -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();
+ container_->setWantsWheelEvents(IsAcceptingWheelEvents());
bbudge 2016/12/02 18:38:01 Would you consider refactoring IsAcceptingWheelEve
dtapuska 2016/12/02 19:42:08 Done.
+
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) {
bbudge 2016/12/02 18:38:01 Could you use unobscured_rect_.IsEmpty() here inst
dtapuska 2016/12/02 19:42:07 Although that may be optimal I'd worry that it wou
bbudge 2016/12/02 22:10:29 OK
+ 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(
@@ -1644,6 +1655,10 @@ void PepperPluginInstanceImpl::UpdateTouchEventRequest() {
}
bool PepperPluginInstanceImpl::IsAcceptingWheelEvents() const {
+ // If the view has 0 area don't request wheel events.
+ if (view_data_.rect.size.width == 0 || view_data_.rect.size.height == 0)
+ return false;
+
return (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_WHEEL) ||
(input_event_mask_ & PP_INPUTEVENT_CLASS_WHEEL);
}
« 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