OLD | NEW |
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_view.h" | 5 #include "chrome/browser/ui/views/tabs/dragged_tab_view.h" |
6 | 6 |
7 #include "chrome/browser/ui/views/tabs/native_view_photobooth.h" | 7 #include "chrome/browser/ui/views/tabs/native_view_photobooth.h" |
8 #include "third_party/skia/include/core/SkShader.h" | 8 #include "third_party/skia/include/core/SkShader.h" |
9 #include "ui/gfx/canvas_skia.h" | 9 #include "ui/gfx/canvas_skia.h" |
10 #include "views/widget/widget.h" | 10 #include "views/widget/widget.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 67 } |
68 | 68 |
69 void DraggedTabView::MoveTo(const gfx::Point& screen_point) { | 69 void DraggedTabView::MoveTo(const gfx::Point& screen_point) { |
70 int x; | 70 int x; |
71 if (base::i18n::IsRTL()) { | 71 if (base::i18n::IsRTL()) { |
72 // On RTL locales, a dragged tab (when it is not attached to a tab strip) | 72 // On RTL locales, a dragged tab (when it is not attached to a tab strip) |
73 // is rendered using a right-to-left orientation so we should calculate the | 73 // is rendered using a right-to-left orientation so we should calculate the |
74 // window position differently. | 74 // window position differently. |
75 gfx::Size ps = GetPreferredSize(); | 75 gfx::Size ps = GetPreferredSize(); |
76 x = screen_point.x() - ScaleValue(ps.width()) + mouse_tab_offset_.x() + | 76 x = screen_point.x() - ScaleValue(ps.width()) + mouse_tab_offset_.x() + |
77 ScaleValue( | 77 ScaleValue(renderer_->GetMirroredXInView(mouse_tab_offset_.x())); |
78 renderer_->MirroredXCoordinateInsideView(mouse_tab_offset_.x())); | |
79 } else { | 78 } else { |
80 x = screen_point.x() + mouse_tab_offset_.x() - | 79 x = screen_point.x() + mouse_tab_offset_.x() - |
81 ScaleValue(mouse_tab_offset_.x()); | 80 ScaleValue(mouse_tab_offset_.x()); |
82 } | 81 } |
83 int y = screen_point.y() + mouse_tab_offset_.y() - | 82 int y = screen_point.y() + mouse_tab_offset_.y() - |
84 ScaleValue(mouse_tab_offset_.y()); | 83 ScaleValue(mouse_tab_offset_.y()); |
85 | 84 |
86 #if defined(OS_WIN) | 85 #if defined(OS_WIN) |
87 int show_flags = container_->IsVisible() ? SWP_NOZORDER : SWP_SHOWWINDOW; | 86 int show_flags = container_->IsVisible() ? SWP_NOZORDER : SWP_SHOWWINDOW; |
88 | 87 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 #else | 212 #else |
214 gfx::Rect bounds; | 213 gfx::Rect bounds; |
215 container_->GetBounds(&bounds, true); | 214 container_->GetBounds(&bounds, true); |
216 container_->SetBounds(gfx::Rect(bounds.x(), bounds.y(), w, h)); | 215 container_->SetBounds(gfx::Rect(bounds.x(), bounds.y(), w, h)); |
217 #endif | 216 #endif |
218 } | 217 } |
219 | 218 |
220 int DraggedTabView::ScaleValue(int value) { | 219 int DraggedTabView::ScaleValue(int value) { |
221 return static_cast<int>(value * kScalingFactor); | 220 return static_cast<int>(value * kScalingFactor); |
222 } | 221 } |
OLD | NEW |