WebCore:
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Oct 2007 21:26:19 +0000 (21:26 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Oct 2007 21:26:19 +0000 (21:26 +0000)
        Reviewed by John Sullivan.

        - Allow showing and closing the inspector programatically.
        - Add showConsole() and showTimeline() methods.

        * WebCore.base.exp: Add exports for WebKit.
        * page/InspectorController.cpp:
        (WebCore::callSimpleFunction): Renamed from callClearFunction().
        (WebCore::unloading): Renamed to close().
        (WebCore::InspectorController::InspectorController):
        (WebCore::InspectorController::inspect): Moved showing code to show().
        (WebCore::InspectorController::setWindowVisible): Show the timeline or console if needed.
        (WebCore::InspectorController::show): Code factored out of inspect().
        (WebCore::InspectorController::showConsole): Call show() and the JS showConsole().
        (WebCore::InspectorController::showTimeline): Call show() and the JS showTimeline().
        (WebCore::InspectorController::close):
        (WebCore::InspectorController::clearScriptResources): Call the new callSimpleFunction.
        (WebCore::InspectorController::clearDatabaseScriptResources): Ditto.
        (WebCore::InspectorController::clearScriptConsoleMessages): Ditto.
        (WebCore::InspectorController::clearNetworkTimeline): Ditto.
        * page/InspectorController.h: Add and rename methods.
        * page/inspector/inspector.js: Add showConsole() and showTimeline().

WebKit:

        Reviewed by John Sullivan.

        Various semi-related changes:
        - A WebView can now be asked for it's WebInspector. There is one
          WebInspector per WebView.
        - Refactor the WebInspector class and move obsolete methods to
          a special category.
        - Add new WebInspector methods to show, hide and show the
          console/timeline panels.
        - Add an isDisabled method to WebCache.
        - Allow WebLocalizableStrings.h to be used in C files.

        * Misc/WebCache.h: Add isDisabled.
        * Misc/WebCache.mm:
        (+[WebCache isDisabled]): New method.

        * Misc/WebLocalizableStrings.h: Changes to allow use in plain C files.

        * WebCoreSupport/WebInspectorClient.mm:
        (-[WebInspectorWindowController showWindow:]): Call super if already visible
          so the window will be ordered front.
        (-[WebInspectorWindowController showWebInspector:]): Method used by menu items,
          so they are enabled and work when the Inspector window is key.
        (-[WebInspectorWindowController showErrorConsole:]): Ditto.
        (-[WebInspectorWindowController showNetworkTimeline:]): Ditto.

        * WebInspector/WebInspector.h: Add and remove methods.
        * WebInspector/WebInspector.mm:
        (-[WebInspector webViewClosed]): Called when the WebView is closed/dealloced.
          Clears the _webView pointer.
        (-[WebInspector show:]): Calls thru to the Page's InspectorController.
        (-[WebInspector showConsole:]): Ditto.
        (-[WebInspector showTimeline:]): Ditto.
        (-[WebInspector close:]): Ditto.
        (-[WebInspector attach:]): Ditto.
        (-[WebInspector detach:]): Ditto.
        (+[WebInspector sharedWebInspector]): Moved to the obsolete category.
        (+[WebInspector webInspector]): Ditto.
        (-[WebInspector setWebFrame:]): Ditto.
        (-[WebInspector window]): Ditto.
        (-[WebInspector showWindow:]): Ditto.

        * WebView/WebView.mm:
        (-[WebViewPrivate dealloc]): Release the WebInspector.
        (-[WebView _close]): Call webViewClosed on the WebInspector.
        (-[WebView inspector]): Create a WebInspector if needed and return it.
        * WebView/WebViewPrivate.h: Add the inspector method.

WebKitTools:

        Reviewed by John Sullivan.

        - Place the Localizable.strings file in mac or win directories
          if that location exists.
        - Also look for UI_STRING in .c files.

        * Scripts/extract-localizable-strings:

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

17 files changed:
WebCore/ChangeLog
WebCore/WebCore.base.exp
WebCore/page/Chrome.cpp
WebCore/page/InspectorController.cpp
WebCore/page/InspectorController.h
WebCore/page/inspector/inspector.js
WebKit/ChangeLog
WebKit/Misc/WebCache.h
WebKit/Misc/WebCache.mm
WebKit/Misc/WebLocalizableStrings.h
WebKit/WebCoreSupport/WebInspectorClient.mm
WebKit/WebInspector/WebInspector.h
WebKit/WebInspector/WebInspector.mm
WebKit/WebView/WebView.mm
WebKit/WebView/WebViewPrivate.h
WebKitTools/ChangeLog
WebKitTools/Scripts/extract-localizable-strings

index 1acee3c..e78dc18 100644 (file)
@@ -1,3 +1,28 @@
+2007-10-29  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by John Sullivan.
+
+        - Allow showing and closing the inspector programatically.
+        - Add showConsole() and showTimeline() methods. 
+
+        * WebCore.base.exp: Add exports for WebKit.
+        * page/InspectorController.cpp:
+        (WebCore::callSimpleFunction): Renamed from callClearFunction().
+        (WebCore::unloading): Renamed to close().
+        (WebCore::InspectorController::InspectorController):
+        (WebCore::InspectorController::inspect): Moved showing code to show().
+        (WebCore::InspectorController::setWindowVisible): Show the timeline or console if needed.
+        (WebCore::InspectorController::show): Code factored out of inspect().
+        (WebCore::InspectorController::showConsole): Call show() and the JS showConsole().
+        (WebCore::InspectorController::showTimeline): Call show() and the JS showTimeline().
+        (WebCore::InspectorController::close):
+        (WebCore::InspectorController::clearScriptResources): Call the new callSimpleFunction.
+        (WebCore::InspectorController::clearDatabaseScriptResources): Ditto.
+        (WebCore::InspectorController::clearScriptConsoleMessages): Ditto.
+        (WebCore::InspectorController::clearNetworkTimeline): Ditto.
+        * page/InspectorController.h: Add and rename methods.
+        * page/inspector/inspector.js: Add showConsole() and showTimeline().
+
 2007-10-30  Adele Peterson  <adele@apple.com>
 
         Reviewed by Sam.
index 1a67d59..8836e41 100644 (file)
@@ -322,7 +322,13 @@ __ZN7WebCore16NavigationActionC1ERKNS_4KURLENS_14NavigationTypeE
 __ZN7WebCore16NavigationActionC1Ev
 __ZN7WebCore16colorFromNSColorEP7NSColor
 __ZN7WebCore18PlatformMouseEventC1EP7NSEvent
+__ZN7WebCore19InspectorController11showConsoleEv
+__ZN7WebCore19InspectorController12attachWindowEv
+__ZN7WebCore19InspectorController12detachWindowEv
+__ZN7WebCore19InspectorController12showTimelineEv
 __ZN7WebCore19InspectorController16setWindowVisibleEb
+__ZN7WebCore19InspectorController4showEv
+__ZN7WebCore19InspectorController5closeEv
 __ZN7WebCore19InspectorController7inspectEPNS_4NodeE
 __ZN7WebCore19SelectionController16setSelectedRangeEPNS_5RangeENS_9EAffinityEbRi
 __ZN7WebCore19SelectionController5clearEv
index 4fd0567..c4ca35d 100644 (file)
@@ -200,8 +200,7 @@ void Chrome::addMessageToConsole(MessageSource source, MessageLevel level, const
     if (source == JSMessageSource)
         m_client->addMessageToConsole(message, lineNumber, sourceID);
 
-    if (InspectorController* inspector = m_page->inspectorController())
-        inspector->addMessageToConsole(source, level, message, lineNumber, sourceID);
+    m_page->inspectorController()->addMessageToConsole(source, level, message, lineNumber, sourceID);
 }
 
 bool Chrome::canRunBeforeUnloadConfirmPanel()
index 7cce3a0..617cac9 100644 (file)
 
 namespace WebCore {
 
+static void callSimpleFunction(JSContextRef context, JSObjectRef thisObject, const char* functionName)
+{
+    ASSERT_ARG(context, context);
+    ASSERT_ARG(thisObject, thisObject);
+
+    JSStringRef string = JSStringCreateWithUTF8CString(functionName);
+    JSObjectRef function = JSValueToObject(context, JSObjectGetProperty(context, thisObject, string, 0), 0);
+    JSStringRelease(string);
+
+    JSObjectCallAsFunction(context, function, thisObject, 0, 0, 0);
+}
+
 struct ConsoleMessage {
     ConsoleMessage(MessageSource s, MessageLevel l, const String& m, unsigned li, const String& u)
         : source(s)
@@ -389,7 +401,7 @@ static JSValueRef unloading(JSContextRef ctx, JSObjectRef /*function*/, JSObject
     if (!controller)
         return JSValueMakeUndefined(ctx);
 
-    controller->windowUnloading();
+    controller->close();
     return JSValueMakeUndefined(ctx);
 }
 
@@ -539,6 +551,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* client)
     , m_controllerScriptObject(0)
     , m_scriptContext(0)
     , m_windowVisible(false)
+    , m_showAfterVisible(FocusedNodeDocumentPanel)
     , m_nextIdentifier(-2)
 {
     ASSERT_ARG(page, page);
@@ -575,25 +588,19 @@ void InspectorController::inspect(Node* node)
     if (!node || !enabled())
         return;
 
-    if (!m_page) {
-        m_page = m_client->createPage();
-        if (!m_page)
-            return;
-
-        m_page->setParentInspectorController(this);
-    }
+    show();
 
     if (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE)
         node = node->parentNode();
     m_nodeToFocus = node;
 
-    if (!m_scriptObject)
+    if (!m_scriptObject) {
+        m_showAfterVisible = FocusedNodeDocumentPanel;
         return;
+    }
 
     if (windowVisible())
         focusNode();
-    else
-        m_client->showWindow();
 }
 
 void InspectorController::focusNode()
@@ -656,12 +663,18 @@ void InspectorController::setWindowVisible(bool visible)
         populateScriptResources();
         if (m_nodeToFocus)
             focusNode();
+        if (m_showAfterVisible == ConsolePanel)
+            showConsole();
+        else if (m_showAfterVisible == TimelinePanel)
+            showTimeline();
     } else {
         clearScriptResources();
         clearScriptConsoleMessages();
         clearDatabaseScriptResources();
         clearNetworkTimeline();
     }
+
+    m_showAfterVisible = FocusedNodeDocumentPanel;
 }
 
 void InspectorController::addMessageToConsole(MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID)
