<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[20717] branches/WebInspectorRefresh/WebKit/WebInspector</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/20717">20717</a></dd>
<dt>Author</dt> <dd>thatcher</dd>
<dt>Date</dt> <dd>2007-04-04 23:04:34 -0700 (Wed, 04 Apr 2007)</dd>
</dl>
<h3>Log Message</h3>
<pre>Move the tree splitter resize code down into JavaScript. Some other cleanup work.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchesWebInspectorRefreshWebKitWebInspectorWebInspectorm">branches/WebInspectorRefresh/WebKit/WebInspector/WebInspector.m</a></li>
<li><a href="#branchesWebInspectorRefreshWebKitWebInspectorWebInspectorInternalh">branches/WebInspectorRefresh/WebKit/WebInspector/WebInspectorInternal.h</a></li>
<li><a href="#branchesWebInspectorRefreshWebKitWebInspectorwebInspectorinspectorhtml">branches/WebInspectorRefresh/WebKit/WebInspector/webInspector/inspector.html</a></li>
<li><a href="#branchesWebInspectorRefreshWebKitWebInspectorwebInspectorinspectorjs">branches/WebInspectorRefresh/WebKit/WebInspector/webInspector/inspector.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchesWebInspectorRefreshWebKitWebInspectorWebInspectorm"></a>
<div class="modfile"><h4>Modified: branches/WebInspectorRefresh/WebKit/WebInspector/WebInspector.m (20716 => 20717)</h4>
<pre class="diff"><span>
<span class="info">--- branches/WebInspectorRefresh/WebKit/WebInspector/WebInspector.m        2007-04-05 05:24:58 UTC (rev 20716)
+++ branches/WebInspectorRefresh/WebKit/WebInspector/WebInspector.m        2007-04-05 06:04:34 UTC (rev 20717)
</span><span class="lines">@@ -337,64 +337,6 @@
</span><span class="cx"> NSEvent *event = [NSEvent mouseEventWithType:NSLeftMouseUp location:[currentEvent locationInWindow] modifierFlags:[currentEvent modifierFlags] timestamp:[currentEvent timestamp] windowNumber:[[currentEvent window] windowNumber] context:[currentEvent context] eventNumber:[currentEvent eventNumber] clickCount:[currentEvent clickCount] pressure:[currentEvent pressure]];
</span><span class="cx"> [[[[_private->webView mainFrame] frameView] documentView] mouseUp:event];
</span><span class="cx"> }
</span><del>-
-- (void)resizeTopArea
-{
- NSWindow *window = [self window];
- NSEvent *event = [window currentEvent];
- NSPoint lastLocation = [window convertBaseToScreen:[event locationInWindow]];
- NSRect lastFrame = [window frame];
- NSSize minSize = [window minSize];
- NSSize maxSize = [window maxSize];
- BOOL mouseUpOccurred = NO;
-
- DOMHTMLElement *topArea = (DOMHTMLElement *)[_private->domDocument getElementById:@"top"];
- DOMHTMLElement *splitter = (DOMHTMLElement *)[_private->domDocument getElementById:@"splitter"];
- DOMHTMLElement *bottomArea = (DOMHTMLElement *)[_private->domDocument getElementById:@"bottom"];
-
- while (!mouseUpOccurred) {
- // set mouseUp flag here, but process location of event before exiting from loop, leave mouseUp in queue
- event = [window nextEventMatchingMask:(NSLeftMouseDraggedMask | NSLeftMouseUpMask) untilDate:[NSDate distantFuture] inMode:NSEventTrackingRunLoopMode dequeue:YES];
-
- if ([event type] == NSLeftMouseUp)
- mouseUpOccurred = YES;
-
- NSPoint newLocation = [window convertBaseToScreen:[event locationInWindow]];
- if (NSEqualPoints(newLocation, lastLocation))
- continue;
-
- NSRect proposedRect = lastFrame;
- long delta = newLocation.y - lastLocation.y;
- proposedRect.size.height -= delta;
- proposedRect.origin.y += delta;
-
- if (proposedRect.size.height < minSize.height) {
- proposedRect.origin.y -= minSize.height - proposedRect.size.height;
- proposedRect.size.height = minSize.height;
- } else if (proposedRect.size.height > maxSize.height) {
- proposedRect.origin.y -= maxSize.height - proposedRect.size.height;
- proposedRect.size.height = maxSize.height;
- }
-
- NSString *newValue = [NSString stringWithFormat:@"%dpx", [topArea clientHeight] - delta];
- [[topArea style] setProperty:@"height" value:newValue priority:@""];
-
- newValue = [NSString stringWithFormat:@"%dpx", [splitter offsetTop] - delta];
- [[splitter style] setProperty:@"top" value:newValue priority:@""];
-
- newValue = [NSString stringWithFormat:@"%dpx", [bottomArea offsetTop] - delta];
- [[bottomArea style] setProperty:@"top" value:newValue priority:@""];
-
- [window setFrame:proposedRect display:YES];
- lastLocation = newLocation;
- lastFrame = proposedRect;
-
- [self _updateTreeScrollbar];
- }
-
- // post the mouse up event back to the queue so the WebView can get it
- [window postEvent:event atStart:YES];
-}
</del><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> #pragma mark -
</span><span class="lines">@@ -453,27 +395,14 @@
</span><span class="cx">
</span><span class="cx"> - (void)_update
</span><span class="cx"> {
</span><del>- if (_private->webViewLoaded) {
- if ([self focusedDOMNode]) {
- [[_private->webView windowScriptObject] callWebScriptMethod:@"toggleNoSelection" withArguments:[NSArray arrayWithObject:[NSNumber numberWithBool:NO]]];
- [[_private->webView windowScriptObject] callWebScriptMethod:@"updatePanes" withArguments:nil];
- } else
- [[_private->webView windowScriptObject] callWebScriptMethod:@"toggleNoSelection" withArguments:[NSArray arrayWithObject:[NSNumber numberWithBool:YES]]];
- }
</del><ins>+ if (_private->webViewLoaded)
+ [[_private->webView windowScriptObject] callWebScriptMethod:@"updatePanes" withArguments:nil];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_updateRoot
</span><span class="cx"> {
</span><del>- if (!_private->webViewLoaded)
- return;
-
- [[_private->webView windowScriptObject] callWebScriptMethod:@"updateTreeOutline" withArguments:nil];
-}
-
-- (void)_updateTreeScrollbar
-{
</del><span class="cx"> if (_private->webViewLoaded)
</span><del>- [[_private->webView windowScriptObject] evaluateWebScript:@"treeOutlineScrollArea.refresh()"];
</del><ins>+ [[_private->webView windowScriptObject] callWebScriptMethod:@"updateTreeOutline" withArguments:nil];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_updateSystemColors
</span></span></pre></div>
<a id="branchesWebInspectorRefreshWebKitWebInspectorWebInspectorInternalh"></a>
<div class="modfile"><h4>Modified: branches/WebInspectorRefresh/WebKit/WebInspector/WebInspectorInternal.h (20716 => 20717)</h4>
<pre class="diff"><span>
<span class="info">--- branches/WebInspectorRefresh/WebKit/WebInspector/WebInspectorInternal.h        2007-04-05 05:24:58 UTC (rev 20716)
+++ branches/WebInspectorRefresh/WebKit/WebInspector/WebInspectorInternal.h        2007-04-05 06:04:34 UTC (rev 20717)
</span><span class="lines">@@ -30,11 +30,11 @@
</span><span class="cx">
</span><span class="cx"> #import <Foundation/NSObject.h>
</span><span class="cx"> #import <WebKit/WebInspector.h>
</span><del>-#import <WebKit/DOMCore.h>
</del><ins>+#import <WebKit/DOMNode.h>
</ins><span class="cx">
</span><ins>+@class DOMHTMLDocument;
</ins><span class="cx"> @class WebView;
</span><span class="cx"> @class WebFrame;
</span><del>-@class DOMHTMLDocument;
</del><span class="cx"> @class WebNodeHighlight;
</span><span class="cx">
</span><span class="cx"> @interface WebInspectorPrivate : NSObject
</span><span class="lines">@@ -61,8 +61,6 @@
</span><span class="cx"> - (void)_update;
</span><span class="cx"> - (void)_updateRoot;
</span><span class="cx"> - (void)_updateSystemColors;
</span><del>-- (void)_updateTreeScrollbar;
-- (void)_webFrameDetached:(WebFrame *)frame;
</del><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @interface DOMNode (DOMNodeInspectorAdditions)
</span></span></pre></div>
<a id="branchesWebInspectorRefreshWebKitWebInspectorwebInspectorinspectorhtml"></a>
<div class="modfile"><h4>Modified: branches/WebInspectorRefresh/WebKit/WebInspector/webInspector/inspector.html (20716 => 20717)</h4>
<pre class="diff"><span>
<span class="info">--- branches/WebInspectorRefresh/WebKit/WebInspector/webInspector/inspector.html        2007-04-05 05:24:58 UTC (rev 20716)
+++ branches/WebInspectorRefresh/WebKit/WebInspector/webInspector/inspector.html        2007-04-05 06:04:34 UTC (rev 20717)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> <div id="treeOutlineScrollbar"></div>
</span><span class="cx"> </div>
</span><span class="cx"> </div>
</span><del>-<div id="splitter" onmousedown="Inspector.resizeTopArea()"><hr size="2" /></div>
</del><ins>+<div id="splitter"><hr size="2" /></div>
</ins><span class="cx"> <div id="bottom">
</span><span class="cx"> <div id="tabs">
</span><span class="cx"> <button class="left" id="nodeButton" onclick="switchPane('node')">Node</button>
</span></span></pre></div>
<a id="branchesWebInspectorRefreshWebKitWebInspectorwebInspectorinspectorjs"></a>
<div class="modfile"><h4>Modified: branches/WebInspectorRefresh/WebKit/WebInspector/webInspector/inspector.js (20716 => 20717)</h4>
<pre class="diff"><span>
<span class="info">--- branches/WebInspectorRefresh/WebKit/WebInspector/webInspector/inspector.js        2007-04-05 05:24:58 UTC (rev 20716)
+++ branches/WebInspectorRefresh/WebKit/WebInspector/webInspector/inspector.js        2007-04-05 06:04:34 UTC (rev 20717)
</span><span class="lines">@@ -513,6 +513,7 @@
</span><span class="cx"> window.addEventListener("resize", refreshScrollbars, true);
</span><span class="cx"> document.addEventListener("click", changeFocus, true);
</span><span class="cx"> document.addEventListener("keypress", documentKeypress, true);
</span><ins>+ document.getElementById("splitter").addEventListener("mousedown", topAreaResizeDragStart, true);
</ins><span class="cx">
</span><span class="cx"> currentFocusElement = document.getElementById("tree");
</span><span class="cx">
</span><span class="lines">@@ -851,6 +852,8 @@
</span><span class="cx"> treeOutline.treeRoot = true;
</span><span class="cx"> treeOutline.innerText = ""; // clear the existing tree
</span><span class="cx">
</span><ins>+ treeOutlineScrollArea.refresh();
+
</ins><span class="cx"> if (!rootNode)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -983,6 +986,7 @@
</span><span class="cx"> {
</span><span class="cx"> for (var i = 0; i < tabNames.length; i++)
</span><span class="cx"> paneUpdateState[tabNames[i]] = false;
</span><ins>+ toggleNoSelection((Inspector.focusedDOMNode() ? false : true));
</ins><span class="cx"> if (noSelection)
</span><span class="cx"> return;
</span><span class="cx"> eval("update" + currentPane.charAt(0).toUpperCase() + currentPane.substr(1) + "Pane()");
</span><span class="lines">@@ -1527,3 +1531,57 @@
</span><span class="cx">
</span><span class="cx"> jsPropertiesScrollArea.refresh();
</span><span class="cx"> }
</span><ins>+
+function dividerDragStart(element, dividerDrag, dividerDragEnd, event, cursor)
+{
+ element.dragging = true;
+ element.dragLastY = event.clientY + window.scrollY;
+ element.dragLastX = event.clientX + window.scrollX;
+ document.addEventListener("mousemove", dividerDrag, true);
+ document.addEventListener("mouseup", dividerDragEnd, true);
+ document.body.style.cursor = cursor;
+ event.preventDefault();
+}
+
+function dividerDragEnd(element, dividerDrag, dividerDragEnd, event)
+{
+ element.dragging = false;
+ document.removeEventListener("mousemove", dividerDrag, true);
+ document.removeEventListener("mouseup", dividerDragEnd, true);
+ document.body.style.removeProperty("cursor");
+}
+
+function topAreaResizeDragStart(event)
+{
+ dividerDragStart(document.getElementById("splitter"), topAreaResizeDrag, topAreaResizeDragEnd, event, "row-resize");
+}
+
+function topAreaResizeDrag(event)
+{
+ var element = document.getElementById("splitter");
+ if (element.dragging == true) {
+ var y = event.clientY + window.scrollY;
+ var delta = element.dragLastY - y;
+ element.dragLastY = y;
+
+ var top = document.getElementById("top");
+ top.style.height = (top.clientHeight - delta) + "px";
+
+ var splitter = document.getElementById("splitter");
+ splitter.style.top = (splitter.offsetTop - delta) + "px";
+
+ var bottom = document.getElementById("bottom");
+ bottom.style.top = (bottom.offsetTop - delta) + "px";
+
+ window.resizeBy(0, (delta * -1));
+
+ treeOutlineScrollArea.refresh();
+
+ event.preventDefault();
+ }
+}
+
+function topAreaResizeDragEnd(event)
+{
+ dividerDragEnd(document.getElementById("splitter"), topAreaResizeDrag, topAreaResizeDragEnd, event);
+}
</ins></span></pre>
</div>
</div>
</body>
</html>