Update how the Web Inspector resources are loaded.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Mar 2012 01:14:09 +0000 (01:14 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Mar 2012 01:14:09 +0000 (01:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=80798
rdar://problem/10359959

Reviewed by Brian Weinstein.

Source/WebKit:

* WebKit.xcodeproj/project.pbxproj: Add a framework.

Source/WebKit/mac:

* WebCoreSupport/WebInspectorClient.mm:
(useWebKitWebInspector): Return if we are using the WebCore resources for compatibility
with local and nightly builds.
(WebInspectorFrontendClient::localizedStringsURL): Decide what path to use.
(-[WebInspectorWindowController init]): Ditto.
(-[WebInspectorWindowController window]): Decide if the window is textured or not.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110403 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm

index d65b6b6..4f1cf58 100644 (file)
@@ -1,3 +1,14 @@
+2012-03-11  Timothy Hatcher  <timothy@apple.com>
+
+        Update how the Web Inspector resources are loaded.
+
+        https://bugs.webkit.org/show_bug.cgi?id=80798
+        rdar://problem/10359959
+
+        Reviewed by Brian Weinstein.
+
+        * WebKit.xcodeproj/project.pbxproj: Add a framework.
+
 2012-03-06  Raphael Kubo da Costa  <kubo@profusion.mobi>
 
         [CMake] Make the removal of transitive library dependencies work with CMake < 2.8.7.
index c8de755..bc993d9 100644 (file)
@@ -67,6 +67,7 @@
                1C7B0C660EB2464D00A28502 /* WebInspectorClientCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C7B0C650EB2464D00A28502 /* WebInspectorClientCF.cpp */; };
                1C8CB07A0AE9830C00B1F6E9 /* WebEditingDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C8CB0790AE9830C00B1F6E9 /* WebEditingDelegatePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1CCFFD130B1F81F2002EE926 /* OldWebAssertions.c in Sources */ = {isa = PBXBuildFile; fileRef = 1CCFFD120B1F81F2002EE926 /* OldWebAssertions.c */; };
+               1CE90729150D5DF0008B4AF7 /* WebInspector.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1CE90728150D5DF0008B4AF7 /* WebInspector.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
                224100F3091818D900D2D266 /* WebPluginsPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 224100F2091818D900D2D266 /* WebPluginsPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                224100F90918190100D2D266 /* WebPluginsPrivate.m in Sources */ = {isa = PBXBuildFile; fileRef = 224100F80918190100D2D266 /* WebPluginsPrivate.m */; };
                225F881509F97E8A00423A40 /* WebPluginPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 225F881409F97E8A00423A40 /* WebPluginPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1C904FD40BA9DD0F0081E9D0 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
                1C904FD50BA9DD0F0081E9D0 /* Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
                1CCFFD120B1F81F2002EE926 /* OldWebAssertions.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = OldWebAssertions.c; sourceTree = "<group>"; };
+               1CE90728150D5DF0008B4AF7 /* WebInspector.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebInspector.framework; sourceTree = BUILT_PRODUCTS_DIR; };
                224100F2091818D900D2D266 /* WebPluginsPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginsPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                224100F80918190100D2D266 /* WebPluginsPrivate.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebPluginsPrivate.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                225F881409F97E8A00423A40 /* WebPluginPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginPrivate.h; sourceTree = "<group>"; };
                                1A20D08B0ED384F20043FA9F /* QuartzCore.framework in Frameworks */,
                                9398112F0824BF01008DF038 /* Security.framework in Frameworks */,
                                9398112C0824BF01008DF038 /* WebCore.framework in Frameworks */,
+                               1CE90729150D5DF0008B4AF7 /* WebInspector.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                1A20D08A0ED384F20043FA9F /* QuartzCore.framework */,
                                830E81E005853AC000AD0891 /* Security.framework */,
                                F738C9EA03FAD3DF0321FBE0 /* WebCore.framework */,
+                               1CE90728150D5DF0008B4AF7 /* WebInspector.framework */,
                        );
                        name = "Frameworks and Libraries";
                        sourceTree = "<group>";
