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

Unified Diff: ui/aura/window.cc

Issue 9788001: Remove stops_event_propagation from Window, since it's broken. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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.h ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window.cc
===================================================================
--- ui/aura/window.cc (revision 128508)
+++ ui/aura/window.cc (working copy)
@@ -9,6 +9,7 @@
#include "base/logging.h"
#include "base/stl_util.h"
#include "base/string_util.h"
+#include "ui/aura/client/event_client.h"
#include "ui/aura/client/stacking_client.h"
#include "ui/aura/client/visibility_client.h"
#include "ui/aura/env.h"
@@ -54,7 +55,6 @@
id_(-1),
transparent_(false),
user_data_(NULL),
- stops_event_propagation_(false),
ignore_events_(false),
hit_test_bounds_override_outer_(0),
hit_test_bounds_override_inner_(0) {
@@ -450,12 +450,24 @@
bool Window::CanFocus() const {
if (!IsVisible() || !parent_ || (delegate_ && !delegate_->CanFocus()))
return false;
- return !IsBehindStopEventsWindow() && parent_->CanFocus();
+
+ // The client may forbid certain windows from receiving focus at a given point
+ // in time.
+ client::EventClient* client = client::GetEventClient(GetRootWindow());
+ if (client && !client->CanProcessEventsWithinSubtree(this))
+ return false;
+
+ return parent_->CanFocus();
}
bool Window::CanReceiveEvents() const {
- return parent_ && IsVisible() && !IsBehindStopEventsWindow() &&
- parent_->CanReceiveEvents();
+ // The client may forbid certain windows from receiving events at a given
+ // point in time.
+ client::EventClient* client = client::GetEventClient(GetRootWindow());
+ if (client && !client->CanProcessEventsWithinSubtree(this))
+ return false;
+
+ return parent_ && IsVisible() && parent_->CanReceiveEvents();
}
internal::FocusManager* Window::GetFocusManager() {
@@ -491,15 +503,6 @@
return root_window && root_window->capture_window() == this;
}
-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();
-}
-
void Window::SuppressPaint() {
layer_->SuppressPaint();
}
@@ -654,6 +657,16 @@
rend = children_.rend();
it != rend; ++it) {
Window* child = *it;
+
+ if (for_event_handling) {
+ // The client may not allow events to be processed by certain subtrees.
+ client::EventClient* client = client::GetEventClient(GetRootWindow());
+ if (client && !client->CanProcessEventsWithinSubtree(child))
+ continue;
+ }
+
+ // We don't process events for invisible windows or those that have asked
+ // to ignore events.
if (!child->IsVisible() || (for_event_handling && child->ignore_events_))
continue;
@@ -664,9 +677,6 @@
for_event_handling);
if (match)
return match;
-
- if (for_event_handling && child->StopsEventPropagation())
- break;
}
return delegate_ ? this : NULL;
@@ -801,15 +811,4 @@
#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
« no previous file with comments | « 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