Index: ui/aura/window.cc |
diff --git a/ui/aura/window.cc b/ui/aura/window.cc |
index a36a9f169fd98761fc66201bbbd17ebe43415a24..2f241630a2ed22ee839bb5a9fa3485e948dfdfe9 100644 |
--- a/ui/aura/window.cc |
+++ b/ui/aura/window.cc |
@@ -501,12 +501,13 @@ bool Window::HitTest(const gfx::Point& local_point) { |
mask_region.contains(local_point.x(), local_point.y()); |
} |
-Window* Window::GetEventHandlerForPoint(const gfx::Point& local_point) { |
- return GetWindowForPoint(local_point, true, true); |
+Window* Window::GetEventHandlerForPoint(const gfx::Point& local_point, |
+ ui::EventType event_type) { |
+ return GetWindowForPoint(local_point, true, event_type); |
} |
Window* Window::GetTopWindowContainingPoint(const gfx::Point& local_point) { |
- return GetWindowForPoint(local_point, false, false); |
+ return GetWindowForPoint(local_point, false, ui::ET_UNKNOWN); |
} |
Window* Window::GetToplevelWindow() { |
@@ -700,10 +701,11 @@ void Window::SchedulePaint() { |
Window* Window::GetWindowForPoint(const gfx::Point& local_point, |
bool return_tightest, |
- bool for_event_handling) { |
+ ui::EventType event_type) { |
if (!IsVisible()) |
return NULL; |
+ bool for_event_handling = event_type != ui::ET_UNKNOWN; |
if ((for_event_handling && !HitTest(local_point)) || |
(!for_event_handling && !ContainsPoint(local_point))) |
return NULL; |
@@ -721,6 +723,16 @@ Window* Window::GetWindowForPoint(const gfx::Point& local_point, |
return delegate_ ? this : NULL; |
} |
+ // Check if I should claim the mouse click/drag event and not pass it to my |
+ // children because this location is inside the draggable region. |
+ if (delegate_ && |
+ (event_type == ui::ET_MOUSE_PRESSED || |
+ event_type == ui::ET_MOUSE_DRAGGED || |
+ event_type == ui::ET_MOUSE_RELEASED) && |
+ draggable_region_.get() && |
+ draggable_region_->contains(local_point.x(), local_point.y())) |
+ return this; |
+ |
if (!return_tightest && delegate_) |
return this; |
@@ -751,7 +763,7 @@ Window* Window::GetWindowForPoint(const gfx::Point& local_point, |
Window* match = child->GetWindowForPoint(point_in_child_coords, |
return_tightest, |
- for_event_handling); |
+ event_type); |
if (match) |
return match; |
} |
@@ -941,6 +953,10 @@ bool Window::ContainsMouse() { |
return contains_mouse; |
} |
+void Window::SetDraggableRegion(SkRegion* region) { |
+ draggable_region_.reset(region); |
+} |
+ |
#ifndef NDEBUG |
std::string Window::GetDebugInfo() const { |
return StringPrintf( |