@@ -760,8 +773,59 @@ void InspectorController::scriptObjectReady()
     m_client->showWindow();
 }
 
-void InspectorController::windowUnloading()
+void InspectorController::show()
+{
+    if (!enabled())
+        return;
+
+    if (!m_page) {
+        m_page = m_client->createPage();
+        if (!m_page)
+            return;
+        m_page->setParentInspectorController(this);
+
+        // m_client->showWindow() will be called after the page loads in scriptObjectReady()
+        return;
+    }
+
+    m_client->showWindow();
+}
+
+void InspectorController::showConsole()
+{
+    if (!enabled())
+        return;
+
+    show();
+
+    if (!m_scriptObject) {
+        m_showAfterVisible = ConsolePanel;
+        return;
+    }
+
+    callSimpleFunction(m_scriptContext, m_scriptObject, "showConsole");
+}
+
+void InspectorController::showTimeline()
 {
+    if (!enabled())
+        return;
+
+    show();
+
+    if (!m_scriptObject) {
+        m_showAfterVisible = TimelinePanel;
+        return;
+    }
+
+    callSimpleFunction(m_scriptContext, m_scriptObject, "showTimeline");
+}
+
+void InspectorController::close()
+{
+    if (!enabled())
+        return;
+
     m_client->closeWindow();
     if (m_page)
         m_page->setParentInspectorController(0);
@@ -1199,18 +1263,6 @@ void InspectorController::addScriptConsoleMessage(const ConsoleMessage* message)
     JSObjectCallAsFunction(m_scriptContext, addMessage, m_scriptObject, 1, &messageObject, 0);
 }
 
