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

Unified Diff: ui/aura/window_targeter.cc

Issue 2172363002: Created min size for print preview dialog and modified to allow the Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reduced diff Created 4 years, 5 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
Index: ui/aura/window_targeter.cc
diff --git a/ui/aura/window_targeter.cc b/ui/aura/window_targeter.cc
index 1364ab3fb83ccce05ac450e98d83c664ef7cefcf..316109def72031689535ce8846f283f3d0fbfc06 100644
--- a/ui/aura/window_targeter.cc
+++ b/ui/aura/window_targeter.cc
@@ -59,6 +59,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 +134,8 @@ bool WindowTargeter::SubtreeShouldBeExploredForEvent(
Window* window,
const ui::LocatedEvent& event) {
return SubtreeCanAcceptEvent(window, event) &&
- EventLocationInsideBounds(window, event);
+ EventLocationInsideBoundsRecursive(window, event.location(),
rbpotter 2016/07/25 18:53:28 Should a flag be added to the aura::Window class t
+ event.location());
}
Window* WindowTargeter::FindTargetForKeyEvent(Window* window,

Powered by Google App Engine
This is Rietveld 408576698