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

Side by Side Diff: services/ui/ws/window_finder.cc

Issue 2118383002: mus: Disregard windows that explicitly set can_accept_events to be false when sending events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Early return 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/ui/ws/window_finder.h" 5 #include "services/ui/ws/window_finder.h"
6 6
7 #include "base/containers/adapters.h" 7 #include "base/containers/adapters.h"
8 #include "services/ui/surfaces/surfaces_state.h" 8 #include "services/ui/surfaces/surfaces_state.h"
9 #include "services/ui/ws/server_window.h" 9 #include "services/ui/ws/server_window.h"
10 #include "services/ui/ws/server_window_delegate.h" 10 #include "services/ui/ws/server_window_delegate.h"
11 #include "services/ui/ws/server_window_surface.h" 11 #include "services/ui/ws/server_window_surface.h"
12 #include "services/ui/ws/server_window_surface_manager.h" 12 #include "services/ui/ws/server_window_surface_manager.h"
13 #include "services/ui/ws/window_coordinate_conversions.h" 13 #include "services/ui/ws/window_coordinate_conversions.h"
14 #include "ui/gfx/geometry/point.h" 14 #include "ui/gfx/geometry/point.h"
15 #include "ui/gfx/geometry/point_f.h" 15 #include "ui/gfx/geometry/point_f.h"
16 #include "ui/gfx/transform.h" 16 #include "ui/gfx/transform.h"
17 17
18 namespace ui { 18 namespace ui {
19 namespace ws { 19 namespace ws {
20 20
21 bool IsValidWindowForEvents(ServerWindow* window) { 21 bool IsValidWindowForEvents(ServerWindow* window) {
22 ServerWindowSurfaceManager* surface_manager = window->surface_manager(); 22 ServerWindowSurfaceManager* surface_manager = window->surface_manager();
23 return surface_manager && 23 return surface_manager &&
24 surface_manager->HasSurfaceOfType(mojom::SurfaceType::DEFAULT); 24 surface_manager->HasSurfaceOfType(mojom::SurfaceType::DEFAULT);
25 } 25 }
26 26
27 ServerWindow* FindDeepestVisibleWindowForEvents(ServerWindow* window, 27 ServerWindow* FindDeepestVisibleWindowForEvents(ServerWindow* window,
28 gfx::Point* location) { 28 gfx::Point* location) {
29 if (!window->can_accept_events())
30 return nullptr;
31
29 const ServerWindow::Windows& children = window->children(); 32 const ServerWindow::Windows& children = window->children();
30 for (ServerWindow* child : base::Reversed(children)) { 33 for (ServerWindow* child : base::Reversed(children)) {
31 if (!child->visible()) 34 if (!child->visible())
32 continue; 35 continue;
33 36
37 if (!child->can_accept_events())
msw 2016/07/12 22:07:23 optional nit: combine with if statement above.
riajiang 2016/07/13 00:01:46 Done.
38 continue;
39
34 // TODO(sky): support transform. 40 // TODO(sky): support transform.
35 gfx::Point child_location(location->x() - child->bounds().x(), 41 gfx::Point child_location(location->x() - child->bounds().x(),
36 location->y() - child->bounds().y()); 42 location->y() - child->bounds().y());
37 gfx::Rect child_bounds(child->bounds().size()); 43 gfx::Rect child_bounds(child->bounds().size());
38 child_bounds.Inset(-child->extended_hit_test_region().left(), 44 child_bounds.Inset(-child->extended_hit_test_region().left(),
39 -child->extended_hit_test_region().top(), 45 -child->extended_hit_test_region().top(),
40 -child->extended_hit_test_region().right(), 46 -child->extended_hit_test_region().right(),
41 -child->extended_hit_test_region().bottom()); 47 -child->extended_hit_test_region().bottom());
42 if (!child_bounds.Contains(child_location)) 48 if (!child_bounds.Contains(child_location))
43 continue; 49 continue;
(...skipping 15 matching lines...) Expand all
59 ServerWindow* current = window; 65 ServerWindow* current = window;
60 while (current->parent()) { 66 while (current->parent()) {
61 transform.Translate(-current->bounds().x(), -current->bounds().y()); 67 transform.Translate(-current->bounds().x(), -current->bounds().y());
62 current = current->parent(); 68 current = current->parent();
63 } 69 }
64 return transform; 70 return transform;
65 } 71 }
66 72
67 } // namespace ws 73 } // namespace ws
68 } // namespace ui 74 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698