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

Unified Diff: components/view_manager/view_coordinate_conversions.cc

Issue 1344573002: Mandoline: Rename components/view_manager to components/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 3 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
Index: components/view_manager/view_coordinate_conversions.cc
diff --git a/components/view_manager/view_coordinate_conversions.cc b/components/view_manager/view_coordinate_conversions.cc
deleted file mode 100644
index 8237875fb6ea078be2a9db9e66f31e2e38cab711..0000000000000000000000000000000000000000
--- a/components/view_manager/view_coordinate_conversions.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2014 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 "components/view_manager/view_coordinate_conversions.h"
-
-#include "components/view_manager/server_view.h"
-#include "ui/gfx/geometry/point.h"
-#include "ui/gfx/geometry/point_conversions.h"
-#include "ui/gfx/geometry/point_f.h"
-#include "ui/gfx/geometry/rect.h"
-#include "ui/gfx/geometry/vector2d.h"
-#include "ui/gfx/geometry/vector2d_f.h"
-
-namespace view_manager {
-
-namespace {
-
-gfx::Vector2dF CalculateOffsetToAncestor(const ServerView* view,
- const ServerView* ancestor) {
- DCHECK(ancestor->Contains(view));
- gfx::Vector2d result;
- for (const ServerView* v = view; v != ancestor; v = v->parent())
- result += v->bounds().OffsetFromOrigin();
- return gfx::Vector2dF(result.x(), result.y());
-}
-
-} // namespace
-
-gfx::Point ConvertPointBetweenViews(const ServerView* from,
- const ServerView* to,
- const gfx::Point& point) {
- return gfx::ToFlooredPoint(
- ConvertPointFBetweenViews(from, to, gfx::PointF(point.x(), point.y())));
-}
-
-gfx::PointF ConvertPointFBetweenViews(const ServerView* from,
- const ServerView* to,
- const gfx::PointF& point) {
- DCHECK(from);
- DCHECK(to);
- if (from == to)
- return point;
-
- if (from->Contains(to)) {
- const gfx::Vector2dF offset(CalculateOffsetToAncestor(to, from));
- return point - offset;
- }
- DCHECK(to->Contains(from));
- const gfx::Vector2dF offset(CalculateOffsetToAncestor(from, to));
- return point + offset;
-}
-
-gfx::Rect ConvertRectBetweenViews(const ServerView* from,
- const ServerView* to,
- const gfx::Rect& rect) {
- DCHECK(from);
- DCHECK(to);
- if (from == to)
- return rect;
-
- const gfx::Point top_left(ConvertPointBetweenViews(from, to, rect.origin()));
- const gfx::Point bottom_right(gfx::ToCeiledPoint(ConvertPointFBetweenViews(
- from, to, gfx::PointF(rect.right(), rect.bottom()))));
- return gfx::Rect(top_left.x(), top_left.y(), bottom_right.x() - top_left.x(),
- bottom_right.y() - top_left.y());
-}
-
-} // namespace view_manager
« no previous file with comments | « components/view_manager/view_coordinate_conversions.h ('k') | components/view_manager/view_coordinate_conversions_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698