Remove obsolete entries from .gitignore.
[chromium-blink-merge.git] / components / mus / view_locator.cc
blob40cda4e84d7a98ded7e5a5d40e5688b46ecc13c8
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
3 // found in the LICENSE file.
5 #include "components/mus/view_locator.h"
7 #include "components/mus/server_view.h"
9 namespace mus {
11 const ServerView* FindDeepestVisibleView(const ServerView* view,
12 const gfx::Point& location) {
13 for (const ServerView* child : view->GetChildren()) {
14 if (!child->visible())
15 continue;
17 // TODO(sky): support transform.
18 const gfx::Point child_location(location.x() - child->bounds().x(),
19 location.y() - child->bounds().y());
20 if (child_location.x() >= 0 && child_location.y() >= 0 &&
21 child_location.x() < child->bounds().width() &&
22 child_location.y() < child->bounds().height()) {
23 return FindDeepestVisibleView(child, child_location);
26 return view;
29 ServerView* FindDeepestVisibleView(ServerView* view,
30 const gfx::Point& location) {
31 return const_cast<ServerView*>(
32 FindDeepestVisibleView(const_cast<const ServerView*>(view), location));
35 } // namespace mus