-static void callClearFunction(JSContextRef context, JSObjectRef thisObject, const char* functionName)
-{
-    ASSERT_ARG(context, context);
-    ASSERT_ARG(thisObject, thisObject);
-
-    JSStringRef string = JSStringCreateWithUTF8CString(functionName);
-    JSObjectRef function = JSValueToObject(context, JSObjectGetProperty(context, thisObject, string, 0), 0);
-    JSStringRelease(string);
-
-    JSObjectCallAsFunction(context, function, thisObject, 0, 0, 0);
-}
-
 void InspectorController::clearScriptResources()
 {
     if (!m_scriptContext || !m_scriptObject)
@@ -1222,7 +1274,7 @@ void InspectorController::clearScriptResources()
         resource->setScriptObject(0, 0);
     }
 
-    callClearFunction(m_scriptContext, m_scriptObject, "clearResources");
+    callSimpleFunction(m_scriptContext, m_scriptObject, "clearResources");
 }
 
 void InspectorController::clearDatabaseScriptResources()
@@ -1237,7 +1289,7 @@ void InspectorController::clearDatabaseScriptResources()
         resource->setScriptObject(0, 0);
     }
 
-    callClearFunction(m_scriptContext, m_scriptObject, "clearDatabaseResources");
+    callSimpleFunction(m_scriptContext, m_scriptObject, "clearDatabaseResources");
 #endif
 }
 
