| Index: ui/aura/window.cc
|
| diff --git a/ui/aura/window.cc b/ui/aura/window.cc
|
| index f985944cfcfe31d790bccaf4dfdba49e26641e14..dec6c891acc2ddf3c0ac95aa4e2a9fdf02e44d94 100644
|
| --- a/ui/aura/window.cc
|
| +++ b/ui/aura/window.cc
|
| @@ -348,22 +348,20 @@ bool Window::HasFocus() const {
|
| return focus_manager ? focus_manager->IsFocusedWindow(this) : false;
|
| }
|
|
|
| -// For a given window, we determine its focusability by inspecting each sibling
|
| -// after it (i.e. drawn in front of it in the z-order) to see if it stops
|
| -// propagation of events that would otherwise be targeted at windows behind it.
|
| -// We then perform this same check on every window up to the root.
|
| +// For a given window, we determine its focusability and ability to
|
| +// receive events by inspecting each sibling after it (i.e. drawn in
|
| +// front of it in the z-order) to see if it stops propagation of
|
| +// events that would otherwise be targeted at windows behind it. We
|
| +// then perform this same check on every window up to the root.
|
| bool Window::CanFocus() const {
|
| if (!IsVisible() || !parent_ || (delegate_ && !delegate_->CanFocus()))
|
| return false;
|
| + return !IsBehindStopEventsWindow() && parent_->CanFocus();
|
| +}
|
|
|
| - Windows::const_iterator i = std::find(parent_->children().begin(),
|
| - parent_->children().end(),
|
| - this);
|
| - for (++i; i != parent_->children().end(); ++i) {
|
| - if ((*i)->StopsEventPropagation())
|
| - return false;
|
| - }
|
| - return parent_->CanFocus();
|
| +bool Window::CanReceiveEvents() const {
|
| + return parent_ && IsVisible() && !IsBehindStopEventsWindow() &&
|
| + parent_->CanReceiveEvents();
|
| }
|
|
|
| internal::FocusManager* Window::GetFocusManager() {
|
| @@ -425,6 +423,15 @@ int Window::GetIntProperty(const char* name) const {
|
| GetProperty(name)));
|
| }
|
|
|
| +bool Window::StopsEventPropagation() const {
|
| + if (!stops_event_propagation_ || children_.empty())
|
| + return false;
|
| + aura::Window::Windows::const_iterator it =
|
| + std::find_if(children_.begin(), children_.end(),
|
| + std::mem_fun(&aura::Window::IsVisible));
|
| + return it != children_.end();
|
| +}
|
| +
|
| RootWindow* Window::GetRootWindow() {
|
| return parent_ ? parent_->GetRootWindow() : NULL;
|
| }
|
| @@ -487,10 +494,6 @@ void Window::SchedulePaint() {
|
| SchedulePaintInRect(gfx::Rect(0, 0, bounds().width(), bounds().height()));
|
| }
|
|
|
| -bool Window::StopsEventPropagation() const {
|
| - return stops_event_propagation_ && !children_.empty();
|
| -}
|
| -
|
| Window* Window::GetWindowForPoint(const gfx::Point& local_point,
|
| bool return_tightest,
|
| bool for_event_handling) {
|
| @@ -556,4 +559,15 @@ void Window::UpdateLayerName(const std::string& name) {
|
| #endif
|
| }
|
|
|
| +bool Window::IsBehindStopEventsWindow() const {
|
| + Windows::const_iterator i = std::find(parent_->children().begin(),
|
| + parent_->children().end(),
|
| + this);
|
| + for (++i; i != parent_->children().end(); ++i) {
|
| + if ((*i)->StopsEventPropagation())
|
| + return true;
|
| + }
|
| + return false;
|
| +}
|
| +
|
| } // namespace aura
|
|
|