WebCore:
2008-08-12 Timothy Hatcher <timothy@apple.com>
Make the docked Web Inspector resizable. This is the cross platform
portion of the code. Each InspectorClient needs to implement the
real resize code.
https://bugs.webkit.org/show_bug.cgi?id=14282
Reviewed by Kevin McCullough.
* loader/EmptyClients.h: Added an empty setAttachedWindowHeight.
* page/InspectorClient.h: Added setAttachedWindowHeight.
* page/InspectorController.cpp:
(WebCore::setAttachedWindowHeight): Call setAttachedWindowHeight
on the InspectorController.
(WebCore::InspectorController::setAttachedWindowHeight): Call
setAttachedWindowHeight on the client.
(WebCore::InspectorController::windowScriptObjectAvailable):
Added setAttachedWindowHeight to the script class.
* page/InspectorController.h:
* page/inspector/inspector.css: Make the cursor on the toolbar be
row-resize when docked.
* page/inspector/inspector.js:
(WebInspector.loaded): Always add the toolbarDragStart event listener.
(WebInspector.toolbarDragStart): Return early if we are not attached
and not on Leopard. Call WebInspector.elementDragStart.
(WebInspector.toolbarDragEnd): Call WebInspector.elementDragEnd.
(WebInspector.toolbarDrag): When attached call setAttachedWindowHeight,
otherwise call moveByUnrestricted.
WebKit/gtk:
2008-08-12 Timothy Hatcher <timothy@apple.com>
Add a stub for InspectorClient::setAttachedWindowHeight.
* WebCoreSupport/InspectorClientGtk.cpp:
(WebKit::InspectorClient::setAttachedWindowHeight):
Call notImplemented().
* WebCoreSupport/InspectorClientGtk.h:
WebKit/mac:
2008-08-12 Timothy Hatcher <timothy@apple.com>
Make the docked Web Inspector resizable.
https://bugs.webkit.org/show_bug.cgi?id=14282
Reviewed by Kevin McCullough.
* WebCoreSupport/WebInspectorClient.h:
* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorClient::setAttachedWindowHeight): Call setAttachedWindowHeight:
on the WebInspectorWindowController.
(-[WebInspectorWindowController showWindow:]): Call setAttachedWindowHeight:.
(-[WebInspectorWindowController setAttachedWindowHeight:]): Moved code
from showWindow: and generalized to allow being called multiple times.
Remembers the last height passed, which is used by showWindow: the next
time the Inspector attaches.
WebKit/qt:
2008-08-12 Timothy Hatcher <timothy@apple.com>
Add a stub for InspectorClient::setAttachedWindowHeight.
* WebCoreSupport/InspectorClientQt.cpp:
(WebCore::InspectorClientQt::setAttachedWindowHeight):
Call notImplemented().
* WebCoreSupport/InspectorClientQt.h:
WebKit/win:
2008-08-12 Timothy Hatcher <timothy@apple.com>
Add a stub for InspectorClient::setAttachedWindowHeight.
* WebCoreSupport/WebInspectorClient.cpp:
(WebInspectorClient::setAttachedWindowHeight): Add a FIXME to implement this.
* WebCoreSupport/WebInspectorClient.h:
WebKit/wx:
2008-08-12 Timothy Hatcher <timothy@apple.com>
Add a stub for InspectorClient::setAttachedWindowHeight.
* WebKitSupport/InspectorClientWx.cpp:
(WebCore::InspectorClientWx::setAttachedWindowHeight):
Call notImplemented().
* WebKitSupport/InspectorClientWx.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@35719
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2008-08-12 Timothy Hatcher <timothy@apple.com>
+
+ Make the docked Web Inspector resizable. This is the cross platform
+ portion of the code. Each InspectorClient needs to implement the
+ real resize code.
+
+ https://bugs.webkit.org/show_bug.cgi?id=14282
+
+ Reviewed by Kevin McCullough.
+
+ * loader/EmptyClients.h: Added an empty setAttachedWindowHeight.
+ * page/InspectorClient.h: Added setAttachedWindowHeight.
+ * page/InspectorController.cpp:
+ (WebCore::setAttachedWindowHeight): Call setAttachedWindowHeight
+ on the InspectorController.
+ (WebCore::InspectorController::setAttachedWindowHeight): Call
+ setAttachedWindowHeight on the client.
+ (WebCore::InspectorController::windowScriptObjectAvailable):
+ Added setAttachedWindowHeight to the script class.
+ * page/InspectorController.h:
+ * page/inspector/inspector.css: Make the cursor on the toolbar be
+ row-resize when docked.
+ * page/inspector/inspector.js:
+ (WebInspector.loaded): Always add the toolbarDragStart event listener.
+ (WebInspector.toolbarDragStart): Return early if we are not attached
+ and not on Leopard. Call WebInspector.elementDragStart.
+ (WebInspector.toolbarDragEnd): Call WebInspector.elementDragEnd.
+ (WebInspector.toolbarDrag): When attached call setAttachedWindowHeight,
+ otherwise call moveByUnrestricted.
+
2008-08-13 Simon Hausmann <hausmann@webkit.org>
Reviewed by Holger.
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
projectRoot = "";
- projectRoots = (
- "",
- );
targets = (
93F198A508245E59001E9ABC /* WebCore */,
DD041FBE09D9DDBE0010AF2A /* Derived Sources */,
virtual void attachWindow() {};
virtual void detachWindow() {};
+ virtual void setAttachedWindowHeight(unsigned) {};
+
virtual void highlight(Node*) {};
virtual void hideHighlight() {};
virtual void inspectedURLChanged(const String& newURL) {};
virtual void attachWindow() = 0;
virtual void detachWindow() = 0;
+ virtual void setAttachedWindowHeight(unsigned height) = 0;
+
virtual void highlight(Node*) = 0;
virtual void hideHighlight() = 0;
return JSValueMakeUndefined(ctx);
}
+static JSValueRef setAttachedWindowHeight(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ InspectorController* controller = reinterpret_cast<InspectorController*>(JSObjectGetPrivate(thisObject));
+ if (!controller)
+ return JSValueMakeUndefined(ctx);
+
+ if (argumentCount < 1)
+ return JSValueMakeUndefined(ctx);
+
+ unsigned height = static_cast<unsigned>(JSValueToNumber(ctx, arguments[0], exception));
+ if (exception && *exception)
+ return JSValueMakeUndefined(ctx);
+
+ controller->setAttachedWindowHeight(height);
+
+ return JSValueMakeUndefined(ctx);
+}
+
static JSValueRef wrapCallback(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
InspectorController* controller = reinterpret_cast<InspectorController*>(JSObjectGetPrivate(thisObject));
m_client->detachWindow();
}
+void InspectorController::setAttachedWindowHeight(unsigned height)
+{
+ if (!enabled())
+ return;
+ m_client->setAttachedWindowHeight(height);
+}
+
void InspectorController::inspectedWindowScriptObjectCleared(Frame* frame)
{
if (!enabled() || !m_scriptContext || !m_scriptObject)
{ "localizedStringsURL", localizedStrings, kJSPropertyAttributeNone },
{ "platform", platform, kJSPropertyAttributeNone },
{ "moveByUnrestricted", moveByUnrestricted, kJSPropertyAttributeNone },
+ { "setAttachedWindowHeight", WebCore::setAttachedWindowHeight, kJSPropertyAttributeNone },
{ "wrapCallback", wrapCallback, kJSPropertyAttributeNone },
{ "startDebuggingAndReloadInspectedPage", WebCore::startDebuggingAndReloadInspectedPage, kJSPropertyAttributeNone },
{ "stopDebugging", WebCore::stopDebugging, kJSPropertyAttributeNone },
void attachWindow();
void detachWindow();
+ void setAttachedWindowHeight(unsigned height);
+
JSContextRef scriptContext() const { return m_scriptContext; };
void setScriptContext(JSContextRef context) { m_scriptContext = context; };
body.attached #toolbar {
height: 34px;
border-top: 1px solid rgb(100, 100, 100);
+ cursor: row-resize;
}
body.attached.inactive #toolbar {
var searchField = document.getElementById("search");
searchField.addEventListener("keyup", this.performSearch.bind(this), false);
- if (platform === "mac-leopard")
- document.getElementById("toolbar").addEventListener("mousedown", this.toolbarDragStart, true);
+ document.getElementById("toolbar").addEventListener("mousedown", this.toolbarDragStart, true);
InspectorController.loaded();
}
WebInspector.toolbarDragStart = function(event)
{
- if (WebInspector.attached)
+ if (!WebInspector.attached && InspectorController.platform() !== "mac-leopard")
return;
var target = event.target;
toolbar.lastScreenX = event.screenX;
toolbar.lastScreenY = event.screenY;
- document.addEventListener("mousemove", WebInspector.toolbarDrag, true);
- document.addEventListener("mouseup", WebInspector.toolbarDragEnd, true);
- document.body.style.cursor = "default";
-
- event.preventDefault();
+ WebInspector.elementDragStart(toolbar, WebInspector.toolbarDrag, WebInspector.toolbarDragEnd, event, (WebInspector.attached ? "row-resize" : "default"));
}
WebInspector.toolbarDragEnd = function(event)
{
var toolbar = document.getElementById("toolbar");
- delete toolbar.lastScreenX;
- delete toolbar.lastScreenY;
- document.removeEventListener("mousemove", WebInspector.toolbarDrag, true);
- document.removeEventListener("mouseup", WebInspector.toolbarDragEnd, true);
- document.body.style.removeProperty("cursor");
+ WebInspector.elementDragEnd(event);
- event.preventDefault();
+ delete toolbar.lastScreenX;
+ delete toolbar.lastScreenY;
}
WebInspector.toolbarDrag = function(event)
{
var toolbar = document.getElementById("toolbar");
- var x = event.screenX - toolbar.lastScreenX;
- var y = event.screenY - toolbar.lastScreenY;
+ if (WebInspector.attached) {
+ var height = window.innerHeight - (event.screenY - toolbar.lastScreenY);
+
+ InspectorController.setAttachedWindowHeight(height);
+ } else {
+ var x = event.screenX - toolbar.lastScreenX;
+ var y = event.screenY - toolbar.lastScreenY;
+
+ // We cannot call window.moveBy here because it restricts the movement
+ // of the window at the edges.
+ InspectorController.moveByUnrestricted(x, y);
+ }
toolbar.lastScreenX = event.screenX;
toolbar.lastScreenY = event.screenY;
- // We cannot call window.moveBy here because it restricts the movement of the window
- // at the edges.
- InspectorController.moveByUnrestricted(x, y);
-
event.preventDefault();
}
+2008-08-12 Timothy Hatcher <timothy@apple.com>
+
+ Add a stub for InspectorClient::setAttachedWindowHeight.
+
+ * WebCoreSupport/InspectorClientGtk.cpp:
+ (WebKit::InspectorClient::setAttachedWindowHeight):
+ Call notImplemented().
+ * WebCoreSupport/InspectorClientGtk.h:
+
2008-08-10 Alp Toker <alp@nuanti.com>
Remove leftover qmake/GTK+ build files.
notImplemented();
}
+void InspectorClient::setAttachedWindowHeight(unsigned height)
+{
+ notImplemented();
+}
+
void InspectorClient::highlight(Node* node)
{
notImplemented();
virtual void attachWindow();
virtual void detachWindow();
+ virtual void setAttachedWindowHeight(unsigned height);
+
virtual void highlight(WebCore::Node*);
virtual void hideHighlight();
virtual void inspectedURLChanged(const WebCore::String& newURL);
+2008-08-12 Timothy Hatcher <timothy@apple.com>
+
+ Make the docked Web Inspector resizable.
+
+ https://bugs.webkit.org/show_bug.cgi?id=14282
+
+ Reviewed by Kevin McCullough.
+
+ * WebCoreSupport/WebInspectorClient.h:
+ * WebCoreSupport/WebInspectorClient.mm:
+ (WebInspectorClient::setAttachedWindowHeight): Call setAttachedWindowHeight:
+ on the WebInspectorWindowController.
+ (-[WebInspectorWindowController showWindow:]): Call setAttachedWindowHeight:.
+ (-[WebInspectorWindowController setAttachedWindowHeight:]): Moved code
+ from showWindow: and generalized to allow being called multiple times.
+ Remembers the last height passed, which is used by showWindow: the next
+ time the Inspector attaches.
+
2008-08-12 Timothy Hatcher <timothy@apple.com>
Remove unneeded header imports from some Web Inspector files.
virtual void attachWindow();
virtual void detachWindow();
+ virtual void setAttachedWindowHeight(unsigned height);
+
virtual void highlight(WebCore::Node*);
virtual void hideHighlight();
virtual void inspectedURLChanged(const WebCore::String& newURL);
- (WebView *)webView;
- (void)attach;
- (void)detach;
+- (void)setAttachedWindowHeight:(unsigned)height;
- (void)highlightAndScrollToNode:(DOMNode *)node;
- (void)highlightNode:(DOMNode *)node;
- (void)hideHighlight;
[m_windowController.get() detach];
}
+void WebInspectorClient::setAttachedWindowHeight(unsigned height)
+{
+ [m_windowController.get() setAttachedWindowHeight:height];
+}
+
void WebInspectorClient::highlight(Node* node)
{
[m_windowController.get() highlightAndScrollToNode:kit(node)];
if (_shouldAttach) {
WebFrameView *frameView = [[_inspectedWebView mainFrame] frameView];
- NSRect frameViewRect = [frameView frame];
- float attachedHeight = [[NSUserDefaults standardUserDefaults] integerForKey:WebKitInspectorAttachedViewHeightKey];
- attachedHeight = MAX(300.0, MIN(attachedHeight, (NSHeight(frameViewRect) * 0.6)));
- frameViewRect = NSMakeRect(0, attachedHeight, NSWidth(frameViewRect), NSHeight(frameViewRect) - attachedHeight);
-
[_webView removeFromSuperview];
- [_inspectedWebView addSubview:_webView positioned:NSWindowBelow relativeTo:(NSView*)frameView];
+ [_inspectedWebView addSubview:_webView positioned:NSWindowBelow relativeTo:(NSView *)frameView];
[_webView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable | NSViewMaxYMargin)];
- [_webView setFrame:NSMakeRect(0, 0, NSWidth(frameViewRect), attachedHeight)];
-
[frameView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable | NSViewMinYMargin)];
- [frameView setFrame:frameViewRect];
_attachedToInspectedWebView = YES;
+
+ [self setAttachedWindowHeight:[[NSUserDefaults standardUserDefaults] integerForKey:WebKitInspectorAttachedViewHeightKey]];
} else {
_attachedToInspectedWebView = NO;
_movingWindows = NO;
}
+- (void)setAttachedWindowHeight:(unsigned)height
+{
+ [[NSUserDefaults standardUserDefaults] setInteger:height forKey:WebKitInspectorAttachedViewHeightKey];
+
+ if (!_attachedToInspectedWebView)
+ return;
+
+ WebFrameView *frameView = [[_inspectedWebView mainFrame] frameView];
+ NSRect frameViewRect = [frameView frame];
+
+ CGFloat attachedHeight = round(MAX(250.0, MIN(height, (NSHeight([_inspectedWebView frame]) * 0.75))));
+ frameViewRect = NSMakeRect(0.0, attachedHeight, NSWidth(frameViewRect), NSHeight([_inspectedWebView frame]) - attachedHeight);
+
+ [_webView setFrame:NSMakeRect(0.0, 0.0, NSWidth(frameViewRect), attachedHeight)];
+ [frameView setFrame:frameViewRect];
+}
+
#pragma mark -
- (void)highlightAndScrollToNode:(DOMNode *)node
+2008-08-12 Timothy Hatcher <timothy@apple.com>
+
+ Add a stub for InspectorClient::setAttachedWindowHeight.
+
+ * WebCoreSupport/InspectorClientQt.cpp:
+ (WebCore::InspectorClientQt::setAttachedWindowHeight):
+ Call notImplemented().
+ * WebCoreSupport/InspectorClientQt.h:
+
2008-08-13 Ariya Hidayat <ariya.hidayat@trolltech.com>
Reviewed by Simon.
notImplemented();
}
+void InspectorClientQt::setAttachedWindowHeight(unsigned height)
+{
+ notImplemented();
+}
+
void InspectorClientQt::highlight(Node* node)
{
notImplemented();
virtual void attachWindow();
virtual void detachWindow();
+ virtual void setAttachedWindowHeight(unsigned height);
+
virtual void highlight(Node*);
virtual void hideHighlight();
virtual void inspectedURLChanged(const String& newURL);
+2008-08-12 Timothy Hatcher <timothy@apple.com>
+
+ Add a stub for InspectorClient::setAttachedWindowHeight.
+
+ * WebCoreSupport/WebInspectorClient.cpp:
+ (WebInspectorClient::setAttachedWindowHeight): Add a FIXME to implement this.
+ * WebCoreSupport/WebInspectorClient.h:
+
2008-08-12 Adam Roben <aroben@apple.com>
Export WTFLog in Debug builds
m_highlight->update();
}
+void WebInspectorClient::setAttachedWindowHeight(unsigned height)
+{
+ // FIXME: implement this.
+}
+
void WebInspectorClient::highlight(Node*)
{
bool creatingHighlight = !m_highlight;
virtual void attachWindow();
virtual void detachWindow();
+ virtual void setAttachedWindowHeight(unsigned height);
+
virtual void highlight(WebCore::Node*);
virtual void hideHighlight();
+2008-08-12 Timothy Hatcher <timothy@apple.com>
+
+ Add a stub for InspectorClient::setAttachedWindowHeight.
+
+ * WebKitSupport/InspectorClientWx.cpp:
+ (WebCore::InspectorClientWx::setAttachedWindowHeight):
+ Call notImplemented().
+ * WebKitSupport/InspectorClientWx.h:
+
2008-08-06 Kevin Watters <kevinwatters@gmail.com>
Reviewed by Kevin Ollivier.
notImplemented();
}
+void InspectorClientWx::setAttachedWindowHeight(unsigned height)
+{
+ notImplemented();
+}
+
void InspectorClientWx::highlight(Node*)
{
notImplemented();
virtual void attachWindow();
virtual void detachWindow();
+ virtual void setAttachedWindowHeight(unsigned height);
+
virtual void highlight(Node*);
virtual void hideHighlight();