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 47345c7af5e33eaba9a0d7304d9c160f717608c0..25e5a5dbd6cf90bc34fc7ad4cdac1c0179131d77 100644 |
--- a/chrome/browser/ui/gtk/browser_window_gtk.cc |
+++ b/chrome/browser/ui/gtk/browser_window_gtk.cc |
@@ -225,7 +225,6 @@ BrowserWindowGtk::BrowserWindowGtk(Browser* browser) |
toolbar_border_(NULL), |
browser_(browser), |
state_(GDK_WINDOW_STATE_WITHDRAWN), |
- devtools_dock_side_(DEVTOOLS_DOCK_SIDE_BOTTOM), |
devtools_window_(NULL), |
contents_hsplit_(NULL), |
contents_vsplit_(NULL), |
@@ -2274,12 +2273,6 @@ void BrowserWindowGtk::UpdateDevToolsForContents(WebContents* contents) { |
DevToolsWindow* new_devtools_window = contents ? |
DevToolsWindow::GetDockedInstanceForInspectedTab(contents) : NULL; |
- // Fast return in case of the same window having same orientation. |
- if (devtools_window_ == new_devtools_window && (!new_devtools_window || |
- new_devtools_window->dock_side() == devtools_dock_side_)) { |
- return; |
- } |
- |
// Replace tab contents. |
if (devtools_window_ != new_devtools_window) { |
if (devtools_window_) |
@@ -2295,29 +2288,9 @@ void BrowserWindowGtk::UpdateDevToolsForContents(WebContents* contents) { |
} |
} |
- // Store last used position. |
- if (devtools_window_) { |
- GtkAllocation contents_rect; |
- gtk_widget_get_allocation(contents_vsplit_, &contents_rect); |
- int split_size; |
- if (devtools_dock_side_ == DEVTOOLS_DOCK_SIDE_RIGHT) { |
- gtk_widget_style_get(contents_hsplit_, "handle-size", &split_size, NULL); |
- devtools_window_->SetWidth( |
- contents_rect.width - split_size - |
- gtk_paned_get_position(GTK_PANED(contents_hsplit_))); |
- } else if (devtools_dock_side_ == DEVTOOLS_DOCK_SIDE_BOTTOM) { |
- gtk_widget_style_get(contents_vsplit_, "handle-size", &split_size, NULL); |
- devtools_window_->SetHeight( |
- contents_rect.height - split_size - |
- gtk_paned_get_position(GTK_PANED(contents_vsplit_))); |
- } |
- } |
- |
- // Show / hide container if necessary. Changing dock orientation is |
- // hide + show. |
- bool should_hide = devtools_window_ && (!new_devtools_window || |
- devtools_dock_side_ != new_devtools_window->dock_side()); |
- bool should_show = new_devtools_window && (!devtools_window_ || should_hide); |
+ // Show / hide container if necessary. |
+ bool should_hide = devtools_window_ && !new_devtools_window; |
+ bool should_show = new_devtools_window && !devtools_window_; |
if (should_hide) |
HideDevToolsContainer(); |
@@ -2325,7 +2298,6 @@ void BrowserWindowGtk::UpdateDevToolsForContents(WebContents* contents) { |
devtools_window_ = new_devtools_window; |
if (should_show) { |
- devtools_dock_side_ = new_devtools_window->dock_side(); |
ShowDevToolsContainer(); |
} else if (new_devtools_window) { |
UpdateDevToolsSplitPosition(); |
@@ -2333,31 +2305,20 @@ void BrowserWindowGtk::UpdateDevToolsForContents(WebContents* contents) { |
} |
void BrowserWindowGtk::ShowDevToolsContainer() { |
- if (devtools_dock_side_ == DEVTOOLS_DOCK_SIDE_MINIMIZED) { |
- gtk_box_pack_end(GTK_BOX(render_area_vbox_), |
- devtools_container_->widget(), FALSE, FALSE, 0); |
- gtk_box_reorder_child(GTK_BOX(render_area_vbox_), |
- devtools_container_->widget(), 0); |
- } else { |
- gtk_widget_set_size_request(devtools_container_->widget(), |
- devtools_window_->GetMinimumWidth(), |
- devtools_window_->GetMinimumHeight()); |
- bool to_right = devtools_dock_side_ == DEVTOOLS_DOCK_SIDE_RIGHT; |
- gtk_paned_pack2(GTK_PANED(to_right ? contents_hsplit_ : contents_vsplit_), |
- devtools_container_->widget(), |
- FALSE, |
- FALSE); |
- } |
+ gtk_widget_set_size_request(devtools_container_->widget(), |
+ devtools_window_->GetMinimumSize().width(), |
+ devtools_window_->GetMinimumSize().height()); |
+ gtk_paned_pack2(GTK_PANED(contents_vsplit_), |
+ devtools_container_->widget(), |
+ FALSE, |
+ FALSE); |
UpdateDevToolsSplitPosition(); |
gtk_widget_show(devtools_container_->widget()); |
} |
void BrowserWindowGtk::HideDevToolsContainer() { |
- gtk_container_remove(GTK_CONTAINER( |
- devtools_dock_side_ == DEVTOOLS_DOCK_SIDE_RIGHT ? contents_hsplit_ : |
- devtools_dock_side_ == DEVTOOLS_DOCK_SIDE_BOTTOM ? contents_vsplit_ : |
- render_area_vbox_), |
- devtools_container_->widget()); |
+ gtk_container_remove(GTK_CONTAINER(contents_vsplit_), |
+ devtools_container_->widget()); |
gtk_widget_hide(devtools_container_->widget()); |
} |
@@ -2372,21 +2333,9 @@ void BrowserWindowGtk::UpdateDevToolsSplitPosition() { |
GtkAllocation contents_rect; |
gtk_widget_get_allocation(contents_vsplit_, &contents_rect); |
int split_size; |
- |
- if (devtools_window_->dock_side() == DEVTOOLS_DOCK_SIDE_RIGHT) { |
- gtk_widget_style_get(contents_hsplit_, "handle-size", &split_size, NULL); |
- int split_offset = contents_rect.width - |
- devtools_window_->GetWidth(contents_rect.width) - split_size; |
- gtk_paned_set_position(GTK_PANED(contents_hsplit_), split_offset); |
- } else if (devtools_window_->dock_side() == DEVTOOLS_DOCK_SIDE_BOTTOM) { |
- gtk_widget_style_get(contents_vsplit_, "handle-size", &split_size, NULL); |
- int split_offset = contents_rect.height - |
- devtools_window_->GetHeight(contents_rect.height) - split_size; |
- gtk_paned_set_position(GTK_PANED(contents_vsplit_), split_offset); |
- } else { |
- gtk_widget_set_size_request(devtools_container_->widget(), |
- 0, devtools_window_->GetMinimizedHeight()); |
- } |
+ gtk_widget_style_get(contents_vsplit_, "handle-size", &split_size, NULL); |
+ int split_offset = (contents_rect.height - split_size) / 2; |
+ gtk_paned_set_position(GTK_PANED(contents_vsplit_), split_offset); |
} |
void BrowserWindowGtk::OnUseCustomChromeFrameChanged() { |