Remember the docked state of the Web Inspector, so it can be reopened docked if it...
[WebKit-https.git] / WebKit / mac / WebCoreSupport / WebInspectorClient.mm
index 889fd1f..73acdd6 100644 (file)
@@ -142,6 +142,7 @@ void WebInspectorClient::updateWindowTitle() const
 
 #pragma mark -
 
+#define WebKitInspectorAttachedKey @"WebKitInspectorAttached"
 #define WebKitInspectorAttachedViewHeightKey @"WebKitInspectorAttachedViewHeight"
 
 @implementation WebInspectorWindowController
@@ -175,6 +176,10 @@ void WebInspectorClient::updateWindowTitle() const
 
     [preferences release];
 
+    NSNumber *attached = [[NSUserDefaults standardUserDefaults] objectForKey:WebKitInspectorAttachedKey];
+    ASSERT(!attached || [attached isKindOfClass:[NSNumber class]]);
+    _shouldAttach = attached ? [attached boolValue] : YES;
+
     NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"inspector" ofType:@"html" inDirectory:@"inspector"];
     NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL fileURLWithPath:path]];
     [[_webView mainFrame] loadRequest:request];
@@ -318,7 +323,7 @@ void WebInspectorClient::updateWindowTitle() const
         [super showWindow:nil];
     }
 
-    [_inspectedWebView page]->inspectorController()->setWindowVisible(true);
+    [_inspectedWebView page]->inspectorController()->setWindowVisible(true, _shouldAttach);
 }
 
 #pragma mark -