summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-11 15:00:29 +0000
committerrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-11 15:00:29 +0000
commit89b4fbf77e6e36efa7b10adce0f383ecbd00a034 (patch)
treed148ca3c88fc41a3852ba162c9a5f680f62e51d2 /chrome
parenta5bf861631098fa02ce32fc13615b47dcd0fbaee (diff)
downloadchromium_src-89b4fbf77e6e36efa7b10adce0f383ecbd00a034.zip
chromium_src-89b4fbf77e6e36efa7b10adce0f383ecbd00a034.tar.gz
chromium_src-89b4fbf77e6e36efa7b10adce0f383ecbd00a034.tar.bz2
[Mac] Do not resize devtools when showing if it is already open.
BUG=34494 TEST=Open devtools and resize. Right-click on the webpage and "Inspect element." Devtools should not resize to its original size. Review URL: http://codereview.chromium.org/565040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38770 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/cocoa/tab_contents_controller.mm21
1 files changed, 14 insertions, 7 deletions
diff --git a/chrome/browser/cocoa/tab_contents_controller.mm b/chrome/browser/cocoa/tab_contents_controller.mm
index 59dda16..b86186f 100644
--- a/chrome/browser/cocoa/tab_contents_controller.mm
+++ b/chrome/browser/cocoa/tab_contents_controller.mm
@@ -82,20 +82,27 @@ static const int kMinWebHeight = 50;
NSArray* subviews = [contentsContainer_ subviews];
if (devToolsContents) {
DCHECK_GE([subviews count], 1u);
+
+ // Load the default split offset. If we are already showing devtools, we
+ // will replace the default with the current devtools height.
+ CGFloat splitOffset = g_browser_process->local_state()->GetInteger(
+ prefs::kDevToolsSplitLocation);
+ if (splitOffset == -1) {
+ // Initial load, set to default value.
+ splitOffset = kDefaultContentsSplitOffset;
+ }
+
if ([subviews count] == 1) {
[contentsContainer_ addSubview:devToolsContents->GetNativeView()];
} else {
DCHECK_EQ([subviews count], 2u);
[contentsContainer_ replaceSubview:[subviews objectAtIndex:1]
with:devToolsContents->GetNativeView()];
+ // If devtools are already visible, keep the current size.
+ splitOffset = NSHeight([devToolsContents->GetNativeView() frame]);
}
- // Restore split offset.
- CGFloat splitOffset = g_browser_process->local_state()->GetInteger(
- prefs::kDevToolsSplitLocation);
- if (splitOffset == -1) {
- // Initial load, set to default value.
- splitOffset = kDefaultContentsSplitOffset;
- }
+
+ // Make sure |splitOffset| isn't too large or too small.
splitOffset = MIN(splitOffset,
NSHeight([contentsContainer_ frame]) - kMinWebHeight);
DCHECK_GE(splitOffset, 0) << "kMinWebHeight needs to be smaller than "