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

Unified Diff: content/browser/renderer_host/render_widget_host_input_event_router.cc

Issue 1489913003: Handle pointer-events: none in browser process hittesting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: readding header Created 4 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/browser/renderer_host/render_widget_host_input_event_router.cc
diff --git a/content/browser/renderer_host/render_widget_host_input_event_router.cc b/content/browser/renderer_host/render_widget_host_input_event_router.cc
index eef72ac2c73932a4a747448eea88bbbdf39e0f74..67bbd4e1528e801023b0571c4054729aa7bd9452 100644
--- a/content/browser/renderer_host/render_widget_host_input_event_router.cc
+++ b/content/browser/renderer_host/render_widget_host_input_event_router.cc
@@ -4,12 +4,29 @@
#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
+#include "cc/quads/surface_draw_quad.h"
+#include "cc/surfaces/surface_id_allocator.h"
#include "cc/surfaces/surface_manager.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
+#include "content/common/frame_messages.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
namespace content {
+RenderWidgetHostInputEventRouter::HittestDelegate::HittestDelegate(
+ const std::unordered_map<cc::SurfaceId, HittestData, cc::SurfaceIdHash>&
+ hittest_data)
+ : hittest_data_(hittest_data) {}
+
+bool RenderWidgetHostInputEventRouter::HittestDelegate::RejectHitTarget(
+ const cc::SurfaceDrawQuad* surface_quad,
+ const gfx::Point& point_in_quad_space) {
+ auto it = hittest_data_.find(surface_quad->surface_id);
+ if (it != hittest_data_.end() && it->second.ignored_for_hittest)
+ return true;
+ return false;
+}
+
RenderWidgetHostInputEventRouter::RenderWidgetHostInputEventRouter()
: active_touches_(0) {}
@@ -28,12 +45,16 @@ RenderWidgetHostViewBase* RenderWidgetHostInputEventRouter::FindEventTarget(
return root_view;
}
+ // The hittest delegate is used to reject hittesting quads based on extra
+ // hittesting data send by the renderer.
+ HittestDelegate delegate(hittest_data_);
+
// The conversion of point to transform_point is done over the course of the
// hit testing, and reflect transformations that would normally be applied in
// the renderer process if the event was being routed between frames within a
// single process with only one RenderWidgetHost.
uint32_t surface_id_namespace =
- root_view->SurfaceIdNamespaceAtPoint(point, transformed_point);
+ root_view->SurfaceIdNamespaceAtPoint(&delegate, point, transformed_point);
const SurfaceIdNamespaceOwnerMap::iterator iter =
owner_map_.find(surface_id_namespace);
// If the point hit a Surface whose namspace is no longer in the map, then
@@ -134,6 +155,24 @@ void RenderWidgetHostInputEventRouter::AddSurfaceIdNamespaceOwner(
void RenderWidgetHostInputEventRouter::RemoveSurfaceIdNamespaceOwner(
uint32_t id) {
owner_map_.erase(id);
+
+ for (auto it = hittest_data_.begin(); it != hittest_data_.end();) {
+ if (cc::SurfaceIdAllocator::NamespaceForId(it->first) == id)
+ it = hittest_data_.erase(it);
+ else
+ ++it;
+ }
+}
+
+void RenderWidgetHostInputEventRouter::OnHittestData(
+ const FrameHostMsg_HittestData_Params& params) {
+ if (owner_map_.find(cc::SurfaceIdAllocator::NamespaceForId(
+ params.surface_id)) == owner_map_.end()) {
+ return;
+ }
+ HittestData data;
+ data.ignored_for_hittest = params.ignored_for_hittest;
+ hittest_data_[params.surface_id] = data;
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698