Chromium Code Reviews| Index: chrome/browser/ui/gtk/browser_window_gtk.cc |
| diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc |
| index f3b9706d6acfcbd2ce44921f4c93a2cadfbc79d2..c1bfe3d01d22aadce250f28962b20671d3ba982a 100644 |
| --- a/chrome/browser/ui/gtk/browser_window_gtk.cc |
| +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc |
| @@ -101,11 +101,9 @@ namespace { |
| // The number of milliseconds between loading animation frames. |
| const int kLoadingAnimationFrameTimeMs = 30; |
| -// Default height of dev tools pane when docked to the browser window. This |
| -// matches the value in Views. |
| -const int kDefaultDevToolsHeight = 200; |
| - |
| -const int kMinDevToolsHeight = 50; |
| +// Minimal height of devtools pane or content pane when devtools are docked |
| +// to the browser window. |
| +const int kMinDevToolsHeight = 100; |
|
pfeldman
2011/06/07 19:59:12
Leave it 50
|
| const char* kBrowserWindowKey = "__BROWSER_WINDOW_GTK__"; |
| @@ -1299,13 +1297,24 @@ void BrowserWindowGtk::UpdateDevToolsForContents(TabContents* contents) { |
| bool should_show = old_devtools == NULL && devtools_contents != NULL; |
| bool should_hide = old_devtools != NULL && devtools_contents == NULL; |
| + |
| if (should_show) { |
| + // Restore split offset. |
| + int split_offset = browser_->profile()->GetPrefs()-> |
| + GetInteger(prefs::kDevToolsSplitLocation); |
|
pfeldman
2011/06/07 19:59:12
Is default window height 600? Otherwise how do you
|
| + |
| + GtkAllocation contents_rect; |
| + gtk_widget_get_allocation(contents_container_->widget(), &contents_rect); |
| + |
| + // Make sure user can see both panes. |
| + split_offset = std::min(contents_rect.height - kMinDevToolsHeight, |
| + std::max(kMinDevToolsHeight, split_offset)); |
| + gtk_paned_set_position(GTK_PANED(contents_split_), split_offset); |
| gtk_widget_show(devtools_container_->widget()); |
| } else if (should_hide) { |
| - // Store split offset when hiding devtools window only. |
| - gint divider_offset = gtk_paned_get_position(GTK_PANED(contents_split_)); |
| + gint split_offset = gtk_paned_get_position(GTK_PANED(contents_split_)); |
| browser_->profile()->GetPrefs()-> |
| - SetInteger(prefs::kDevToolsSplitLocation, divider_offset); |
| + SetInteger(prefs::kDevToolsSplitLocation, split_offset); |
| gtk_widget_hide(devtools_container_->widget()); |
| } |
| } |
| @@ -1686,17 +1695,7 @@ void BrowserWindowGtk::InitWidgets() { |
| gtk_paned_pack2(GTK_PANED(contents_split_), devtools_container_->widget(), |
| FALSE, TRUE); |
| gtk_box_pack_end(GTK_BOX(render_area_vbox_), contents_split_, TRUE, TRUE, 0); |
| - // Restore split offset. |
| - int split_offset = browser_->profile()->GetPrefs()-> |
| - GetInteger(prefs::kDevToolsSplitLocation); |
| - if (split_offset != -1) { |
| - if (split_offset < kMinDevToolsHeight) |
| - split_offset = kMinDevToolsHeight; |
| - gtk_paned_set_position(GTK_PANED(contents_split_), split_offset); |
| - } else { |
| - gtk_widget_set_size_request(devtools_container_->widget(), -1, |
| - kDefaultDevToolsHeight); |
| - } |
| + |
| gtk_widget_show_all(render_area_floating_container_); |
| gtk_widget_hide(devtools_container_->widget()); |
| render_area_event_box_ = gtk_event_box_new(); |