Index: ui/aura/window.cc |
diff --git a/ui/aura/window.cc b/ui/aura/window.cc |
index 1c2554723ede63c285812daa116b96f431580285..62b77883901df9aad1e7eb11921b4e0d8d663753 100644 |
--- a/ui/aura/window.cc |
+++ b/ui/aura/window.cc |
@@ -29,6 +29,7 @@ |
#include "ui/compositor/compositor.h" |
#include "ui/compositor/layer.h" |
#include "ui/gfx/canvas.h" |
+#include "ui/gfx/path.h" |
#include "ui/gfx/screen.h" |
namespace aura { |
@@ -442,8 +443,19 @@ bool Window::HitTest(const gfx::Point& local_point) { |
// probably cheaper to do the math every time than to branch). |
gfx::Rect local_bounds(gfx::Point(), bounds().size()); |
local_bounds.Inset(hit_test_bounds_override_outer_); |
- // TODO(beng): hittest masks. |
- return local_bounds.Contains(local_point); |
+ |
+ if (!delegate_ || !delegate_->HasHitTestMask()) |
+ return local_bounds.Contains(local_point); |
+ |
+ gfx::Path mask; |
+ delegate_->GetHitTestMask(&mask); |
+ |
+ SkRegion clip_region; |
+ clip_region.setRect(local_bounds.x(), local_bounds.y(), |
+ local_bounds.width(), local_bounds.height()); |
+ SkRegion mask_region; |
+ return mask_region.setPath(mask, clip_region) && |
+ mask_region.contains(local_point.x(), local_point.y()); |
} |
Window* Window::GetEventHandlerForPoint(const gfx::Point& local_point) { |