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

Side by Side Diff: components/mus/ws/window_finder.cc

Issue 1991973003: mash: Preliminary support for widget hit test masks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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
« no previous file with comments | « components/mus/ws/server_window.cc ('k') | components/mus/ws/window_finder_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/mus/ws/window_finder.h" 5 #include "components/mus/ws/window_finder.h"
6 6
7 #include "components/mus/surfaces/surfaces_state.h" 7 #include "components/mus/surfaces/surfaces_state.h"
8 #include "components/mus/ws/server_window.h" 8 #include "components/mus/ws/server_window.h"
9 #include "components/mus/ws/server_window_delegate.h" 9 #include "components/mus/ws/server_window_delegate.h"
10 #include "components/mus/ws/server_window_surface.h" 10 #include "components/mus/ws/server_window_surface.h"
(...skipping 21 matching lines...) Expand all
32 continue; 32 continue;
33 33
34 // TODO(sky): support transform. 34 // TODO(sky): support transform.
35 gfx::Point child_location(location->x() - child->bounds().x(), 35 gfx::Point child_location(location->x() - child->bounds().x(),
36 location->y() - child->bounds().y()); 36 location->y() - child->bounds().y());
37 gfx::Rect child_bounds(child->bounds().size()); 37 gfx::Rect child_bounds(child->bounds().size());
38 child_bounds.Inset(-child->extended_hit_test_region().left(), 38 child_bounds.Inset(-child->extended_hit_test_region().left(),
39 -child->extended_hit_test_region().top(), 39 -child->extended_hit_test_region().top(),
40 -child->extended_hit_test_region().right(), 40 -child->extended_hit_test_region().right(),
41 -child->extended_hit_test_region().bottom()); 41 -child->extended_hit_test_region().bottom());
42 if (child_bounds.Contains(child_location)) { 42 if (!child_bounds.Contains(child_location))
43 *location = child_location; 43 continue;
44 ServerWindow* result = FindDeepestVisibleWindowForEvents(child, location); 44
45 if (IsValidWindowForEvents(result)) 45 if (child->hit_test_mask() &&
46 return result; 46 !child->hit_test_mask()->Contains(child_location))
47 } 47 continue;
48
49 *location = child_location;
50 ServerWindow* result = FindDeepestVisibleWindowForEvents(child, location);
51 if (IsValidWindowForEvents(result))
52 return result;
48 } 53 }
49 return window; 54 return window;
50 } 55 }
51 56
52 gfx::Transform GetTransformToWindow(ServerWindow* window) { 57 gfx::Transform GetTransformToWindow(ServerWindow* window) {
53 gfx::Transform transform; 58 gfx::Transform transform;
54 ServerWindow* current = window; 59 ServerWindow* current = window;
55 while (current->parent()) { 60 while (current->parent()) {
56 transform.Translate(-current->bounds().x(), -current->bounds().y()); 61 transform.Translate(-current->bounds().x(), -current->bounds().y());
57 current = current->parent(); 62 current = current->parent();
58 } 63 }
59 return transform; 64 return transform;
60 } 65 }
61 66
62 } // namespace ws 67 } // namespace ws
63 } // namespace mus 68 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/server_window.cc ('k') | components/mus/ws/window_finder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698