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

Side by Side Diff: chrome/browser/ui/views/tabs/dragged_tab_controller.cc

Issue 6334152: Clean up RTL methods.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/ui/views/tabs/dragged_tab_controller.h" 5 #include "chrome/browser/ui/views/tabs/dragged_tab_controller.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <set> 8 #include <set>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 to_index = NormalizeIndexToAttachedTabStrip(to_index); 716 to_index = NormalizeIndexToAttachedTabStrip(to_index);
717 if (from_index != to_index) { 717 if (from_index != to_index) {
718 last_move_screen_loc_ = MajorAxisValue(screen_point, attached_tabstrip_); 718 last_move_screen_loc_ = MajorAxisValue(screen_point, attached_tabstrip_);
719 attached_model->MoveTabContentsAt(from_index, to_index, true); 719 attached_model->MoveTabContentsAt(from_index, to_index, true);
720 } 720 }
721 } 721 }
722 722
723 attached_tab_->SchedulePaint(); 723 attached_tab_->SchedulePaint();
724 attached_tab_->SetX(dragged_view_point.x()); 724 attached_tab_->SetX(dragged_view_point.x());
725 attached_tab_->SetX( 725 attached_tab_->SetX(
726 attached_tabstrip_->MirroredLeftPointForRect(attached_tab_->bounds())); 726 attached_tabstrip_->GetMirroredXForRect(attached_tab_->bounds()));
727 attached_tab_->SetY(dragged_view_point.y()); 727 attached_tab_->SetY(dragged_view_point.y());
728 attached_tab_->SchedulePaint(); 728 attached_tab_->SchedulePaint();
729 } 729 }
730 730
731 void DraggedTabController::MoveDetachedTab(const gfx::Point& screen_point) { 731 void DraggedTabController::MoveDetachedTab(const gfx::Point& screen_point) {
732 DCHECK(!attached_tabstrip_); 732 DCHECK(!attached_tabstrip_);
733 DCHECK(view_.get()); 733 DCHECK(view_.get());
734 734
735 int x = screen_point.x() - mouse_offset_.x(); 735 int x = screen_point.x() - mouse_offset_.x();
736 int y = screen_point.y() - mouse_offset_.y(); 736 int y = screen_point.y() - mouse_offset_.y();
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 // bounds of the dragged tab before performing the drag/drop related 930 // bounds of the dragged tab before performing the drag/drop related
931 // calculations. We mirror the dragged bounds because we determine the 931 // calculations. We mirror the dragged bounds because we determine the
932 // position of each tab on the tab strip by calling GetBounds() (without the 932 // position of each tab on the tab strip by calling GetBounds() (without the
933 // mirroring transformation flag) which effectively means that even though 933 // mirroring transformation flag) which effectively means that even though
934 // the tabs are rendered from right to left, the code performs the 934 // the tabs are rendered from right to left, the code performs the
935 // calculation as if the tabs are laid out from left to right. Mirroring the 935 // calculation as if the tabs are laid out from left to right. Mirroring the
936 // dragged bounds adjusts the coordinates of the tab we are dragging so that 936 // dragged bounds adjusts the coordinates of the tab we are dragging so that
937 // it uses the same orientation used by the tabs on the tab strip. 937 // it uses the same orientation used by the tabs on the tab strip.
938 gfx::Rect adjusted_bounds(dragged_bounds); 938 gfx::Rect adjusted_bounds(dragged_bounds);
939 adjusted_bounds.set_x( 939 adjusted_bounds.set_x(
940 attached_tabstrip_->MirroredLeftPointForRect(adjusted_bounds)); 940 attached_tabstrip_->GetMirroredXForRect(adjusted_bounds));
941 941
942 int index = -1; 942 int index = -1;
943 for (int i = 0; i < attached_tabstrip_->tab_count(); ++i) { 943 for (int i = 0; i < attached_tabstrip_->tab_count(); ++i) {
944 const gfx::Rect& ideal_bounds = attached_tabstrip_->ideal_bounds(i); 944 const gfx::Rect& ideal_bounds = attached_tabstrip_->ideal_bounds(i);
945 if (attached_tabstrip_->type() == BaseTabStrip::HORIZONTAL_TAB_STRIP) { 945 if (attached_tabstrip_->type() == BaseTabStrip::HORIZONTAL_TAB_STRIP) {
946 gfx::Rect left_half = ideal_bounds; 946 gfx::Rect left_half = ideal_bounds;
947 left_half.set_width(left_half.width() / 2); 947 left_half.set_width(left_half.width() / 2);
948 gfx::Rect right_half = ideal_bounds; 948 gfx::Rect right_half = ideal_bounds;
949 right_half.set_width(ideal_bounds.width() - left_half.width()); 949 right_half.set_width(ideal_bounds.width() - left_half.width());
950 right_half.set_x(left_half.right()); 950 right_half.set_x(left_half.right());
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 #else 1349 #else
1350 NOTIMPLEMENTED(); 1350 NOTIMPLEMENTED();
1351 #endif 1351 #endif
1352 } 1352 }
1353 } 1353 }
1354 1354
1355 TabStripModel* DraggedTabController::GetModel(BaseTabStrip* tabstrip) const { 1355 TabStripModel* DraggedTabController::GetModel(BaseTabStrip* tabstrip) const {
1356 return static_cast<BrowserTabStripController*>(tabstrip->controller())-> 1356 return static_cast<BrowserTabStripController*>(tabstrip->controller())->
1357 model(); 1357 model();
1358 } 1358 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/status_bubble_views.cc ('k') | chrome/browser/ui/views/tabs/dragged_tab_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698