Chromium Code Reviews| 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/bookmark_bar_gtk.h" | 5 #include "chrome/browser/gtk/bookmark_bar_gtk.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "app/gfx/text_elider.h" | 9 #include "app/gfx/text_elider.h" |
| 10 #include "app/gtk_dnd_util.h" | 10 #include "app/gtk_dnd_util.h" |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 459 } | 459 } |
| 460 | 460 |
| 461 int BookmarkBarGtk::GetFirstHiddenBookmark( | 461 int BookmarkBarGtk::GetFirstHiddenBookmark( |
| 462 int extra_space, std::vector<GtkWidget*>* showing_folders) { | 462 int extra_space, std::vector<GtkWidget*>* showing_folders) { |
| 463 int rv = 0; | 463 int rv = 0; |
| 464 bool overflow = false; | 464 bool overflow = false; |
| 465 GList* toolbar_items = | 465 GList* toolbar_items = |
| 466 gtk_container_get_children(GTK_CONTAINER(bookmark_toolbar_.get())); | 466 gtk_container_get_children(GTK_CONTAINER(bookmark_toolbar_.get())); |
| 467 for (GList* iter = toolbar_items; iter; iter = g_list_next(iter)) { | 467 for (GList* iter = toolbar_items; iter; iter = g_list_next(iter)) { |
| 468 GtkWidget* tool_item = reinterpret_cast<GtkWidget*>(iter->data); | 468 GtkWidget* tool_item = reinterpret_cast<GtkWidget*>(iter->data); |
| 469 if (tool_item->allocation.x + tool_item->allocation.width > | 469 if (gtk_widget_get_direction(tool_item) == GTK_TEXT_DIR_RTL) { |
| 470 bookmark_toolbar_.get()->allocation.width + extra_space) { | 470 overflow = (tool_item->allocation.x < |
| 471 overflow = true; | 471 bookmark_toolbar_.get()->allocation.x - extra_space); |
|
Evan Martin
2009/09/24 21:12:05
It's confusing to me what origins these allocation
Evan Stade
2009/09/24 21:15:42
they are relative to the parent GdkWindow that the
| |
| 472 } else { | |
| 473 overflow = | |
| 474 (tool_item->allocation.x + tool_item->allocation.width > | |
| 475 bookmark_toolbar_.get()->allocation.width + | |
| 476 bookmark_toolbar_.get()->allocation.x + extra_space); | |
| 477 } | |
| 478 if (overflow) | |
| 472 break; | 479 break; |
| 473 } | 480 |
| 474 if (showing_folders && | 481 if (showing_folders && |
| 475 model_->GetBookmarkBarNode()->GetChild(rv)->is_folder()) { | 482 model_->GetBookmarkBarNode()->GetChild(rv)->is_folder()) { |
| 476 showing_folders->push_back(gtk_bin_get_child(GTK_BIN(tool_item))); | 483 showing_folders->push_back(gtk_bin_get_child(GTK_BIN(tool_item))); |
| 477 } | 484 } |
| 478 rv++; | 485 rv++; |
| 479 } | 486 } |
| 480 | 487 |
| 481 g_list_free(toolbar_items); | 488 g_list_free(toolbar_items); |
| 482 | 489 |
| 483 if (!overflow) | 490 if (!overflow) |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1036 break; | 1043 break; |
| 1037 } | 1044 } |
| 1038 } | 1045 } |
| 1039 DCHECK_NE(button_idx, -1); | 1046 DCHECK_NE(button_idx, -1); |
| 1040 | 1047 |
| 1041 // Find the GtkWidget* for the actual target button. | 1048 // Find the GtkWidget* for the actual target button. |
| 1042 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; | 1049 int shift = dir == GTK_MENU_DIR_PARENT ? -1 : 1; |
| 1043 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); | 1050 button_idx = (button_idx + shift + folder_list.size()) % folder_list.size(); |
| 1044 PopupForButton(folder_list[button_idx]); | 1051 PopupForButton(folder_list[button_idx]); |
| 1045 } | 1052 } |
| OLD | NEW |