OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/services/view_manager/view_coordinate_conversions.h" | 5 #include "services/view_manager/view_coordinate_conversions.h" |
6 | 6 |
7 #include "mojo/services/view_manager/server_view.h" | 7 #include "services/view_manager/server_view.h" |
8 #include "ui/gfx/geometry/rect.h" | 8 #include "ui/gfx/geometry/rect.h" |
9 #include "ui/gfx/geometry/vector2d.h" | 9 #include "ui/gfx/geometry/vector2d.h" |
10 | 10 |
11 namespace mojo { | 11 namespace mojo { |
12 namespace service { | 12 namespace service { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 gfx::Vector2d CalculateOffsetToAncestor(const ServerView* view, | 16 gfx::Vector2d CalculateOffsetToAncestor(const ServerView* view, |
17 const ServerView* ancestor) { | 17 const ServerView* ancestor) { |
(...skipping 17 matching lines...) Expand all Loading... |
35 const gfx::Vector2d offset(CalculateOffsetToAncestor(to, from)); | 35 const gfx::Vector2d offset(CalculateOffsetToAncestor(to, from)); |
36 return gfx::Rect(rect.origin() - offset, rect.size()); | 36 return gfx::Rect(rect.origin() - offset, rect.size()); |
37 } | 37 } |
38 DCHECK(to->Contains(from)); | 38 DCHECK(to->Contains(from)); |
39 const gfx::Vector2d offset(CalculateOffsetToAncestor(from, to)); | 39 const gfx::Vector2d offset(CalculateOffsetToAncestor(from, to)); |
40 return gfx::Rect(rect.origin() + offset, rect.size()); | 40 return gfx::Rect(rect.origin() + offset, rect.size()); |
41 } | 41 } |
42 | 42 |
43 } // namespace service | 43 } // namespace service |
44 } // namespace mojo | 44 } // namespace mojo |
OLD | NEW |