@@ -1246,7 +1298,7 @@ void InspectorController::clearScriptConsoleMessages()
     if (!m_scriptContext || !m_scriptObject)
         return;
 
-    callClearFunction(m_scriptContext, m_scriptObject, "clearConsoleMessages");
+    callSimpleFunction(m_scriptContext, m_scriptObject, "clearConsoleMessages");
 }
 
 void InspectorController::clearNetworkTimeline()
@@ -1254,7 +1306,7 @@ void InspectorController::clearNetworkTimeline()
     if (!m_scriptContext || !m_scriptObject)
         return;
 
-    callClearFunction(m_scriptContext, m_scriptObject, "clearNetworkTimeline");
+    callSimpleFunction(m_scriptContext, m_scriptObject, "clearNetworkTimeline");
 }
 
 void InspectorController::pruneResources(ResourcesMap* resourceMap, DocumentLoader* loaderToKeep)
index 5bae5fa..cac9f3d 100644 (file)
@@ -55,6 +55,12 @@ public:
     typedef HashMap<RefPtr<Frame>, ResourcesMap*> FrameResourcesMap;
     typedef HashSet<RefPtr<InspectorDatabaseResource> > DatabaseResourcesSet;
 
+    typedef enum {
+        FocusedNodeDocumentPanel,
+        ConsolePanel,
+        TimelinePanel
+    } SpecialPanels;
+
     InspectorController(Page*, InspectorClient*);
     ~InspectorController();
 
@@ -68,6 +74,11 @@ public:
     void highlight(Node*);
     void hideHighlight();
 
+    void show();
+    void showConsole();
+    void showTimeline();
+    void close();
+
     bool windowVisible();
     void setWindowVisible(bool visible = true);
 
@@ -82,7 +93,6 @@ public:
     void windowScriptObjectAvailable();
 
     void scriptObjectReady();
-    void windowUnloading();
 
     void populateScriptResources();
     void clearScriptResources();
