OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/tabs/dragged_tab_gtk.h" | 5 #include "chrome/browser/gtk/tabs/dragged_tab_gtk.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
11 #include "app/gfx/canvas_paint.h" | 11 #include "app/gfx/canvas_paint.h" |
12 #include "app/l10n_util.h" | |
13 #include "app/x11_util.h" | 12 #include "app/x11_util.h" |
| 13 #include "base/i18n/rtl.h" |
14 #include "chrome/browser/browser_theme_provider.h" | 14 #include "chrome/browser/browser_theme_provider.h" |
15 #include "chrome/browser/gtk/gtk_util.h" | 15 #include "chrome/browser/gtk/gtk_util.h" |
16 #include "chrome/browser/gtk/tabs/tab_renderer_gtk.h" | 16 #include "chrome/browser/gtk/tabs/tab_renderer_gtk.h" |
17 #include "chrome/browser/profile.h" | 17 #include "chrome/browser/profile.h" |
18 #include "chrome/browser/renderer_host/backing_store_x.h" | 18 #include "chrome/browser/renderer_host/backing_store_x.h" |
19 #include "chrome/browser/renderer_host/render_view_host.h" | 19 #include "chrome/browser/renderer_host/render_view_host.h" |
20 #include "chrome/browser/tab_contents/tab_contents.h" | 20 #include "chrome/browser/tab_contents/tab_contents.h" |
21 #include "chrome/browser/tabs/tab_strip_model.h" | 21 #include "chrome/browser/tabs/tab_strip_model.h" |
22 #include "gfx/gtk_util.h" | 22 #include "gfx/gtk_util.h" |
23 #include "third_party/skia/include/core/SkShader.h" | 23 #include "third_party/skia/include/core/SkShader.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 //////////////////////////////////////////////////////////////////////////////// | 154 //////////////////////////////////////////////////////////////////////////////// |
155 // DraggedTabGtk, private: | 155 // DraggedTabGtk, private: |
156 | 156 |
157 void DraggedTabGtk::Layout() { | 157 void DraggedTabGtk::Layout() { |
158 if (attached_) { | 158 if (attached_) { |
159 gfx::Size prefsize = GetPreferredSize(); | 159 gfx::Size prefsize = GetPreferredSize(); |
160 renderer_->SetBounds(gfx::Rect(0, 0, prefsize.width(), prefsize.height())); | 160 renderer_->SetBounds(gfx::Rect(0, 0, prefsize.width(), prefsize.height())); |
161 } else { | 161 } else { |
162 int left = 0; | 162 int left = 0; |
163 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) | 163 if (base::i18n::IsRTL()) |
164 left = GetPreferredSize().width() - attached_tab_size_.width(); | 164 left = GetPreferredSize().width() - attached_tab_size_.width(); |
165 | 165 |
166 // The renderer_'s width should be attached_tab_size_.width() in both LTR | 166 // The renderer_'s width should be attached_tab_size_.width() in both LTR |
167 // and RTL locales. Wrong width will cause the wrong positioning of the tab | 167 // and RTL locales. Wrong width will cause the wrong positioning of the tab |
168 // view in dragging. Please refer to http://crbug.com/6223 for details. | 168 // view in dragging. Please refer to http://crbug.com/6223 for details. |
169 renderer_->SetBounds(gfx::Rect(left, 0, attached_tab_size_.width(), | 169 renderer_->SetBounds(gfx::Rect(left, 0, attached_tab_size_.width(), |
170 attached_tab_size_.height())); | 170 attached_tab_size_.height())); |
171 } | 171 } |
172 } | 172 } |
173 | 173 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 cairo_set_source_surface(cr, surface, 0, 0); | 327 cairo_set_source_surface(cr, surface, 0, 0); |
328 cairo_paint(cr); | 328 cairo_paint(cr); |
329 | 329 |
330 cairo_destroy(cr); | 330 cairo_destroy(cr); |
331 | 331 |
332 cairo_surface_destroy(surface); | 332 cairo_surface_destroy(surface); |
333 | 333 |
334 // We've already drawn the tab, so don't propagate the expose-event signal. | 334 // We've already drawn the tab, so don't propagate the expose-event signal. |
335 return TRUE; | 335 return TRUE; |
336 } | 336 } |
OLD | NEW |