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

Unified Diff: cc/test/surface_hittest_test_helpers.cc

Issue 1663433002: Adds an interface to SurfaceHittestDelegate in order to override (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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: cc/test/surface_hittest_test_helpers.cc
diff --git a/cc/test/surface_hittest_test_helpers.cc b/cc/test/surface_hittest_test_helpers.cc
index b83d6d4b8c7fe7b5947db4d4d9fabbe7faf50e67..57662737208dba6efb7794ef5ee0d7c9cc1fc093 100644
--- a/cc/test/surface_hittest_test_helpers.cc
+++ b/cc/test/surface_hittest_test_helpers.cc
@@ -93,27 +93,48 @@ scoped_ptr<CompositorFrame> CreateCompositorFrame(const gfx::Rect& root_rect,
}
TestSurfaceHittestDelegate::TestSurfaceHittestDelegate()
- : target_overrides_(0) {}
+ : reject_target_overrides_(0), accept_target_overrides_(0) {}
TestSurfaceHittestDelegate::~TestSurfaceHittestDelegate() {}
-void TestSurfaceHittestDelegate::AddInsetsForSurface(
+void TestSurfaceHittestDelegate::AddInsetsForRejectSurface(
const SurfaceId& surface_id,
const gfx::Insets& inset) {
- insets_for_surface_.insert(std::make_pair(surface_id, inset));
+ insets_for_reject_.insert(std::make_pair(surface_id, inset));
+}
+
+void TestSurfaceHittestDelegate::AddInsetsForAcceptSurface(
+ const SurfaceId& surface_id,
+ const gfx::Insets& inset) {
+ insets_for_accept_.insert(std::make_pair(surface_id, inset));
}
bool TestSurfaceHittestDelegate::RejectHitTarget(
const SurfaceDrawQuad* surface_quad,
const gfx::Point& point_in_quad_space) {
- if (!insets_for_surface_.count(surface_quad->surface_id))
+ if (!insets_for_reject_.count(surface_quad->surface_id))
return false;
gfx::Rect bounds(surface_quad->rect);
- bounds.Inset(insets_for_surface_[surface_quad->surface_id]);
+ bounds.Inset(insets_for_reject_[surface_quad->surface_id]);
// If the point provided falls outside the inset, then we skip this surface.
if (!bounds.Contains(point_in_quad_space)) {
if (surface_quad->rect.Contains(point_in_quad_space))
- ++target_overrides_;
+ ++reject_target_overrides_;
+ return true;
+ }
+ return false;
+}
+
+bool TestSurfaceHittestDelegate::AcceptHitTarget(
+ const SurfaceDrawQuad* surface_quad,
+ const gfx::Point& point_in_quad_space) {
+ if (!insets_for_accept_.count(surface_quad->surface_id))
+ return false;
+ gfx::Rect bounds(surface_quad->rect);
+ bounds.Inset(insets_for_accept_[surface_quad->surface_id]);
+ // If the point provided falls outside the inset, then we accept this surface.
+ if (!bounds.Contains(point_in_quad_space)) {
+ ++accept_target_overrides_;
return true;
}
return false;
« no previous file with comments | « cc/test/surface_hittest_test_helpers.h ('k') | content/browser/renderer_host/render_widget_host_input_event_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698