@@ -150,6 +160,7 @@ private:
     JSObjectRef m_controllerScriptObject;
     JSContextRef m_scriptContext;
     bool m_windowVisible;
+    SpecialPanels m_showAfterVisible;
     long long m_nextIdentifier;
 };
 
index 02cf552..183de02 100644 (file)
@@ -567,6 +567,18 @@ WebInspector.updateBackForwardButtons = function()
     document.getElementById("forward").disabled = index >= this.backForwardList.length - 1;
 }
 
+WebInspector.showConsole = function()
+{
+    this.showingStatusArea = true;
+    this.navigateToPanel(WebInspector.consolePanel);
+}
+
+WebInspector.showTimeline = function()
+{
+    this.showingStatusArea = true;
+    this.navigateToPanel(WebInspector.networkPanel);
+}
+
 WebInspector.addResource = function(resource)
 {
     this.resources.push(resource);
index acbc5bb..fdcf1f0 100644 (file)
@@ -1,3 +1,53 @@
+2007-10-29  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by John Sullivan.
+
+        Various semi-related changes:
+        - A WebView can now be asked for it's WebInspector. There is one
+          WebInspector per WebView. 
+        - Refactor the WebInspector class and move obsolete methods to
+          a special category.
+        - Add new WebInspector methods to show, hide and show the
+          console/timeline panels.
+        - Add an isDisabled method to WebCache.
+        - Allow WebLocalizableStrings.h to be used in C files.
+
+        * Misc/WebCache.h: Add isDisabled.
+        * Misc/WebCache.mm:
+        (+[WebCache isDisabled]): New method.
+
+        * Misc/WebLocalizableStrings.h: Changes to allow use in plain C files.
+
+        * WebCoreSupport/WebInspectorClient.mm:
+        (-[WebInspectorWindowController showWindow:]): Call super if already visible
+          so the window will be ordered front.
+        (-[WebInspectorWindowController showWebInspector:]): Method used by menu items,
+          so they are enabled and work when the Inspector window is key.
+        (-[WebInspectorWindowController showErrorConsole:]): Ditto.
+        (-[WebInspectorWindowController showNetworkTimeline:]): Ditto.
+
+        * WebInspector/WebInspector.h: Add and remove methods.
+        * WebInspector/WebInspector.mm:
+        (-[WebInspector webViewClosed]): Called when the WebView is closed/dealloced.
+          Clears the _webView pointer.
+        (-[WebInspector show:]): Calls thru to the Page's InspectorController.
+        (-[WebInspector showConsole:]): Ditto.
+        (-[WebInspector showTimeline:]): Ditto.
+        (-[WebInspector close:]): Ditto.
+        (-[WebInspector attach:]): Ditto.
+        (-[WebInspector detach:]): Ditto.
+        (+[WebInspector sharedWebInspector]): Moved to the obsolete category.
+        (+[WebInspector webInspector]): Ditto.
+        (-[WebInspector setWebFrame:]): Ditto.
+        (-[WebInspector window]): Ditto.
+        (-[WebInspector showWindow:]): Ditto.
+
+        * WebView/WebView.mm:
+        (-[WebViewPrivate dealloc]): Release the WebInspector.
+        (-[WebView _close]): Call webViewClosed on the WebInspector.
+        (-[WebView inspector]): Create a WebInspector if needed and return it.
+        * WebView/WebViewPrivate.h: Add the inspector method.
+
 2007-10-30  Adele Peterson  <adele@apple.com>
 
         Reviewed by Darin.
index 1aa5831..1b5662b 100644 (file)
@@ -30,5 +30,6 @@
 + (NSArray *)statistics;
 + (void)empty;
 + (void)setDisabled:(BOOL)disabled;
++ (BOOL)isDisabled;
 
 @end
index e36e73b..e17ab33 100644 (file)
@@ -74,4 +74,9 @@
     WebCore::cache()->setDisabled(disabled);
 }
 
