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

Unified Diff: chrome/browser/ui/cocoa/dev_tools_controller.mm

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: comments addressed 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 | « no previous file | chrome/browser/ui/gtk/browser_window_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/dev_tools_controller.mm
diff --git a/chrome/browser/ui/cocoa/dev_tools_controller.mm b/chrome/browser/ui/cocoa/dev_tools_controller.mm
index c7a2c11d1f111b6872f563789ce3e205569ec99f..838d9fe7dd30f53ab4d6e5372bb54fdf5b5e4fa1 100644
--- a/chrome/browser/ui/cocoa/dev_tools_controller.mm
+++ b/chrome/browser/ui/cocoa/dev_tools_controller.mm
@@ -19,12 +19,10 @@
namespace {
-// Default offset of the contents splitter in pixels.
-const int kDefaultContentsSplitOffset = 400;
-
-// Never make the web part of the tab contents smaller than this (needed if the
-// window is only a few pixels high).
-const int kMinWebHeight = 50;
+// Minimal height of devtools pane or content pane when devtools are docked
+// to the browser window.
+const int kMinDevToolsHeight = 50;
+const int kMinContentsHeight = 50;
} // end namespace
@@ -100,10 +98,9 @@ const int kMinWebHeight = 50;
// Load the default split offset.
splitOffset = profile->GetPrefs()->
GetInteger(prefs::kDevToolsSplitLocation);
- if (splitOffset < 0) {
- // Initial load, set to default value.
- splitOffset = kDefaultContentsSplitOffset;
- }
+ if (splitOffset < 0)
+ splitOffset = NSHeight([[subviews objectAtIndex:0] frame]) * 2 / 3;
+
[splitView_ addSubview:[contentsController_ view]];
} else {
DCHECK_EQ([subviews count], 2u);
@@ -112,9 +109,12 @@ const int kMinWebHeight = 50;
}
// Make sure |splitOffset| isn't too large or too small.
- splitOffset = std::max(static_cast<CGFloat>(kMinWebHeight), splitOffset);
- splitOffset =
- std::min(splitOffset, NSHeight([splitView_ frame]) - kMinWebHeight);
+ splitOffset = std::min(NSHeight([splitView_ frame]) - kMinDevToolsHeight,
+ splitOffset);
+ splitOffset = std::max(static_cast<CGFloat>(kMinContentsHeight),
+ splitOffset);
+ if (splitOffset < 0)
+ splitOffset = NSHeight([[subviews objectAtIndex:0] frame]) * 2 / 3;
DCHECK_GE(splitOffset, 0) << "kMinWebHeight needs to be smaller than "
<< "smallest available tab contents space.";
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/browser_window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698