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

Unified Diff: ui/aura/window.cc

Issue 10831361: Draggable region support for frameless app window on CrOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build Created 8 years, 4 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: 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(
« ui/aura/window.h ('K') | « ui/aura/window.h ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698