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

Unified Diff: chrome/browser/ui/views/tabs/tab_drag_controller.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebasefinal Created 8 years, 2 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: chrome/browser/ui/views/tabs/tab_drag_controller.cc
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller.cc b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
index 0b48e712542b09efa7c1b3bc54b65cbf6a85d841..fe73913c487702185d2bb7fda49f2805fcb3c9d2 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
@@ -111,7 +111,7 @@ class DockView : public views::View {
bool rtl_ui = base::i18n::IsRTL();
if (rtl_ui) {
// Flip canvas to draw the mirrored tab images for RTL UI.
- canvas->Translate(gfx::Point(width(), 0));
+ canvas->Translate(gfx::Vector2d(width(), 0));
canvas->Scale(-1, 1);
}
int x_of_active_tab = width() / 2 + kTabSpacing / 2;
@@ -481,8 +481,8 @@ void TabDragController::Drag(const gfx::Point& point_in_screen) {
Attach(source_tabstrip_, gfx::Point());
if (detach_into_browser_ && static_cast<int>(drag_data_.size()) ==
GetModel(source_tabstrip_)->count()) {
- gfx::Point dragged_view_point = GetWindowOffset(point_in_screen);
- RunMoveLoop(dragged_view_point);
+ gfx::Vector2d dragged_view_offset = GetWindowOffset(point_in_screen);
+ RunMoveLoop(dragged_view_offset);
return;
}
}
@@ -1272,8 +1272,8 @@ void TabDragController::DetachIntoNewBrowserAndRunMoveLoop(
// All the tabs in a browser are being dragged but all the tabs weren't
// initially being dragged. For this to happen the user would have to
// start dragging a set of tabs, the other tabs close, then detach.
- gfx::Point dragged_view_point = GetWindowOffset(point_in_screen);
- RunMoveLoop(dragged_view_point);
+ gfx::Vector2d dragged_view_offset = GetWindowOffset(point_in_screen);
+ RunMoveLoop(dragged_view_offset);
return;
}
@@ -1287,7 +1287,7 @@ void TabDragController::DetachIntoNewBrowserAndRunMoveLoop(
std::vector<gfx::Rect> drag_bounds =
CalculateBoundsForDraggedTabs(attached_point.x());
- gfx::Point drag_offset;
+ gfx::Vector2d drag_offset;
Browser* browser = CreateBrowserForDrag(
attached_tabstrip_, point_in_screen, &drag_offset, &drag_bounds);
Detach(DONT_RELEASE_CAPTURE);
@@ -1306,7 +1306,7 @@ void TabDragController::DetachIntoNewBrowserAndRunMoveLoop(
RunMoveLoop(drag_offset);
}
-void TabDragController::RunMoveLoop(const gfx::Point& drag_offset) {
+void TabDragController::RunMoveLoop(const gfx::Vector2d& drag_offset) {
// If the user drags the whole window we'll assume they are going to attach to
// another window and therefor want to reorder.
move_behavior_ = REORDER;
@@ -1937,7 +1937,7 @@ bool TabDragController::AreTabsConsecutive() {
Browser* TabDragController::CreateBrowserForDrag(
TabStrip* source,
const gfx::Point& point_in_screen,
- gfx::Point* drag_offset,
+ gfx::Vector2d* drag_offset,
std::vector<gfx::Rect>* drag_bounds) {
gfx::Point center(0, source->height() / 2);
views::View::ConvertPointToWidget(source, &center);
@@ -1994,13 +1994,13 @@ gfx::Point TabDragController::GetCursorScreenPoint() {
return screen_->GetCursorScreenPoint();
}
-gfx::Point TabDragController::GetWindowOffset(
+gfx::Vector2d TabDragController::GetWindowOffset(
const gfx::Point& point_in_screen) {
TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ?
attached_tabstrip_ : source_tabstrip_;
views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView();
- gfx::Point offset = point_in_screen;
- views::View::ConvertPointFromScreen(toplevel_view, &offset);
- return offset;
+ gfx::Point point = point_in_screen;
+ views::View::ConvertPointFromScreen(toplevel_view, &point);
+ return point.OffsetFromOrigin();
}

Powered by Google App Engine
This is Rietveld 408576698