Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1795)

Unified Diff: chrome/browser/ui/gtk/browser_window_gtk.cc

Issue 7121012: DevTools window doesn't restore its minimal size if it's shrinked to zero. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..dd0cae2eae23ee26311924086e9083b83fb5f73d 100644
--- a/chrome/browser/ui/gtk/browser_window_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_window_gtk.cc
@@ -105,7 +105,7 @@ const int kLoadingAnimationFrameTimeMs = 30;
// matches the value in Views.
const int kDefaultDevToolsHeight = 200;
-const int kMinDevToolsHeight = 50;
+const int kMinDevToolsHeight = 100;
const char* kBrowserWindowKey = "__BROWSER_WINDOW_GTK__";
@@ -1299,13 +1299,18 @@ void BrowserWindowGtk::UpdateDevToolsForContents(TabContents* contents) {
bool should_show = old_devtools == NULL && devtools_contents != NULL;
bool should_hide = old_devtools != NULL && devtools_contents == NULL;
+ GtkAllocation devtools_rect;
+ gtk_widget_get_allocation(devtools_container_->widget(), &devtools_rect);
if (should_show) {
+ if (devtools_rect.height < kMinDevToolsHeight) {
+ gint split_offset = gtk_paned_get_position(GTK_PANED(contents_split_));
+ split_offset -= kMinDevToolsHeight - devtools_rect.height;
+ 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_));
browser_->profile()->GetPrefs()->
- SetInteger(prefs::kDevToolsSplitLocation, divider_offset);
+ SetInteger(prefs::kDevToolsWidgetHeight, devtools_rect.height);
gtk_widget_hide(devtools_container_->widget());
}
}
@@ -1686,17 +1691,26 @@ 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.
+
+ // split_location is obsolete property. It will never be updated.
+ // We just check it for backward compatibility.
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);
- }
+ GetInteger(prefs::kDevToolsSplitLocation);
pfeldman 2011/06/07 14:54:06 I'd suggest nuking the property and fixing all por
+
+ int devtools_height = browser_->profile()->GetPrefs()->
+ GetInteger(prefs::kDevToolsWidgetHeight);
+
+ if (devtools_height == -1 && split_offset == -1)
+ devtools_height = kDefaultDevToolsHeight;
+
+ if (devtools_height == -1)
+ devtools_height = bounds_.height() - split_offset;
+
+ devtools_height = std::max(devtools_height, kMinDevToolsHeight);
+ devtools_height = std::min(devtools_height, bounds_.height() * 2 / 3);
+ gtk_widget_set_size_request(devtools_container_->widget(), -1,
+ devtools_height);
+
gtk_widget_show_all(render_area_floating_container_);
gtk_widget_hide(devtools_container_->widget());
render_area_event_box_ = gtk_event_box_new();
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698