index 7619d1f..cdef8f9 100644 (file)
@@ -1,3 +1,19 @@
+2012-03-11  Timothy Hatcher  <timothy@apple.com>
+
+        Update how the Web Inspector resources are loaded.
+
+        https://bugs.webkit.org/show_bug.cgi?id=80798
+        rdar://problem/10359959
+
+        Reviewed by Brian Weinstein.
+
+        * WebCoreSupport/WebInspectorClient.mm:
+        (useWebKitWebInspector): Return if we are using the WebCore resources for compatibility
+        with local and nightly builds.
+        (WebInspectorFrontendClient::localizedStringsURL): Decide what path to use.
+        (-[WebInspectorWindowController init]): Ditto.
+        (-[WebInspectorWindowController window]): Decide if the window is textured or not.
+
 2012-03-09  Jon Lee  <jonlee@apple.com>
 
         Rename NotificationPresenter to NotificationClient
index 1775a26..0813f32 100644 (file)
@@ -160,10 +160,17 @@ void WebInspectorFrontendClient::frontendLoaded()
     setAttachedWindow(attached);
 }
 
+static bool useWebKitWebInspector()
+{
+    return [[NSUserDefaults standardUserDefaults] boolForKey:@"UseWebKitWebInspector"] ||
+        ![[NSBundle bundleWithIdentifier:@"com.apple.WebInspector"] pathForResource:@"Main" ofType:@"html"];
+}
+
 String WebInspectorFrontendClient::localizedStringsURL()
 {
-    NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"localizedStrings" ofType:@"js"];
-    if (path)
+    NSBundle *bundle = useWebKitWebInspector() ? [NSBundle bundleWithIdentifier:@"com.apple.WebCore"] : [NSBundle bundleWithIdentifier:@"com.apple.WebInspector"]; 
+    NSString *path = [bundle pathForResource:@"localizedStrings" ofType:@"js"];
+    if ([path length])
         return [[NSURL fileURLWithPath:path] absoluteString];
     return String();
 }
@@ -258,7 +265,14 @@ void WebInspectorFrontendClient::updateWindowTitle() const
 
     [preferences release];
 
-    NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"inspector" ofType:@"html" inDirectory:@"inspector"];
+    NSString *path;
+    if (useWebKitWebInspector())
+        path = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"inspector" ofType:@"html" inDirectory:@"inspector"];
+    else
+        path = [[NSBundle bundleWithIdentifier:@"com.apple.WebInspector"] pathForResource:@"Main" ofType:@"html"];
+
+    ASSERT([path length]);
+
     NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL fileURLWithPath:path]];
     [[_webView mainFrame] loadRequest:request];
     [request release];
@@ -295,18 +309,22 @@ void WebInspectorFrontendClient::updateWindowTitle() const
     if (window)
         return window;
 
+    bool useTexturedWindow = useWebKitWebInspector();
+
     NSUInteger styleMask = (NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask);
 
-    styleMask |= NSTexturedBackgroundWindowMask;
+    if (useTexturedWindow)
+        styleMask |= NSTexturedBackgroundWindowMask;
 
     window = [[NSWindow alloc] initWithContentRect:NSMakeRect(60.0, 200.0, 750.0, 650.0) styleMask:styleMask backing:NSBackingStoreBuffered defer:NO];
     [window setDelegate:self];
     [window setMinSize:NSMakeSize(400.0, 400.0)];
 
-    [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge];
-    [window setContentBorderThickness:55. forEdge:NSMaxYEdge];
-
-    WKNSWindowMakeBottomCornersSquare(window);
+    if (useTexturedWindow) {
+        [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge];
+        [window setContentBorderThickness:55. forEdge:NSMaxYEdge];
+        WKNSWindowMakeBottomCornersSquare(window);
+    }
 
     [self setWindow:window];
     [window release];