++ (BOOL)isDisabled
+{
+    return WebCore::cache()->disabled();
+}
+
 @end
index de4ae03..ecad83d 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import <Foundation/Foundation.h>
+#if __OBJC__
+@class NSBundle;
+#else
+typedef struct NSBundle NSBundle;
+#endif
 
 typedef struct {
     const char *identifier;
@@ -37,7 +41,11 @@ typedef struct {
 extern "C" {
 #endif
 
+#if __OBJC__
 NSString *WebLocalizedString(WebLocalizableStringsBundle *bundle, const char *key);
+#else
+CFStringRef WebLocalizedString(WebLocalizableStringsBundle *bundle, const char *key);
+#endif
 
 #ifdef __cplusplus
 }
index be3ab1b..c3c02f6 100644 (file)
@@ -293,8 +293,11 @@ void WebInspectorClient::updateWindowTitle() const
 
 - (IBAction)showWindow:(id)sender
 {
-    if (_visible)
+    if (_visible) {
+        if (!_attachedToInspectedWebView)
+            [super showWindow:sender]; // call super so the window will be ordered front if needed
         return;
+    }
 
     _visible = YES;
 
@@ -471,4 +474,25 @@ void WebInspectorClient::updateWindowTitle() const
     }
 }
 
+
+#pragma mark -
+
+// These methods can be used by UI elements such as menu items and toolbar buttons when the inspector is the key window.
+
+// This method is really only implemented to keep any UI elements enabled.
+- (void)showWebInspector:(id)sender
+{
+    [_inspectedWebView page]->inspectorController()->show();
+}
+
+- (void)showErrorConsole:(id)sender
+{
+    [_inspectedWebView page]->inspectorController()->showConsole();
+}
+
+- (void)showNetworkTimeline:(id)sender
+{
+    [_inspectedWebView page]->inspectorController()->showTimeline();
+}
+
 @end
index 045267c..ba4911a 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import <Foundation/Foundation.h>
+#import <Foundation/NSObject.h>
 
-@class WebFrame;
 @class WebView;
 
 @interface WebInspector : NSObject
 {
     WebView *_webView;
 }
-+ (WebInspector *)sharedWebInspector;
-+ (WebInspector *)webInspector;
-- (void)setWebFrame:(WebFrame*)frame;
-- (void)showWindow:(id)sender;
+- (id)initWithWebView:(WebView *)webView;
+- (void)webViewClosed;
+- (void)show:(id)sender;
+- (void)showConsole:(id)sender;
+- (void)showTimeline:(id)sender;
+- (void)close:(id)sender;
+- (void)attach:(id)sender;
+- (void)detach:(id)sender;
 @end
index 24df467..352f7a1 100644 (file)
 using namespace WebCore;
 
 @implementation WebInspector
+- (id)initWithWebView:(WebView *)webView
+{
+    if (!(self = [super init]))
+        return nil;
+    _webView = webView; // not retained to prevent a cycle
+    return self;
+}
 
-// This method name is used by the Safari 3 beta
-+ (WebInspector *)sharedWebInspector
+- (void)webViewClosed
 {
-    return [self webInspector];
+    _webView = nil;
 }
 
-+ (WebInspector *)webInspector
+- (void)show:(id)sender
+{
+    if (Page* page = core(_webView))
+        page->inspectorController()->show();
+}
+
+- (void)showConsole:(id)sender
 {
+    if (Page* page = core(_webView))
+        page->inspectorController()->showConsole();
+}
+
+- (void)showTimeline:(id)sender
+{
+    if (Page* page = core(_webView))
+        page->inspectorController()->showTimeline();
+}
+
+- (void)close:(id)sender 
+{
+    if (Page* page = core(_webView))
+        page->inspectorController()->close();
+}
+
+- (void)attach:(id)sender
+{
+    if (Page* page = core(_webView))
+        page->inspectorController()->attachWindow();
+}
+
+- (void)detach:(id)sender
+{
+    if (Page* page = core(_webView))
+        page->inspectorController()->detachWindow();
+}
+@end
+
+@implementation WebInspector (Obsolete)
++ (WebInspector *)sharedWebInspector
+{
+    // Safari 3 beta calls this method
+    static BOOL logged = NO;
+    if (!logged) {
+        NSLog(@"+[WebInspector sharedWebInspector]: this method is obsolete.");
+        logged = YES;
+    }
+
     return [[[WebInspector alloc] init] autorelease];
 }
 
-- (void)dealloc
++ (WebInspector *)webInspector
 {
-    [_webView release];
-    [super dealloc];
+    // Safari 3 beta calls this method
+    static BOOL logged = NO;
+    if (!logged) {
+        NSLog(@"+[WebInspector webInspector]: this method is obsolete.");
+        logged = YES;
+    }
+
+    return [[[WebInspector alloc] init] autorelease];
 }
 
 - (void)setWebFrame:(WebFrame *)frame
 {
-    [_webView release];
-    _webView = [[frame webView] retain];
+    // Safari 3 beta calls this method
+    static BOOL logged = NO;
+    if (!logged) {
+        NSLog(@"-[WebInspector setWebFrame:]: this method is obsolete.");
+        logged = YES;
+    }
+
+    _webView = [frame webView];
 }
 
 - (NSWindow *)window
@@ -67,7 +130,7 @@ using namespace WebCore;
     // Shiira calls this internal method, return nil since we can't easily return the window
     static BOOL logged = NO;
     if (!logged) {
-        NSLog(@"-[WebInspector window]: this method is obsolete and now returns nil. The WebInspector class will be removed in a future release.");
+        NSLog(@"-[WebInspector window]: this method is obsolete and now returns nil.");
         logged = YES;
     }
 
@@ -76,8 +139,13 @@ using namespace WebCore;
 
 - (void)showWindow:(id)sender
 {
-    if (Page* page = core(_webView))
-        if (InspectorController* inspectorController = page->inspectorController())
-            inspectorController->inspect(page->mainFrame()->document());
+    // Safari 3 beta calls this method
+    static BOOL logged = NO;
+    if (!logged) {
+        NSLog(@"-[WebInspector showWindow:]: this method is obsolete.");
+        logged = YES;
+    }
+
+    [self show:sender];
 }
 @end
index 1426c6e..081c5be 100644 (file)
@@ -60,6 +60,7 @@
 #import "WebHistoryItemInternal.h"
 #import "WebIconDatabase.h"
 #import "WebIconDatabaseInternal.h"
+#import "WebInspector.h"
 #import "WebInspectorClient.h"
 #import "WebKitErrors.h"
 #import "WebKitLogging.h"
@@ -294,6 +295,8 @@ static int pluginDatabaseClientCount = 0;
     id scriptDebugDelegate;
     id scriptDebugDelegateForwarder;
 
+    WebInspector *inspector;
+
     BOOL allowsUndo;
         
     float textSizeMultiplier;
@@ -466,6 +469,7 @@ static BOOL grammarCheckingEnabled;
     [applicationNameForUserAgent release];
     [backgroundColor release];
     
+    [inspector release];
     [hostWindow release];
 
     [policyDelegateForwarder release];
@@ -696,7 +700,9 @@ static bool debugWidget = true;
     [self setResourceLoadDelegate:nil];
     [self setScriptDebugDelegate:nil];
     [self setUIDelegate:nil];
-    
+
+    [_private->inspector webViewClosed];
+
     // setHostWindow:nil must be called before this value is set (see 5408186)
     _private->closed = YES;
 
@@ -788,6 +794,13 @@ static bool debugWidget = true;
     return newWindowWebView;
 }
 
