WebCore:
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Nov 2007 17:17:50 +0000 (17:17 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Nov 2007 17:17:50 +0000 (17:17 +0000)
        Reviewed by Adam Roben.

        Bug 16137: Web Inspector window on Leopard should have a unified toolbar and window title
        http://bugs.webkit.org/show_bug.cgi?id=16137

        On Leopard the toolbar background will be transparent, to allow the
        window background to show through the transparent WebView. The
        search results divs needed to move inside the "main" div, so they
        would be clipped and not show where the toolbar is.

        * page/InspectorController.cpp:
        (WebCore::platform): Return a string for which platform we are.
        (WebCore::InspectorController::windowScriptObjectAvailable):
        Define the platform function on the JavaScript class.
        * page/inspector/Panel.js: Add panels to the panels div.
        * page/inspector/inspector.css: On the Leopard platform make
        the toolbar background transparent so the window background shows.
        * page/inspector/inspector.html: Add a panels div and move search
        result divs inside the main div.
        * page/inspector/inspector.js: Tweak the resize code to acount for
        the search results divs moving inside the main div.

WebKit/mac:

        Reviewed by Adam Roben.

        Bug 16137: Web Inspector window on Leopard should have a unified toolbar and window title
        http://bugs.webkit.org/show_bug.cgi?id=16137

        Create the Web Inspector window with the textured style. Set the content border
        thickness for the top of the window or the height of the toolbar. Also make the
        window's bottom corners square, since a normal textured window normally has
        rounded bottom corners.

        * WebCoreSupport/WebInspectorClient.mm:
        (-[WebInspectorWindowController window]):

WebKitLibraries:

        Reviewed by Adam Roben.

        Bug 16137: Web Inspector window on Leopard should have a unified toolbar and window title
        http://bugs.webkit.org/show_bug.cgi?id=16137

        Add a new function to make bottom window corners square for textured windows.

        * WebKitSystemInterface.h:
        * libWebKitSystemInterfaceTiger.a:
        * libWebKitSystemInterfaceLeopard.a:

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

12 files changed:
WebCore/ChangeLog
WebCore/page/InspectorController.cpp
WebCore/page/inspector/Panel.js
WebCore/page/inspector/inspector.css
WebCore/page/inspector/inspector.html
WebCore/page/inspector/inspector.js
WebKit/mac/ChangeLog
WebKit/mac/WebCoreSupport/WebInspectorClient.mm
WebKitLibraries/ChangeLog
WebKitLibraries/WebKitSystemInterface.h
WebKitLibraries/libWebKitSystemInterfaceLeopard.a
WebKitLibraries/libWebKitSystemInterfaceTiger.a

index a9af4d7..f9bd317 100644 (file)
@@ -1,3 +1,27 @@
+2007-11-26  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Adam Roben.
+
+        Bug 16137: Web Inspector window on Leopard should have a unified toolbar and window title
+        http://bugs.webkit.org/show_bug.cgi?id=16137
+
+        On Leopard the toolbar background will be transparent, to allow the
+        window background to show through the transparent WebView. The 
+        search results divs needed to move inside the "main" div, so they
+        would be clipped and not show where the toolbar is.
+
+        * page/InspectorController.cpp:
+        (WebCore::platform): Return a string for which platform we are.
+        (WebCore::InspectorController::windowScriptObjectAvailable):
+        Define the platform function on the JavaScript class.
+        * page/inspector/Panel.js: Add panels to the panels div.
+        * page/inspector/inspector.css: On the Leopard platform make
+        the toolbar background transparent so the window background shows.
+        * page/inspector/inspector.html: Add a panels div and move search
+        result divs inside the main div.
+        * page/inspector/inspector.js: Tweak the resize code to acount for
+        the search results divs moving inside the main div.
+
 2007-11-25  Rodney Dawes  <dobey@wayofthemonkey.com>
 
         Reviewed by Maciej Stachowiak.
index b0d5cbd..f623650 100644 (file)
@@ -61,6 +61,7 @@
 #include "kjs_window.h"
 #include <JavaScriptCore/APICast.h>
 #include <JavaScriptCore/JSLock.h>
+#include <JavaScriptCore/JSRetainPtr.h>
 #include <JavaScriptCore/JSStringRef.h>
 
 namespace WebCore {
@@ -543,6 +544,32 @@ static JSValueRef localizedStrings(JSContextRef ctx, JSObjectRef /*function*/, J
     return urlValue;
 }
 
+static JSValueRef platform(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t /*argumentCount*/, const JSValueRef[] /*arguments[]*/, JSValueRef* /*exception*/)
+{
+#if PLATFORM(MAC)
+#ifdef BUILDING_ON_TIGER
+    static const String platform = "mac-tiger";
+#else
+    static const String platform = "mac-leopard";
+#endif
+#elif PLATFORM(WIN_OS)
+    static const String platform = "windows";
+#elif PLATFORM(QT)
+    static const String platform = "qt";
+#elif PLATFORM(GTK)
+    static const String platform = "gtk";
+#elif PLATFORM(WX)
+    static const String platform = "wx";
+#else
+    static const String platform = "unknown";
+#endif
+
+    JSRetainPtr<JSStringRef> platformString(Adopt, JSStringCreateWithCharacters(platform.characters(), platform.length()));
+    JSValueRef platformValue = JSValueMakeString(ctx, platformString.get());
+
+    return platformValue;
+}
+
 InspectorController::InspectorController(Page* page, InspectorClient* client)
     : m_inspectedPage(page)
     , m_client(client)
@@ -734,6 +761,7 @@ void InspectorController::windowScriptObjectAvailable()
 #endif
         { "inspectedWindow", inspectedWindow, kJSPropertyAttributeNone },
         { "localizedStringsURL", localizedStrings, kJSPropertyAttributeNone },
+        { "platform", platform, kJSPropertyAttributeNone },
         { 0, 0, 0 }
     };
 
index f9babf0..7631fa3 100644 (file)
@@ -116,7 +116,7 @@ WebInspector.Panel.prototype = {
 
     attach: function()
     {
-        document.getElementById("main").appendChild(this.element);
+        document.getElementById("panels").appendChild(this.element);
     },
 
     detach: function()
index 5e59ea9..7b39a5f 100644 (file)
@@ -58,7 +58,7 @@ iframe, a img {
     left: 0;
     right: 0;
     height: 28px;
-    background: rgb(245, 245, 250);
+    background-color: rgb(245, 245, 250);
     background-image: url(Images/toolbarBackground.png);
     background-repeat: repeat-x;
     background-position: top;
@@ -68,6 +68,10 @@ iframe, a img {
     -webkit-background-size: auto 135%;
 }
 
+.platform-mac-leopard #toolbar {
+    background: transparent !important;
+}
+
 body.inactive #toolbar {
     background-image: url(Images/toolbarBackgroundInactive.png);
     border-bottom: 1px solid rgb(64%, 64%, 64%);
@@ -237,8 +241,8 @@ body.inactive #toolbar .split-button-divider {
 
 #searchResults {
     position: absolute;
-    top: -73px;
-    left: 200px;
+    top: -100px;
+    left: 0;
     right: 0;
     height: 100px;
     z-index: -1;
@@ -246,6 +250,7 @@ body.inactive #toolbar .split-button-divider {
     border-bottom: 1px solid rgb(180, 180, 180);
     overflow-y: auto;
     overflow-x: hidden;
+    -webkit-box-sizing: border-box;
 }
 
 .search-results-section {
@@ -668,6 +673,16 @@ body.inactive #sidebar li.selected {
     z-index: -100;
 }
 
+#panels {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    overflow: hidden;
+    z-index: -100;
+}
+
 .panel {
     display: none;
     overflow: hidden;
@@ -1999,7 +2014,7 @@ body:not(.inactive) .focused .outline-disclosure li.selected * {
 #searchResultsResizer {
     position: absolute;
     height: 5px;
-    left: 200px;
+    left: 0;
     right: 0;
     cursor: row-resize;
 }
index 1d95e67..43a3de2 100644 (file)
@@ -66,8 +66,10 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
         </div>
         <div id="sidebarResizer" class="sidebar-resizer-vertical sidebar-resizer-vertical-left"></div>
     </div>
-    <div id="searchResults" class="focusable"></div>
-    <div id="searchResultsResizer" style="display: none"></div>
-    <div id="main" class="focusable blurred"></div>
+    <div id="main" class="focusable blurred">
+        <div id="searchResults" class="focusable hidden"></div>
+        <div id="searchResultsResizer" class="hidden"></div>
+        <div id="panels"></div>
+    </div>
 </body>
 </html>
index 895c9d9..36b5284 100644 (file)
@@ -33,8 +33,7 @@ var Preferences = {
     maxInlineTextChildLength: 80,
     maxTextSearchResultLength: 80,
     showInheritedComputedStyleProperties: false,
-    showMissingLocalizedStrings: false,
-    toolbarHeight: 28
+    showMissingLocalizedStrings: false
 }
 
 var WebInspector = {
@@ -191,27 +190,41 @@ var WebInspector = {
         var searchResultsResizer = document.getElementById("searchResultsResizer");
 
         if (x) {
-            searchResultsResizer.style.display = null;
+            resultsContainer.removeStyleClass("hidden");
+            searchResultsResizer.removeStyleClass("hidden");
+
             var animations = [
-                {element: resultsContainer, end: {top: Preferences.toolbarHeight}},
-                {element: searchResultsResizer, end: {top: WebInspector.searchResultsHeight + Preferences.toolbarHeight - 2}},
-                {element: document.getElementById("main"), end: {top: WebInspector.searchResultsHeight + Preferences.toolbarHeight + 1}}
+                {element: resultsContainer, end: {top: 0}},
+                {element: searchResultsResizer, end: {top: WebInspector.searchResultsHeight - 3}},
+                {element: document.getElementById("panels"), end: {top: WebInspector.searchResultsHeight}}
             ];
+
             WebInspector.animateStyle(animations, 250);
         } else {
-            searchResultsResizer.style.display = "none";
+            searchResultsResizer.addStyleClass("hidden");
+
             var animations = [
-                {element: resultsContainer, end: {top: Preferences.toolbarHeight - WebInspector.searchResultsHeight - 1}},
+                {element: resultsContainer, end: {top: -WebInspector.searchResultsHeight}},
                 {element: searchResultsResizer, end: {top: 0}},
-                {element: document.getElementById("main"), end: {top: Preferences.toolbarHeight}}
+                {element: document.getElementById("panels"), end: {top: 0}}
             ];
-            WebInspector.animateStyle(animations, 250, function() { resultsContainer.removeChildren(); delete this.searchResultsTree; });
+
+            var animationFinished = function()
+            {
+                resultsContainer.addStyleClass("hidden");
+                resultsContainer.removeChildren();
+                delete this.searchResultsTree;
+            };
+
+            WebInspector.animateStyle(animations, 250, animationFinished);
         }
     }
 }
 
 WebInspector.loaded = function()
 {
+    document.body.addStyleClass("platform-" + InspectorController.platform());
+
     this.fileOutline = new TreeOutline(document.getElementById("list"));
     this.fileOutline.expandTreeElementsWhenArrowing = true;
 
@@ -554,8 +567,6 @@ WebInspector.sidebarResizerDrag = function(event)
         document.getElementById("sidebarResizer").style.left = (newWidth - 3) + "px";
         document.getElementById("main").style.left = newWidth + "px";
         document.getElementById("toolbarButtons").style.left = newWidth + "px";
-        document.getElementById("searchResults").style.left = newWidth + "px";
-        document.getElementById("searchResultsResizer").style.left = newWidth + "px";
 
         if (WebInspector.currentPanel && WebInspector.currentPanel.resize)
             WebInspector.currentPanel.resize();
@@ -578,16 +589,16 @@ WebInspector.searchResultsResizerDrag = function(event)
 {
     var searchResults = document.getElementById("searchResults");
     if (searchResults.dragging == true) {
-        var y = event.clientY;
+        var y = event.clientY - document.getElementById("main").offsetTop;
         var newHeight = Number.constrain(y, 100, window.innerHeight - 100);
 
         if (y == newHeight)
             searchResults.dragLastY = y;
 
-        WebInspector.searchResultsHeight = newHeight - Preferences.toolbarHeight;
+        WebInspector.searchResultsHeight = newHeight;
         searchResults.style.height = WebInspector.searchResultsHeight + "px";
-        document.getElementById("main").style.top = (newHeight + 1) + "px";
-        document.getElementById("searchResultsResizer").style.top = (newHeight - 2) + "px";
+        document.getElementById("panels").style.top = newHeight + "px";
+        document.getElementById("searchResultsResizer").style.top = (newHeight - 3) + "px";
         event.preventDefault();
     }
 }
index 652090f..62d72da 100644 (file)
@@ -1,3 +1,18 @@
+2007-11-26  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Adam Roben.
+
+        Bug 16137: Web Inspector window on Leopard should have a unified toolbar and window title
+        http://bugs.webkit.org/show_bug.cgi?id=16137
+
+        Create the Web Inspector window with the textured style. Set the content border
+        thickness for the top of the window or the height of the toolbar. Also make the
+        window's bottom corners square, since a normal textured window normally has
+        rounded bottom corners.
+
+        * WebCoreSupport/WebInspectorClient.mm:
+        (-[WebInspectorWindowController window]):
+
 2007-11-24  Mark Rowe  <mrowe@apple.com>
 
         Tiger build fix.
index 19f3b7c..1325def 100644 (file)
@@ -33,6 +33,7 @@
 #import "WebLocalizableStrings.h"
 #import "WebNodeHighlight.h"
 #import "WebPreferences.h"
+#import "WebTypesInternal.h"
 #import "WebView.h"
 #import "WebViewInternal.h"
 #import "WebViewPrivate.h"
@@ -45,6 +46,8 @@
 #import <WebKit/DOMCore.h>
 #import <WebKit/DOMExtensions.h>
 
+#import <WebKitSystemInterface.h>
+
 using namespace WebCore;
 
 @interface WebInspectorWindowController : NSWindowController {
@@ -218,11 +221,23 @@ void WebInspectorClient::updateWindowTitle() const
     if (window)
         return window;
 
-    window = [[NSWindow alloc] initWithContentRect:NSMakeRect(60.0, 200.0, 750.0, 650.0)
-        styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask) backing:NSBackingStoreBuffered defer:YES];
+    NSUInteger styleMask = (NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask);
+
+#ifndef BUILDING_ON_TIGER
+    styleMask |= NSTexturedBackgroundWindowMask;
+#endif
+
+    window = [[NSWindow alloc] initWithContentRect:NSMakeRect(60.0, 200.0, 750.0, 650.0) styleMask:styleMask backing:NSBackingStoreBuffered defer:YES];
     [window setDelegate:self];
     [window setMinSize:NSMakeSize(400.0, 400.0)];
 
+#ifndef BUILDING_ON_TIGER
+    [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge];
+    [window setContentBorderThickness:40. forEdge:NSMaxYEdge];
+
+    WKNSWindowMakeBottomCornersSquare(window);
+#endif
+
     [self setWindow:window];
     [window release];
 
index e5ac49c..59f703a 100644 (file)
@@ -1,3 +1,16 @@
+2007-11-26  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Adam Roben.
+
+        Bug 16137: Web Inspector window on Leopard should have a unified toolbar and window title
+        http://bugs.webkit.org/show_bug.cgi?id=16137
+
+        Add a new function to make bottom window corners square for textured windows.
+
+        * WebKitSystemInterface.h:
+        * libWebKitSystemInterfaceTiger.a:
+        * libWebKitSystemInterfaceLeopard.a:
+
 2007-11-23  Adam Roben  <aroben@apple.com>
 
         Add wkSetPatternPhaseInUserSpace to WebKitSystemInterface on Windows
index ccde3de..4ba5316 100644 (file)
@@ -148,6 +148,8 @@ NSEvent *WKCreateNSEventWithCarbonClickEvent(EventRef inEvent, WindowRef windowR
 CGContextRef WKNSWindowOverrideCGContext(NSWindow *, CGContextRef);
 void WKNSWindowRestoreCGContext(NSWindow *, CGContextRef);
 
+void WKNSWindowMakeBottomCornersSquare(NSWindow *);
+
 BOOL WKSupportsMultipartXMixedReplace(NSMutableURLRequest *request);
 NSString* WKPathFromFont(NSFont *font);
 
index ac86ab4..4eaa65b 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterfaceLeopard.a and b/WebKitLibraries/libWebKitSystemInterfaceLeopard.a differ
index 5478c96..3839636 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterfaceTiger.a and b/WebKitLibraries/libWebKitSystemInterfaceTiger.a differ