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 a9af4d763339f29dfcc0e8848b19ce8c28caeff4..f9bd3171d11a182725ea4bb16413b3d5f4ccd3fa 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 b0d5cbd584cd3dd3e44edce61a16ab57d10520eb..f6236500dbb8c87059c63836647116bd07529855 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 f9babf0d1a7bb5a99ebb4c5c6236695def11119d..7631fa357a912820d4a62a65a2dc3f1bb1295ad5 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 5e59ea9419583058fedfdbe1e1699881d6b883f2..7b39a5f3590fa4bf928fd77253578aae1d2cf0b5 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 1d95e67c245b14f039ef826213cc3b01e147c4b6..43a3de2b5745f434dd209e855474c60d379e6e28 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 895c9d960a410a3c19659478122d4c9b435d044d..36b5284d69937fff9a42628912450ba1ddedfa27 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 652090fab7a024c3716695c1828afcbc7c9347dc..62d72dac64709dc87ecb3ec5bb68228076a5d2a4 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 19f3b7c2a21d2189008aa7b92331fefe001722c3..1325defac61fbe86c5b7716c5e8f7b4b3534fff0 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 e5ac49c7de3f4917a2786ae7ce0afe882474eeb2..59f703aec4fdcd967b77d8b23c2dc6739cb080da 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 ccde3de7288d224a380c22f7ade7044faad07c26..4ba5316ed64cddc1be7ceee66ea87605fb1d54c6 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 ac86ab42c84a8f3928f0d2239f5b03ba87606751..4eaa65bfb8cd8bba4936e287b5ed694377aa0506 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterfaceLeopard.a and b/WebKitLibraries/libWebKitSystemInterfaceLeopard.a differ
index 5478c96a04a50f8269a96879c9d0c997156c96cc..38396367ce6997b26534892bd6b0200f4efa1f2b 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterfaceTiger.a and b/WebKitLibraries/libWebKitSystemInterfaceTiger.a differ