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

Unified Diff: mojo/services/view_manager/view_locator.cc

Issue 1092033003: Pulls display related changes from mojo to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 | « mojo/services/view_manager/view_locator.h ('k') | mojo/services/view_manager/view_manager_service_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/view_manager/view_locator.cc
diff --git a/mojo/services/view_manager/view_locator.cc b/mojo/services/view_manager/view_locator.cc
new file mode 100644
index 0000000000000000000000000000000000000000..672b7c83e5a8dac3a4e5276359eb8e4d0b852d2d
--- /dev/null
+++ b/mojo/services/view_manager/view_locator.cc
@@ -0,0 +1,35 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/services/view_manager/view_locator.h"
+
+#include "mojo/services/view_manager/server_view.h"
+
+namespace view_manager {
+
+const ServerView* FindDeepestVisibleView(const ServerView* view,
+ const gfx::Point& location) {
+ for (const ServerView* child : view->GetChildren()) {
+ if (!child->visible())
+ continue;
+
+ // TODO(sky): support transform.
+ const gfx::Point child_location(location.x() - child->bounds().x(),
+ location.y() - child->bounds().y());
+ if (child_location.x() >= 0 && child_location.y() >= 0 &&
+ child_location.x() < child->bounds().width() &&
+ child_location.y() < child->bounds().height()) {
+ return FindDeepestVisibleView(child, child_location);
+ }
+ }
+ return view;
+}
+
+ServerView* FindDeepestVisibleView(ServerView* view,
+ const gfx::Point& location) {
+ return const_cast<ServerView*>(
+ FindDeepestVisibleView(const_cast<const ServerView*>(view), location));
+}
+
+} // namespace view_manager
« no previous file with comments | « mojo/services/view_manager/view_locator.h ('k') | mojo/services/view_manager/view_manager_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698