| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/tab_contents_container_gtk.h" | 5 #include "chrome/browser/gtk/tab_contents_container_gtk.h" |
| 6 | 6 |
| 7 #include "app/gfx/native_widget_types.h" | 7 #include "app/gfx/native_widget_types.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "chrome/browser/gtk/gtk_floating_container.h" | 9 #include "chrome/browser/gtk/gtk_floating_container.h" |
| 10 #include "chrome/browser/gtk/status_bubble_gtk.h" | 10 #include "chrome/browser/gtk/status_bubble_gtk.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 GtkAllocation* allocation, | 181 GtkAllocation* allocation, |
| 182 TabContentsContainerGtk* container) { | 182 TabContentsContainerGtk* container) { |
| 183 // Set all the tab contents GtkWidgets to the size of the allocation. | 183 // Set all the tab contents GtkWidgets to the size of the allocation. |
| 184 gtk_container_foreach(GTK_CONTAINER(fixed), ResizeChildren, allocation); | 184 gtk_container_foreach(GTK_CONTAINER(fixed), ResizeChildren, allocation); |
| 185 } | 185 } |
| 186 | 186 |
| 187 // static | 187 // static |
| 188 void TabContentsContainerGtk::OnSetFloatingPosition( | 188 void TabContentsContainerGtk::OnSetFloatingPosition( |
| 189 GtkFloatingContainer* floating_container, GtkAllocation* allocation, | 189 GtkFloatingContainer* floating_container, GtkAllocation* allocation, |
| 190 TabContentsContainerGtk* tab_contents_container) { | 190 TabContentsContainerGtk* tab_contents_container) { |
| 191 GtkWidget* status = tab_contents_container->status_bubble_->widget(); | 191 StatusBubbleGtk* status = tab_contents_container->status_bubble_; |
| 192 | 192 |
| 193 // Look at the size request of the status bubble and tell the | 193 // Look at the size request of the status bubble and tell the |
| 194 // GtkFloatingContainer where we want it positioned. | 194 // GtkFloatingContainer where we want it positioned. |
| 195 GtkRequisition requisition; | 195 GtkRequisition requisition; |
| 196 gtk_widget_size_request(status, &requisition); | 196 gtk_widget_size_request(status->widget(), &requisition); |
| 197 |
| 198 bool ltr = (l10n_util::GetTextDirection() == l10n_util::LEFT_TO_RIGHT); |
| 197 | 199 |
| 198 GValue value = { 0, }; | 200 GValue value = { 0, }; |
| 199 g_value_init(&value, G_TYPE_INT); | 201 g_value_init(&value, G_TYPE_INT); |
| 200 if (l10n_util::GetTextDirection() == l10n_util::LEFT_TO_RIGHT) | 202 if (ltr ^ status->flip_horizontally()) // Is it on the left? |
| 201 g_value_set_int(&value, 0); | 203 g_value_set_int(&value, 0); |
| 202 else | 204 else |
| 203 g_value_set_int(&value, allocation->width - requisition.width); | 205 g_value_set_int(&value, allocation->width - requisition.width); |
| 204 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 206 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
| 205 status, "x", &value); | 207 status->widget(), "x", &value); |
| 206 | 208 |
| 207 int child_y = std::max( | 209 int child_y = std::max( |
| 208 allocation->y + allocation->height - requisition.height, 0); | 210 allocation->y + allocation->height - requisition.height, 0); |
| 209 g_value_set_int(&value, child_y); | 211 g_value_set_int(&value, child_y + status->y_offset()); |
| 210 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 212 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
| 211 status, "y", &value); | 213 status->widget(), "y", &value); |
| 212 g_value_unset(&value); | 214 g_value_unset(&value); |
| 213 } | 215 } |
| OLD | NEW |