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

Unified Diff: ui/aura/window_targeter.cc

Issue 118553004: aura: Add an EasyResizeWindowTargeter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-r243131 Created 6 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
« no previous file with comments | « ui/aura/window_targeter.h ('k') | ui/wm/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window_targeter.cc
diff --git a/ui/aura/window_targeter.cc b/ui/aura/window_targeter.cc
index 586392bcdc81b9e8ceb02a8a0971530ae9324f50..5ed0e3fa3ac7297db9065b3a6f4becbc00569e7f 100644
--- a/ui/aura/window_targeter.cc
+++ b/ui/aura/window_targeter.cc
@@ -17,6 +17,29 @@ namespace aura {
WindowTargeter::WindowTargeter() {}
WindowTargeter::~WindowTargeter() {}
+bool WindowTargeter::WindowCanAcceptEvent(aura::Window* window,
+ const ui::LocatedEvent& event) const {
+ if (!window->IsVisible())
+ return false;
+ if (window->ignore_events())
+ return false;
+ client::EventClient* client = client::GetEventClient(window->GetRootWindow());
+ if (client && !client->CanProcessEventsWithinSubtree(window))
+ return false;
+
+ Window* parent = window->parent();
+ if (parent && parent->delegate_ && !parent->delegate_->
+ ShouldDescendIntoChildForEventHandling(window, event.location())) {
+ return false;
+ }
+ return true;
+}
+
+bool WindowTargeter::EventLocationInsideBounds(
+ aura::Window* window, const ui::LocatedEvent& event) const {
+ return window->bounds().Contains(event.location());
+}
+
ui::EventTarget* WindowTargeter::FindTargetForEvent(ui::EventTarget* root,
ui::Event* event) {
if (event->IsKeyEvent()) {
@@ -42,20 +65,10 @@ bool WindowTargeter::SubtreeShouldBeExploredForEvent(
ui::EventTarget* root,
const ui::LocatedEvent& event) {
Window* window = static_cast<Window*>(root);
- if (!window->IsVisible())
- return false;
- if (window->ignore_events())
- return false;
- client::EventClient* client = client::GetEventClient(window->GetRootWindow());
- if (client && !client->CanProcessEventsWithinSubtree(window))
+ if (!WindowCanAcceptEvent(window, event))
return false;
- Window* parent = window->parent();
- if (parent && parent->delegate_ && !parent->delegate_->
- ShouldDescendIntoChildForEventHandling(window, event.location())) {
- return false;
- }
- return window->bounds().Contains(event.location());
+ return EventLocationInsideBounds(window, event);
}
ui::EventTarget* WindowTargeter::FindTargetForLocatedEvent(
« no previous file with comments | « ui/aura/window_targeter.h ('k') | ui/wm/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698