| Index: ui/aura/window.cc
|
| diff --git a/ui/aura/window.cc b/ui/aura/window.cc
|
| index f985944cfcfe31d790bccaf4dfdba49e26641e14..2efc4af904d254f6ba7c7af38f1611c9807dac9b 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,18 @@ int Window::GetIntProperty(const char* name) const {
|
| GetProperty(name)));
|
| }
|
|
|
| +bool Window::StopsEventPropagation() const {
|
| + if (!stops_event_propagation_ || children_.empty())
|
| + return false;
|
| + bool stops_event_propagation = false;
|
| + for (Windows::const_reverse_iterator it = children_.rbegin();
|
| + it != children_.rend(); ++it) {
|
| + stops_event_propagation |=
|
| + (*it)->IsVisible() && (*it)->stops_event_propagation_;
|
| + }
|
| + return stops_event_propagation;
|
| +}
|
| +
|
| RootWindow* Window::GetRootWindow() {
|
| return parent_ ? parent_->GetRootWindow() : NULL;
|
| }
|
| @@ -487,10 +497,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 +562,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
|
|
|