| Index: ui/aura/window_targeter.cc
|
| diff --git a/ui/aura/window_targeter.cc b/ui/aura/window_targeter.cc
|
| index 9853585d3cda3a6a0dddb1503f668abb4b34c7d5..118850c384f78a394203aeda336598c3ace8cdf6 100644
|
| --- a/ui/aura/window_targeter.cc
|
| +++ b/ui/aura/window_targeter.cc
|
| @@ -4,6 +4,8 @@
|
|
|
| #include "ui/aura/window_targeter.h"
|
|
|
| +#include <memory>
|
| +
|
| #include "ui/aura/client/capture_client.h"
|
| #include "ui/aura/client/event_client.h"
|
| #include "ui/aura/client/focus_client.h"
|
| @@ -59,6 +61,40 @@ bool WindowTargeter::EventLocationInsideBounds(
|
| return gfx::Rect(window->bounds().size()).Contains(point);
|
| }
|
|
|
| +bool WindowTargeter::EventLocationInsideBoundsRecursive(Window* window,
|
| + gfx::Point point,
|
| + gfx::Point location) {
|
| + Window* parent = window->parent();
|
| + bool canAccept = true;
|
| + if (parent) {
|
| + if (parent->delegate_ &&
|
| + !parent->delegate_->ShouldDescendIntoChildForEventHandling(window,
|
| + location)) {
|
| + canAccept = false;
|
| + }
|
| + Window::ConvertPointToTarget(window->parent(), window, &point);
|
| + }
|
| +
|
| + bool inBounds = gfx::Rect(window->bounds().size()).Contains(point);
|
| + canAccept = canAccept && (window->IsVisible() && !window->ignore_events());
|
| + client::EventClient* client = client::GetEventClient(window->GetRootWindow());
|
| + if (client && !client->CanProcessEventsWithinSubtree(window))
|
| + canAccept = false;
|
| + if (inBounds && canAccept) {
|
| + return true;
|
| + }
|
| + std::unique_ptr<ui::EventTargetIterator> iter = window->GetChildIterator();
|
| + if (iter) {
|
| + for (ui::EventTarget* child = iter->GetNextTarget(); child;
|
| + child = iter->GetNextTarget()) {
|
| + if (EventLocationInsideBoundsRecursive(static_cast<Window*>(child), point,
|
| + location))
|
| + return true;
|
| + }
|
| + }
|
| + return false;
|
| +}
|
| +
|
| ui::EventTarget* WindowTargeter::FindTargetForEvent(ui::EventTarget* root,
|
| ui::Event* event) {
|
| Window* window = static_cast<Window*>(root);
|
| @@ -100,7 +136,8 @@ bool WindowTargeter::SubtreeShouldBeExploredForEvent(
|
| Window* window,
|
| const ui::LocatedEvent& event) {
|
| return SubtreeCanAcceptEvent(window, event) &&
|
| - EventLocationInsideBounds(window, event);
|
| + EventLocationInsideBoundsRecursive(window, event.location(),
|
| + event.location());
|
| }
|
|
|
| Window* WindowTargeter::FindTargetForKeyEvent(Window* window,
|
|
|