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

Unified Diff: content/renderer/gpu/render_widget_compositor.cc

Issue 2479663002: Move compositor InputHandler from RenderViewImpl to RenderWidget. (Closed)
Patch Set: Plumb pseudo touch-event-rects for OOPIFs to compositor. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/gpu/render_widget_compositor.cc
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc
index b9cdc15aa7d1c0f90bcf7d33b0253d186ddf6da8..f71d58f5535b47b513d1a22c00ecc59939ea37ec 100644
--- a/content/renderer/gpu/render_widget_compositor.cc
+++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -29,6 +29,7 @@
#include "build/build_config.h"
#include "cc/animation/animation_host.h"
#include "cc/animation/animation_timeline.h"
+#include "cc/base/region.h"
#include "cc/base/switches.h"
#include "cc/blimp/engine_picture_cache.h"
#include "cc/blimp/image_serialization_processor.h"
@@ -212,6 +213,7 @@ RenderWidgetCompositor::RenderWidgetCompositor(
compositor_deps_(compositor_deps),
threaded_(!!compositor_deps_->GetCompositorImplThreadTaskRunner()),
never_visible_(false),
+ is_for_oopif_(false),
layout_and_paint_async_callback_(nullptr),
remote_proto_channel_receiver_(nullptr),
weak_factory_(this) {}
@@ -844,6 +846,37 @@ void RenderWidgetCompositor::setEventListenerProperties(
static_cast<cc::EventListenerProperties>(properties));
}
+void RenderWidgetCompositor::updateTouchRectsForSubframeIfNecessary() {
+ if (!is_for_oopif_)
+ return;
+
+ // If this is an oopif sub-frame compositor, we won't be getting TouchRects
+ // from ScrollingCoordinator, so to make sure touch events are handled
+ // properly, mark the entire root layer as a TouchRect.
+ // TODO(wjmaclean): remove this when ScrollingCoordinator is made per-frame,
+ // as opposed to per-page.
+ using blink::WebEventListenerProperties;
+ using blink::WebEventListenerClass;
+
+ blink::WebEventListenerProperties touch_start_properties =
+ eventListenerProperties(WebEventListenerClass::TouchStartOrMove);
+ blink::WebEventListenerProperties touch_end_cancel_properties =
+ eventListenerProperties(WebEventListenerClass::TouchEndOrCancel);
+ bool has_touch_handlers =
+ touch_start_properties == WebEventListenerProperties::Blocking ||
+ touch_start_properties ==
+ WebEventListenerProperties::BlockingAndPassive ||
+ touch_end_cancel_properties == WebEventListenerProperties::Blocking ||
+ touch_end_cancel_properties ==
+ WebEventListenerProperties::BlockingAndPassive;
+
+ cc::Layer* root_layer = layer_tree_host_->GetLayerTree()->root_layer();
+ cc::Region touch_handler_region;
+ if (has_touch_handlers)
+ touch_handler_region = gfx::Rect(gfx::Point(), root_layer->bounds());
+ root_layer->SetTouchEventHandlerRegion(touch_handler_region);
+}
+
blink::WebEventListenerProperties
RenderWidgetCompositor::eventListenerProperties(
blink::WebEventListenerClass event_class) const {
@@ -1143,4 +1176,8 @@ void RenderWidgetCompositor::SetDeviceColorSpace(
layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space);
}
+void RenderWidgetCompositor::SetIsForOopif(bool is_for_oopif) {
+ is_for_oopif_ = is_for_oopif;
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698