+- (WebInspector *)inspector
+{
+    if (!_private->inspector)
+        _private->inspector = [[WebInspector alloc] initWithWebView:self];
+    return _private->inspector;
+}
+
 - (WebCore::Page*)page
 {
     return _private->page;
index e312494..9885097 100644 (file)
@@ -39,6 +39,7 @@
 
 @class NSError;
 @class WebFrame;
+@class WebInspector;
 @class WebPreferences;
 
 @protocol WebFormDelegate;
@@ -152,6 +153,8 @@ typedef enum {
 + (BOOL)_developerExtrasEnabled;
 + (BOOL)_scriptDebuggerEnabled;
 
+- (WebInspector *)inspector;
+
 /*!
     @method setBackgroundColor:
     @param backgroundColor Color to use as the default background.
index a1272d5..27a49b7 100644 (file)
@@ -1,3 +1,13 @@
+2007-10-29  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by John Sullivan.
+        
+        - Place the Localizable.strings file in mac or win directories
+          if that location exists.
+        - Also look for UI_STRING in .c files.
+
+        * Scripts/extract-localizable-strings:
+
 2007-10-30  Kevin McCullough  <kmccullough@apple.com>
 
         Reviewed by Adam.
@@ -31,7 +41,6 @@
         (ServerConnection::getCallerFrame):
         * Drosera/win/ServerConnection.h: Added a helper function.
 
-
 2007-10-29  Kevin McCullough  <kmccullough@apple.com>
 
         updated reviewers for my previous changelog.
index 23b5fb3..15d6782 100755 (executable)
@@ -79,7 +79,7 @@ my %usedException;
 if (open EXCEPTIONS, $exceptionsFile) {
     while (<EXCEPTIONS>) {
         chomp;
-        if (/^"([^\\"]|\\.)*"$/ or /^[-_\/\w.]+.(h|m|mm|cpp)$/ or /^[-_\/\w.]+.(h|m|mm|cpp):"([^\\"]|\\.)*"$/) {
+        if (/^"([^\\"]|\\.)*"$/ or /^[-_\/\w.]+.(h|m|mm|c|cpp)$/ or /^[-_\/\w.]+.(h|m|mm|c|cpp):"([^\\"]|\\.)*"$/) {
             if ($exception{$_}) {
                 print "$exceptionsFile:$.:exception for $_ appears twice\n";
                 print "$exceptionsFile:$exception{$_}:first appearance\n";
@@ -98,7 +98,7 @@ for my $dir (@directoriesToSkip) {
     $quotedDirectoriesString .= ' -path "' . $dir . '" -prune';
 }
 
-my @files = ( split "\n", `find $quotedDirectoriesString -name "*.h" -o -name "*.m" -o -name "*.mm" -o -name "*.cpp"` );
+my @files = ( split "\n", `find $quotedDirectoriesString -name "*.h" -o -name "*.m" -o -name "*.mm" -o -name "*.c" -o -name "*.cpp"` );
 
 for my $file (sort @files) {
     next if $file =~ /\/WebLocalizableStrings\.h$/;
@@ -339,7 +339,21 @@ for my $key (sort keys %commentByKey) {
 utf8::decode($localizedStrings) if $^V ge chr(5).chr(8);
 my $output = pack "n*", (0xFEFF, unpack "U*", $localizedStrings);
 foreach my $directory (@directories) {
-    open STRINGS, ">", "$directory/$stringsFile" or die;
-    print STRINGS $output;
-    close STRINGS;
+    if (-e "$directory/mac/$stringsFile") {
+        open STRINGS, ">", "$directory/mac/$stringsFile" or die;
+        print STRINGS $output;
+        close STRINGS;
+    }
+
+    if (-e "$directory/win/$stringsFile") {
+        open STRINGS, ">", "$directory/win/$stringsFile" or die;
+        print STRINGS $output;
+        close STRINGS;
+    }
+
+    if (-e "$directory/$stringsFile") {
+        open STRINGS, ">", "$directory/$stringsFile" or die;
+        print STRINGS $output;
+        close STRINGS;
+    }
 }