<!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>[20698] branches/WebInspectorRefresh/WebKit/WebInspector</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/20698">20698</a></dd>
<dt>Author</dt> <dd>thatcher</dd>
<dt>Date</dt> <dd>2007-04-03 23:39:11 -0700 (Tue, 03 Apr 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>Convert the Web Inspector NSOutlineView into an HTML and JavaScript based tree view. Not everything is working yet.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchesWebInspectorRefreshWebKitWebInspectorWebInspectorh">branches/WebInspectorRefresh/WebKit/WebInspector/WebInspector.h</a></li>
<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="#branchesWebInspectorRefreshWebKitWebInspectorwebInspectorinspectorcss">branches/WebInspectorRefresh/WebKit/WebInspector/webInspector/inspector.css</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>

<h3>Removed Paths</h3>
<ul>
<li><a href="#branchesWebInspectorRefreshWebKitWebInspectorWebInspectorOutlineViewh">branches/WebInspectorRefresh/WebKit/WebInspector/WebInspectorOutlineView.h</a></li>
<li><a href="#branchesWebInspectorRefreshWebKitWebInspectorWebInspectorOutlineViewm">branches/WebInspectorRefresh/WebKit/WebInspector/WebInspectorOutlineView.m</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchesWebInspectorRefreshWebKitWebInspectorWebInspectorh"></a>
<div class="modfile"><h4>Modified: branches/WebInspectorRefresh/WebKit/WebInspector/WebInspector.h (20697 => 20698)</h4>
<pre class="diff"><span>
<span class="info">--- branches/WebInspectorRefresh/WebKit/WebInspector/WebInspector.h        2007-04-04 06:36:41 UTC (rev 20697)
+++ branches/WebInspectorRefresh/WebKit/WebInspector/WebInspector.h        2007-04-04 06:39:11 UTC (rev 20698)
</span><span class="lines">@@ -52,6 +52,4 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)setSearchQuery:(NSString *)query;
</span><span class="cx"> - (NSString *)searchQuery;
</span><del>-
-- (NSArray *)searchResults;
</del><span class="cx"> @end
</span></span></pre></div>
<a id="branchesWebInspectorRefreshWebKitWebInspectorWebInspectorm"></a>
<div class="modfile"><h4>Modified: branches/WebInspectorRefresh/WebKit/WebInspector/WebInspector.m (20697 => 20698)</h4>
<pre class="diff"><span>
<span class="info">--- branches/WebInspectorRefresh/WebKit/WebInspector/WebInspector.m        2007-04-04 06:36:41 UTC (rev 20697)
+++ branches/WebInspectorRefresh/WebKit/WebInspector/WebInspector.m        2007-04-04 06:39:11 UTC (rev 20698)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -31,27 +31,16 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;WebFrame.h&quot;
</span><span class="cx"> #import &quot;WebFrameInternal.h&quot;
</span><del>-#import &quot;WebHTMLView.h&quot;
-#import &quot;WebInspectorOutlineView.h&quot;
</del><span class="cx"> #import &quot;WebInspectorPanel.h&quot;
</span><del>-#import &quot;WebKitNSStringExtras.h&quot;
-#import &quot;WebLocalizableStrings.h&quot;
</del><span class="cx"> #import &quot;WebNodeHighlight.h&quot;
</span><span class="cx"> #import &quot;WebPreferences.h&quot;
</span><del>-#import &quot;WebTypesInternal.h&quot;
</del><ins>+#import &quot;WebScriptDebugDelegate.h&quot;
</ins><span class="cx"> #import &quot;WebView.h&quot;
</span><span class="cx"> #import &quot;WebViewPrivate.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #import &lt;WebKit/DOMCore.h&gt;
</span><del>-#import &lt;WebKit/DOMHTML.h&gt;
-#import &lt;WebKit/DOMCSS.h&gt;
</del><span class="cx"> #import &lt;WebKit/DOMExtensions.h&gt;
</span><del>-#import &lt;WebKit/DOMPrivate.h&gt;
</del><span class="cx"> 
</span><del>-static NSMapTable *lengthIgnoringWhitespaceCache = NULL;
-static NSMapTable *lastChildIndexIgnoringWhitespaceCache = NULL;
-static NSMapTable *lastChildIgnoringWhitespaceCache = NULL;
-
</del><span class="cx"> @interface NSWindow (NSWindowPrivate)
</span><span class="cx"> - (void)_setContentHasShadow:(BOOL)hasShadow;
</span><span class="cx"> @end
</span><span class="lines">@@ -81,8 +70,6 @@
</span><span class="cx">     [self setWindowFrameAutosaveName:@&quot;Web Inspector&quot;];
</span><span class="cx"> 
</span><span class="cx">     _private = [[WebInspectorPrivate alloc] init];
</span><del>-    _private-&gt;ignoreWhitespace = YES;
-    _private-&gt;showUserAgentStyles = YES;
</del><span class="cx"> 
</span><span class="cx">     return self;
</span><span class="cx"> }
</span><span class="lines">@@ -139,6 +126,9 @@
</span><span class="cx">         [_private-&gt;webView setPreferences:preferences];
</span><span class="cx">         [_private-&gt;webView setFrameLoadDelegate:self];
</span><span class="cx">         [_private-&gt;webView setUIDelegate:self];
</span><ins>+#ifndef NDEBUG
+        [_private-&gt;webView setScriptDebugDelegate:self];
+#endif
</ins><span class="cx">         [_private-&gt;webView setDrawsBackground:NO];
</span><span class="cx">         [_private-&gt;webView setProhibitsMainFrameScrolling:YES];
</span><span class="cx">         [_private-&gt;webView _setDashboardBehavior:WebDashboardBehaviorAlwaysSendMouseEventsToAllWindows to:YES];
</span><span class="lines">@@ -205,7 +195,6 @@
</span><span class="cx">         [_private-&gt;webFrame _addInspector:self];
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    [_private-&gt;treeOutlineView setAllowsEmptySelection:NO];
</del><span class="cx">     _private-&gt;preventHighlight = YES;
</span><span class="cx">     [self setFocusedDOMNode:[webFrame DOMDocument]];
</span><span class="cx">     _private-&gt;preventHighlight = NO;
</span><span class="lines">@@ -255,7 +244,6 @@
</span><span class="cx">     if (!_private-&gt;webViewLoaded)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    [self _revealAndSelectNodeInTree:node];
</del><span class="cx">     [self _update];
</span><span class="cx"> 
</span><span class="cx">     if (!_private-&gt;preventHighlight) {
</span><span class="lines">@@ -309,13 +297,6 @@
</span><span class="cx"> {
</span><span class="cx">     return _private-&gt;searchQuery;
</span><span class="cx"> }
</span><del>-
-#pragma mark -
-
-- (NSArray *)searchResults
-{
-    return [NSArray arrayWithArray:_private-&gt;searchResults];
-}
</del><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #pragma mark -
</span><span class="lines">@@ -326,19 +307,27 @@
</span><span class="cx">     NSMenu *menu = [[NSMenu alloc] init];
</span><span class="cx">     [menu setAutoenablesItems:NO];
</span><span class="cx"> 
</span><del>-    NSMenuItem *item = [[[NSMenuItem alloc] init] autorelease];
</del><ins>+    NSMenuItem *item = [[NSMenuItem alloc] init];
</ins><span class="cx">     [item setTitle:@&quot;Ignore Whitespace&quot;];
</span><span class="cx">     [item setTarget:self];
</span><span class="cx">     [item setAction:@selector(_toggleIgnoreWhitespace:)];
</span><del>-    [item setState:_private-&gt;ignoreWhitespace];
</del><ins>+
+    id value = [[_private-&gt;webView windowScriptObject] valueForKey:@&quot;ignoreWhitespace&quot;];
+    [item setState:( value &amp;&amp; [value isKindOfClass:[NSNumber class]] &amp;&amp; [value boolValue] ? NSOnState : NSOffState )];
+
</ins><span class="cx">     [menu addItem:item];
</span><ins>+    [item release];
</ins><span class="cx"> 
</span><del>-    item = [[[NSMenuItem alloc] init] autorelease];
</del><ins>+    item = [[NSMenuItem alloc] init];
</ins><span class="cx">     [item setTitle:@&quot;Show User Agent Styles&quot;];
</span><span class="cx">     [item setTarget:self];
</span><span class="cx">     [item setAction:@selector(_toggleShowUserAgentStyles:)];
</span><del>-    [item setState:_private-&gt;showUserAgentStyles];
</del><ins>+
+    value = [[_private-&gt;webView windowScriptObject] valueForKey:@&quot;showUserAgentStyles&quot;];
+    [item setState:( value &amp;&amp; [value isKindOfClass:[NSNumber class]] &amp;&amp; [value boolValue] ? NSOnState : NSOffState )];
+
</ins><span class="cx">     [menu addItem:item];
</span><ins>+    [item release];
</ins><span class="cx"> 
</span><span class="cx">     [NSMenu popUpContextMenu:menu withEvent:[[self window] currentEvent] forView:_private-&gt;webView];
</span><span class="cx">     [menu release];
</span><span class="lines">@@ -349,22 +338,6 @@
</span><span class="cx">     [[[[_private-&gt;webView mainFrame] frameView] documentView] mouseUp:event];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)selectNewRoot:(DOMHTMLSelectElement *)popup
-{
-    unsigned index = [popup selectedIndex];
-    unsigned count = 0;
-
-    DOMNode *currentNode = [self rootDOMNode];
-    while (currentNode) {
-        if (count == index) {
-            [self setRootDOMNode:currentNode];
-            break;
-        }
-        count++;
-        currentNode = [currentNode parentNode];
-    }
-}
-
</del><span class="cx"> - (void)resizeTopArea
</span><span class="cx"> {
</span><span class="cx">     NSWindow *window = [self window];
</span><span class="lines">@@ -403,16 +376,13 @@
</span><span class="cx">             proposedRect.size.height = maxSize.height;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        NSNumber *baseValue = [topArea valueForKey:@&quot;clientHeight&quot;];
-        NSString *newValue = [NSString stringWithFormat:@&quot;%dpx&quot;, [baseValue unsignedLongValue] - delta];
</del><ins>+        NSString *newValue = [NSString stringWithFormat:@&quot;%dpx&quot;, [topArea clientHeight] - delta];
</ins><span class="cx">         [[topArea style] setProperty:@&quot;height&quot; value:newValue priority:@&quot;&quot;];
</span><span class="cx"> 
</span><del>-        baseValue = [splitter valueForKey:@&quot;offsetTop&quot;];
-        newValue = [NSString stringWithFormat:@&quot;%dpx&quot;, [baseValue unsignedLongValue] - delta];
</del><ins>+        newValue = [NSString stringWithFormat:@&quot;%dpx&quot;, [splitter offsetTop] - delta];
</ins><span class="cx">         [[splitter style] setProperty:@&quot;top&quot; value:newValue priority:@&quot;&quot;];
</span><span class="cx"> 
</span><del>-        baseValue = [bottomArea valueForKey:@&quot;offsetTop&quot;];
-        newValue = [NSString stringWithFormat:@&quot;%dpx&quot;, [baseValue unsignedLongValue] - delta];
</del><ins>+        newValue = [NSString stringWithFormat:@&quot;%dpx&quot;, [bottomArea offsetTop] - delta];
</ins><span class="cx">         [[bottomArea style] setProperty:@&quot;top&quot; value:newValue priority:@&quot;&quot;];
</span><span class="cx"> 
</span><span class="cx">         [window setFrame:proposedRect display:YES];
</span><span class="lines">@@ -425,113 +395,6 @@
</span><span class="cx">     // post the mouse up event back to the queue so the WebView can get it
</span><span class="cx">     [window postEvent:event atStart:YES];
</span><span class="cx"> }
</span><del>-
-- (void)treeViewScrollTo:(float)number
-{
-    float bottom = NSHeight([_private-&gt;treeOutlineView frame]) - NSHeight([_private-&gt;treeScrollView documentVisibleRect]);
-    number = MAX(0.0f, MIN(bottom, number));
-    [[_private-&gt;treeScrollView contentView] scrollToPoint:NSMakePoint(0.0f, number)];
-}
-
-- (float)treeViewOffsetTop
-{
-    return NSMinY([_private-&gt;treeScrollView documentVisibleRect]);
-}
-
-- (float)treeViewScrollHeight
-{
-    return NSHeight([_private-&gt;treeOutlineView frame]);
-}
-
-- (void)traverseTreeBackward
-{
-    if (_private-&gt;searchResultsVisible) {
-        // if we have a search showing, we will only walk up and down the results
-        int row = [_private-&gt;treeOutlineView selectedRow];
-        if (row == -1)
-            return;
-        if ((row - 1) &gt;= 0) {
-            row--;
-            [_private-&gt;treeOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
-            [_private-&gt;treeOutlineView scrollRowToVisible:row];
-        }
-        return;
-    }
-
-    DOMNode *node =  nil;
-    // traverse backward, holding opton will traverse only to the previous sibling
-    if ([[[self window] currentEvent] modifierFlags] &amp; NSAlternateKeyMask) {
-        if (!_private-&gt;ignoreWhitespace)
-            node = [_private-&gt;focusedNode previousSibling];
-        else
-            node = [_private-&gt;focusedNode _previousSiblingSkippingWhitespace];
-    } else {
-        if (!_private-&gt;ignoreWhitespace)
-            node = [_private-&gt;focusedNode _traversePreviousNode];
-        else
-            node = [_private-&gt;focusedNode _traversePreviousNodeSkippingWhitespace];
-    }
-
-    if (node) {
-        DOMNode *root = [self rootDOMNode];
-        if (![root isSameNode:node] &amp;&amp; ![root _isAncestorOfNode:node])
-            [self setRootDOMNode:[[self focusedDOMNode] _firstAncestorCommonWithNode:node]];
-        [self setFocusedDOMNode:node];
-    }
-}
-
-- (void)traverseTreeForward
-{
-    if (_private-&gt;searchResultsVisible) {
-        // if we have a search showing, we will only walk up and down the results
-        int row = [_private-&gt;treeOutlineView selectedRow];
-        if (row == -1)
-            return;
-        if ((row + 1) &lt; (int)[_private-&gt;searchResults count]) {
-            row++;
-            [_private-&gt;treeOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
-            [_private-&gt;treeOutlineView scrollRowToVisible:row];
-        }
-        return;
-    }
-
-    DOMNode *node =  nil;
-    // traverse forward, holding opton will traverse only to the next sibling
-    if ([[[self window] currentEvent] modifierFlags] &amp; NSAlternateKeyMask) {
-        if (!_private-&gt;ignoreWhitespace)
-            node = [_private-&gt;focusedNode nextSibling];
-        else
-            node = [_private-&gt;focusedNode _nextSiblingSkippingWhitespace];
-    } else {
-        if (!_private-&gt;ignoreWhitespace)
-            node = [_private-&gt;focusedNode _traverseNextNodeStayingWithin:nil];
-        else
-            node = [_private-&gt;focusedNode _traverseNextNodeSkippingWhitespaceStayingWithin:nil];
-    }
-
-    if (node) {
-        DOMNode *root = [self rootDOMNode];
-        if (![root isSameNode:node] &amp;&amp; ![root _isAncestorOfNode:node])
-            [self setRootDOMNode:[[self focusedDOMNode] _firstAncestorCommonWithNode:node]];
-        [self setFocusedDOMNode:node];
-    }
-}
-
-- (void)searchPerformed:(NSString *)query
-{
-    [query retain];
-    [_private-&gt;searchQuery release];
-    _private-&gt;searchQuery = query;
-
-    BOOL show = [query length];
-    if (show != _private-&gt;searchResultsVisible) {
-        [_private-&gt;treeOutlineView setDoubleAction:(show ? @selector(_exitSearch:) : @selector(_focusRootNode:))];
-        _private-&gt;preventRevealOnFocus = show;
-        _private-&gt;searchResultsVisible = show;
-    }
-
-    [self _refreshSearch];
-}
</del><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #pragma mark -
</span><span class="lines">@@ -539,16 +402,14 @@
</span><span class="cx"> @implementation WebInspector (WebInspectorPrivate)
</span><span class="cx"> - (IBAction)_toggleIgnoreWhitespace:(id)sender
</span><span class="cx"> {
</span><del>-    _private-&gt;ignoreWhitespace = !_private-&gt;ignoreWhitespace;
-    [_private-&gt;treeOutlineView reloadData];
-    [self _updateTreeScrollbar];
</del><ins>+    if (_private-&gt;webViewLoaded)
+        [[_private-&gt;webView windowScriptObject] callWebScriptMethod:@&quot;toggleIgnoreWhitespace&quot; withArguments:nil];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (IBAction)_toggleShowUserAgentStyles:(id)sender
</span><span class="cx"> {
</span><del>-    _private-&gt;showUserAgentStyles = !_private-&gt;showUserAgentStyles;
</del><span class="cx">     if (_private-&gt;webViewLoaded)
</span><del>-        [[_private-&gt;webView windowScriptObject] evaluateWebScript:@&quot;toggleShowUserAgentStyles()&quot;];
</del><ins>+        [[_private-&gt;webView windowScriptObject] callWebScriptMethod:@&quot;toggleShowUserAgentStyles&quot; withArguments:nil];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_highlightNode:(DOMNode *)node
</span><span class="lines">@@ -577,7 +438,7 @@
</span><span class="cx">         if (![rects count])
</span><span class="cx">             rects = [NSArray arrayWithObject:[NSValue valueWithRect:bounds]];
</span><span class="cx"> 
</span><del>-        if ([view window])      // skip the highlight if we have no window (e.g. hidden tab)
</del><ins>+        if ([view window]) // skip the highlight if we have no window (e.g. hidden tab)
</ins><span class="cx">             _private-&gt;currentHighlight = [[WebNodeHighlight alloc] initWithBounds:bounds andRects:rects forView:view];
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -590,137 +451,6 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_exitSearch:(id)sender
-{
-    [self setSearchQuery:nil];
-}
-
-- (void)_focusRootNode:(id)sender
-{
-    int index = [_private-&gt;treeOutlineView selectedRow];
-    if (index == -1 || !_private-&gt;treeOutlineView)
-        return;
-    DOMNode *node = [_private-&gt;treeOutlineView itemAtRow:index];
-    if (![node isSameNode:[self rootDOMNode]])
-        [self setRootDOMNode:node];
-}
-
-- (void)_revealAndSelectNodeInTree:(DOMNode *)node
-{
-    if (!_private-&gt;webViewLoaded)
-        return;
-
-    if (!_private-&gt;preventRevealOnFocus) {
-        NSMutableArray *ancestors = [[NSMutableArray alloc] init];
-        DOMNode *currentNode = [node parentNode];
-        while (currentNode) {
-            [ancestors addObject:currentNode];
-            if ([currentNode isSameNode:[self rootDOMNode]])
-                break;
-            currentNode = [currentNode parentNode];
-        }
-
-        NSEnumerator *enumerator = [ancestors reverseObjectEnumerator];
-        while ((currentNode = [enumerator nextObject]))
-            [_private-&gt;treeOutlineView expandItem:currentNode];
-
-        [ancestors release];
-    }
-
-    int index = [_private-&gt;treeOutlineView rowForItem:node];
-    if (index != -1) {
-        [_private-&gt;treeOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:index] byExtendingSelection:NO];
-        [_private-&gt;treeOutlineView scrollRowToVisible:index];
-    } else {
-        [_private-&gt;treeOutlineView deselectAll:self];
-    }
-    [self _updateTreeScrollbar];
-}
-
-- (void)_refreshSearch
-{
-    BOOL selectFirst = ![_private-&gt;searchResults count];
-
-    if (!_private-&gt;searchResults)
-        _private-&gt;searchResults = [[NSMutableArray alloc] initWithCapacity:100];
-    else
-        [_private-&gt;searchResults removeAllObjects];
-
-    NSString *query = _private-&gt;searchQuery;
-    if (![query length]) {
-        // switch back to the DOM tree and reveal the focused node
-        DOMNode *node = [[self focusedDOMNode] retain];
-        DOMNode *root = [self rootDOMNode];
-        if (![root _isAncestorOfNode:node])
-            [self setRootDOMNode:[node parentNode]];
-
-        _private-&gt;preventSelectionRefocus = YES;
-        [_private-&gt;treeOutlineView reloadData];
-        _private-&gt;preventSelectionRefocus = NO;
-
-        [self _revealAndSelectNodeInTree:node];
-        [self _updateTraversalButtons];
-        [node release];
-
-        [[_private-&gt;webView windowScriptObject] callWebScriptMethod:@&quot;toggleNoSelection&quot; withArguments:[NSArray arrayWithObject:[NSNumber numberWithBool:NO]]];
-        return;
-    }
-
-    unsigned count = 0;
-    DOMNode *node = nil;
-
-    if ([query hasPrefix:@&quot;/&quot;]) {
-        // search document by Xpath query
-        id nodeList = [[_private-&gt;webView windowScriptObject] callWebScriptMethod:@&quot;resultsWithXpathQuery&quot; withArguments:[NSArray arrayWithObject:query]];
-        if ([nodeList isKindOfClass:[WebScriptObject class]]) {
-            if ([[nodeList valueForKey:@&quot;snapshotLength&quot;] isKindOfClass:[NSNumber class]]) {
-                count = [[nodeList valueForKey:@&quot;snapshotLength&quot;] unsignedLongValue];
-                for( unsigned i = 0; i &lt; count; i++ ) {
-                    NSNumber *index = [[NSNumber alloc] initWithUnsignedLong:i];
-                    NSArray *args = [[NSArray alloc] initWithObjects:&amp;index count:1];
-                    node = [nodeList callWebScriptMethod:@&quot;snapshotItem&quot; withArguments:args];
-                    if (node)
-                        [_private-&gt;searchResults addObject:node];
-                    [args release];
-                    [index release];
-                }
-            }
-        }
-    } else {
-        // search nodes by node name, node value, id and class name
-        node = [_private-&gt;webFrame DOMDocument];
-        while ((node = [node _traverseNextNodeStayingWithin:nil])) {
-            BOOL matched = NO;
-            if ([[node nodeName] _webkit_hasCaseInsensitiveSubstring:query])
-                matched = YES;
-            else if ([node nodeType] == DOM_TEXT_NODE &amp;&amp; [[node nodeValue] _webkit_hasCaseInsensitiveSubstring:query])
-                matched = YES;
-            else if ([node isKindOfClass:[DOMHTMLElement class]] &amp;&amp; [[(DOMHTMLElement *)node idName] _webkit_hasCaseInsensitiveSubstring:query])
-                matched = YES;
-            else if ([node isKindOfClass:[DOMHTMLElement class]] &amp;&amp; [[(DOMHTMLElement *)node className] _webkit_hasCaseInsensitiveSubstring:query])
-                matched = YES;
-            if (matched) {
-                [_private-&gt;searchResults addObject:node];
-                count++;
-            }
-        }
-    }
-
-    DOMHTMLElement *searchCount = (DOMHTMLElement *)[_private-&gt;domDocument getElementById:@&quot;searchCount&quot;];
-    if (count == 1)
-        [searchCount setInnerText:@&quot;1 node&quot;];
-    else
-        [searchCount setInnerText:[NSString stringWithFormat:@&quot;%u nodes&quot;, count]];
-
-    [_private-&gt;treeOutlineView reloadData];
-    [self _updateTreeScrollbar];
-
-    [[_private-&gt;webView windowScriptObject] callWebScriptMethod:@&quot;toggleNoSelection&quot; withArguments:[NSArray arrayWithObject:[NSNumber numberWithBool:!count]]];
-
-    if (selectFirst &amp;&amp; count)
-        [_private-&gt;treeOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:0] byExtendingSelection:NO];
-}
-
</del><span class="cx"> - (void)_update
</span><span class="cx"> {
</span><span class="cx">     if (_private-&gt;webViewLoaded) {
</span><span class="lines">@@ -732,62 +462,18 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_updateTraversalButtons
-{
-    DOMNode *node = [self focusedDOMNode];
-    DOMHTMLButtonElement *back = (DOMHTMLButtonElement *)[_private-&gt;domDocument getElementById:@&quot;traverseUp&quot;];
-    DOMHTMLButtonElement *forward = (DOMHTMLButtonElement *)[_private-&gt;domDocument getElementById:@&quot;traverseDown&quot;];
-    if (_private-&gt;searchResultsVisible) {
-        int row = [_private-&gt;treeOutlineView selectedRow];
-        if (row != -1) {
-            [forward setDisabled:!((row + 1) &lt; (int)[_private-&gt;searchResults count])];
-            [back setDisabled:!((row - 1) &gt;= 0)];
-        }
-    } else {
-        if (!_private-&gt;ignoreWhitespace)
-            node = [_private-&gt;focusedNode _traverseNextNodeStayingWithin:nil];
-        else
-            node = [_private-&gt;focusedNode _traverseNextNodeSkippingWhitespaceStayingWithin:nil];
-        [forward setDisabled:!node];
-
-        if (!_private-&gt;ignoreWhitespace)
-            node = [_private-&gt;focusedNode _traversePreviousNode];
-        else
-            node = [_private-&gt;focusedNode _traversePreviousNodeSkippingWhitespace];
-        [back setDisabled:!node];
-    }
-}
-
</del><span class="cx"> - (void)_updateRoot
</span><span class="cx"> {
</span><del>-    if (!_private-&gt;webViewLoaded || _private-&gt;searchResultsVisible)
</del><ins>+    if (!_private-&gt;webViewLoaded)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    DOMHTMLElement *popup = (DOMHTMLElement *)[_private-&gt;domDocument getElementById:@&quot;treePopup&quot;];
-    [popup setInnerHTML:@&quot;&quot;]; // reset the list
-
-    DOMNode *currentNode = [self rootDOMNode];
-    while (currentNode) {
-        DOMHTMLOptionElement *option = (DOMHTMLOptionElement *)[_private-&gt;domDocument createElement:@&quot;option&quot;];
-        [option setTextContent:[currentNode _displayName]];
-        [popup appendChild:option];
-        currentNode = [currentNode parentNode];
-    }
-
-    _private-&gt;preventSelectionRefocus = YES;
-    DOMNode *focusedNode = [[self focusedDOMNode] retain];
-    [_private-&gt;treeOutlineView reloadData];
-    if ([self rootDOMNode])
-        [_private-&gt;treeOutlineView expandItem:[self rootDOMNode]];
-    [self _revealAndSelectNodeInTree:focusedNode];
-    [focusedNode release];
-    _private-&gt;preventSelectionRefocus = NO;
</del><ins>+    [[_private-&gt;webView windowScriptObject] callWebScriptMethod:@&quot;updateTreeOutline&quot; withArguments:nil];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_updateTreeScrollbar
</span><span class="cx"> {
</span><span class="cx">     if (_private-&gt;webViewLoaded)
</span><del>-        [[_private-&gt;webView windowScriptObject] evaluateWebScript:@&quot;treeScrollbar.refresh()&quot;];
</del><ins>+        [[_private-&gt;webView windowScriptObject] evaluateWebScript:@&quot;treeOutlineScrollArea.refresh()&quot;];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_updateSystemColors
</span><span class="lines">@@ -799,8 +485,8 @@
</span><span class="cx">     NSColor *color = [[NSColor alternateSelectedControlColor] colorUsingColorSpaceName:NSDeviceRGBColorSpace];
</span><span class="cx">     [color getRed:&amp;red green:&amp;green blue:&amp;blue alpha:NULL];
</span><span class="cx"> 
</span><del>-    NSString *colorText = [NSString stringWithFormat:@&quot;background-color: rgba(%d, %d, %d, 0.4) !important&quot;, (int)(red * 255), (int)(green * 255), (int)(blue * 255)];
-    NSString *styleText = [NSString stringWithFormat:@&quot;#styleRulesScrollview &gt; .row.focused { %@ }; .treeList li.focused { %1$@ }&quot;, colorText];
</del><ins>+    NSString *colorText = [NSString stringWithFormat:@&quot;rgba(%d,%d,%d,0.4) !important&quot;, (int)(red * 255), (int)(green * 255), (int)(blue * 255)];
+    NSString *styleText = [NSString stringWithFormat:@&quot;.focused .selected { background-color: %1$@ } .blured .selected { border-color: %1$@ }&quot;, colorText];
</ins><span class="cx">     DOMElement *style = [_private-&gt;domDocument getElementById:@&quot;systemColors&quot;];
</span><span class="cx">     if (!style) {
</span><span class="cx">         style = [_private-&gt;domDocument createElement:@&quot;style&quot;];
</span><span class="lines">@@ -825,8 +511,6 @@
</span><span class="cx"> {
</span><span class="cx">     [self setFocusedDOMNode:nil];
</span><span class="cx">     [self setWebFrame:nil];
</span><del>-    [_private-&gt;treeOutlineView setAllowsEmptySelection:YES];
-    [_private-&gt;treeOutlineView deselectAll:self];
</del><span class="cx">     [self _update];
</span><span class="cx">     [self _updateRoot];
</span><span class="cx"> }
</span><span class="lines">@@ -886,189 +570,46 @@
</span><span class="cx">     [self _highlightNode:[self focusedDOMNode]];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (NSView *)webView:(WebView *)sender plugInViewWithArguments:(NSDictionary *)arguments
</del><ins>+- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame
</ins><span class="cx"> {
</span><del>-    NSDictionary *attributes = [arguments objectForKey:@&quot;WebPlugInAttributesKey&quot;];
-    if ([[attributes objectForKey:@&quot;type&quot;] isEqualToString:@&quot;application/x-inspector-tree&quot;]) {
-        if (!_private-&gt;treeOutlineView) {
-            _private-&gt;treeScrollView = [[NSScrollView alloc] initWithFrame:NSMakeRect(0.0f, 0.0f, 250.0f, 100.0f)];
-            [_private-&gt;treeScrollView setDrawsBackground:NO];
-            [_private-&gt;treeScrollView setBorderType:NSNoBorder];
-            [_private-&gt;treeScrollView setVerticalScroller:NO];
-            [_private-&gt;treeScrollView setHasHorizontalScroller:NO];
-            [_private-&gt;treeScrollView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
-            [_private-&gt;treeScrollView setFocusRingType:NSFocusRingTypeNone];
-
-            _private-&gt;treeOutlineView = [[WebInspectorOutlineView alloc] initWithFrame:[_private-&gt;treeScrollView frame]];
-            [_private-&gt;treeOutlineView setHeaderView:nil];
-            [_private-&gt;treeOutlineView setAllowsMultipleSelection:NO];
-            [_private-&gt;treeOutlineView setAllowsEmptySelection:NO];
-            [_private-&gt;treeOutlineView setDelegate:self];
-            [_private-&gt;treeOutlineView setDataSource:self];
-            [_private-&gt;treeOutlineView sendActionOn:(NSLeftMouseUpMask | NSLeftMouseDownMask | NSLeftMouseDraggedMask)];
-            [_private-&gt;treeOutlineView setFocusRingType:NSFocusRingTypeNone];
-            [_private-&gt;treeOutlineView setAutoresizesOutlineColumn:NO];
-            [_private-&gt;treeOutlineView setRowHeight:15.0f];
-            [_private-&gt;treeOutlineView setTarget:self];
-            [_private-&gt;treeOutlineView setDoubleAction:@selector(_focusRootNode:)];
-            [_private-&gt;treeOutlineView setIndentationPerLevel:12.0f];
-            [_private-&gt;treeScrollView setDocumentView:_private-&gt;treeOutlineView];
-
-            NSCell *headerCell = [[NSCell alloc] initTextCell:@&quot;&quot;];
-            NSCell *dataCell = [[NSCell alloc] initTextCell:@&quot;&quot;];
-            [dataCell setFont:[NSFont systemFontOfSize:11.0f]];
-
-            NSTableColumn *tableColumn = [[NSTableColumn alloc] initWithIdentifier:@&quot;node&quot;];
-            [tableColumn setHeaderCell:headerCell];
-            [tableColumn setDataCell:dataCell];
-            [tableColumn setMinWidth:50];
-            [tableColumn setWidth:300];
-            [tableColumn setEditable:NO];
-            [_private-&gt;treeOutlineView addTableColumn:tableColumn];
-            [_private-&gt;treeOutlineView setOutlineTableColumn:tableColumn];
-
-            [_private-&gt;treeOutlineView sizeLastColumnToFit];
-
-            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_updateTreeScrollbar) name:NSViewFrameDidChangeNotification object:_private-&gt;treeOutlineView]; 
-        }
-
-        return [_private-&gt;treeOutlineView enclosingScrollView];
-    }
-
-    return nil;
</del><ins>+    NSLog(@&quot;%@&quot;, message);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-#pragma mark -
-
-- (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
</del><ins>+#ifndef NDEBUG
+- (void)webView:(WebView *)view didParseSource:(NSString *)source baseLineNumber:(unsigned)baseLine fromURL:(NSURL *)url sourceId:(int)sid forWebFrame:(WebFrame *)webFrame
</ins><span class="cx"> {
</span><del>-    DOMNode *node = item;
-    if (outlineView == _private-&gt;treeOutlineView) {
-        if (!node &amp;&amp; _private-&gt;searchResultsVisible)
-            return [_private-&gt;searchResults count];
-        if (!node)
-            return 1;
-        if (!_private-&gt;ignoreWhitespace)
-            return [[node childNodes] length];
-        return [node _lengthOfChildNodesIgnoringWhitespace];
-    }
-    return 0;
</del><ins>+    if (!_private-&gt;debugFileMap)
+        _private-&gt;debugFileMap = [[NSMutableDictionary alloc] init];
+    if (url)
+        [_private-&gt;debugFileMap setObject:url forKey:[NSNumber numberWithInt:sid]];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
</del><ins>+- (void)webView:(WebView *)view exceptionWasRaised:(WebScriptCallFrame *)frame sourceId:(int)sid line:(int)lineno forWebFrame:(WebFrame *)webFrame
</ins><span class="cx"> {
</span><del>-    DOMNode *node = item;
-    if (outlineView == _private-&gt;treeOutlineView) {
-        if (!_private-&gt;ignoreWhitespace)
-            return [node hasChildNodes];
-        return ([node _firstChildSkippingWhitespace] ? YES : NO);
-    }
-    return NO;
-}
</del><ins>+    NSURL *url = [_private-&gt;debugFileMap objectForKey:[NSNumber numberWithInt:sid]];
+    NSLog(@&quot;JS exception: %@ line %d&quot;, url, lineno);
</ins><span class="cx"> 
</span><del>-- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item
-{
-    DOMNode *parent = item;
-    if (outlineView == _private-&gt;treeOutlineView) {
-        if (!parent &amp;&amp; _private-&gt;searchResultsVisible)
-            return [_private-&gt;searchResults objectAtIndex:index];
-        if (!parent)
-            return [self rootDOMNode];
-        id node = nil;
-        if (!_private-&gt;ignoreWhitespace)
-            node = [[parent childNodes] item:index];
</del><ins>+    NSMutableArray *stack = [[NSMutableArray alloc] init];
+    WebScriptCallFrame *currentFrame = frame;
+    while (currentFrame) {
+        if ([currentFrame functionName])
+            [stack addObject:[currentFrame functionName]];
+        else if ([frame caller])
+            [stack addObject:@&quot;(anonymous function)&quot;];
</ins><span class="cx">         else
</span><del>-            node = [parent _childNodeAtIndexIgnoringWhitespace:index];
-        if (!node)
-            return nil;
-        // cache the node because NSOutlineView assumes we hold on to it
-        // if we don't hold on to the node it will be released before the next time the NSOutlineView needs it
-        [_private-&gt;nodeCache addObject:node];
-        return node;
</del><ins>+            [stack addObject:@&quot;(global scope)&quot;];
+        currentFrame = [currentFrame caller];
</ins><span class="cx">     }
</span><del>-    return nil;
-}
</del><span class="cx"> 
</span><del>-- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
-{
-    DOMNode *node = item;
-    if (outlineView == _private-&gt;treeOutlineView &amp;&amp; node) {
-        NSShadow *shadow = [[NSShadow alloc] init];
-        [shadow setShadowColor:[NSColor blackColor]];
-        [shadow setShadowBlurRadius:2.0f];
-        [shadow setShadowOffset:NSMakeSize(2.0f, -2.0f)];
-        NSMutableParagraphStyle *para = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
-        [para setLineBreakMode:NSLineBreakByTruncatingTail];
-        
-        NSDictionary *attrs = [[NSDictionary alloc] initWithObjectsAndKeys:[NSColor whiteColor], NSForegroundColorAttributeName, shadow, NSShadowAttributeName, para, NSParagraphStyleAttributeName, nil];
-        NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:[node _displayName] attributes:attrs];
-        [attrs release];
-
-        if ([node hasChildNodes] &amp;&amp; ![outlineView isItemExpanded:node]) {
-            attrs = [[NSDictionary alloc] initWithObjectsAndKeys:[NSColor colorWithCalibratedRed:1.0f green:1.0f blue:1.0f alpha:0.5f], NSForegroundColorAttributeName, shadow, NSShadowAttributeName, para, NSParagraphStyleAttributeName, nil];
-            NSAttributedString *preview = [[NSAttributedString alloc] initWithString:[node _contentPreview] attributes:attrs];
-            [string appendAttributedString:preview];
-            [attrs release];
-            [preview release];
-        }
-
-        [para release];
-        [shadow release];
-        return [string autorelease];
-    }
-
-    return nil;
</del><ins>+    NSLog(@&quot;Stack trace:\n%@&quot;, [stack componentsJoinedByString:@&quot;\n&quot;]);
+    [stack release];
</ins><span class="cx"> }
</span><del>-
-- (void)outlineView:(NSOutlineView *)outlineView willDisplayOutlineCell:(NSCell *)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
-{
-    if (outlineView == _private-&gt;treeOutlineView)
-        [cell setImage:([cell state] ? _private-&gt;downArrowImage : _private-&gt;rightArrowImage)];
-}
-
-- (void)outlineViewItemDidCollapse:(NSNotification *)notification
-{
-    if ([notification object] == _private-&gt;treeOutlineView) {
-        DOMNode *node = [[notification userInfo] objectForKey:@&quot;NSObject&quot;];
-        if (!node)
-            return;
-
-        // remove all child nodes from the node cache when the parent collapses
-        node = [node firstChild];
-        while (node) {
-            NSMapRemove(lengthIgnoringWhitespaceCache, node);
-            NSMapRemove(lastChildIndexIgnoringWhitespaceCache, node);
-            NSMapRemove(lastChildIgnoringWhitespaceCache, node);
-            [_private-&gt;nodeCache removeObject:node];
-            node = [node nextSibling];
-        }
-    }
-}
-
-- (void)outlineViewSelectionDidChange:(NSNotification *)notification
-{
-    if ([notification object] == _private-&gt;treeOutlineView &amp;&amp; !_private-&gt;preventSelectionRefocus &amp;&amp; _private-&gt;webViewLoaded) {
-        int index = [_private-&gt;treeOutlineView selectedRow];
-        if (index != -1)
-            [self setFocusedDOMNode:[_private-&gt;treeOutlineView itemAtRow:index]];
-        [self _updateTreeScrollbar];
-        [self _updateTraversalButtons];
-    }
-}
</del><ins>+#endif
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #pragma mark -
</span><span class="cx"> 
</span><span class="cx"> @implementation WebInspectorPrivate
</span><del>-- (id)init
-{
-    [super init];
-    nodeCache = [[NSMutableSet alloc] initWithCapacity:100];
-    rightArrowImage = [[NSImage alloc] initWithContentsOfFile:[[NSBundle bundleForClass:[self class]] pathForResource:@&quot;rightTriangle&quot; ofType:@&quot;png&quot; inDirectory:@&quot;webInspector/Images&quot;]];
-    downArrowImage = [[NSImage alloc] initWithContentsOfFile:[[NSBundle bundleForClass:[self class]] pathForResource:@&quot;downTriangle&quot; ofType:@&quot;png&quot; inDirectory:@&quot;webInspector/Images&quot;]];
-    return self;
-}
-
</del><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><span class="cx">     [webView release];
</span><span class="lines">@@ -1077,12 +618,10 @@
</span><span class="cx">     [rootNode release];
</span><span class="cx">     [focusedNode release];
</span><span class="cx">     [searchQuery release];
</span><del>-    [nodeCache release];
-    [treeScrollView release];
-    [treeOutlineView release];
</del><span class="cx">     [currentHighlight release];
</span><del>-    [rightArrowImage release];
-    [downArrowImage release];
</del><ins>+#ifndef NDEBUG
+    [debugFileMap release];
+#endif
</ins><span class="cx">     [super dealloc];
</span><span class="cx"> }
</span><span class="cx"> @end
</span><span class="lines">@@ -1090,35 +629,6 @@
</span><span class="cx"> #pragma mark -
</span><span class="cx"> 
</span><span class="cx"> @implementation DOMNode (DOMNodeInspectorAdditions)
</span><del>-- (NSString *)_contentPreview
-{
-    if (![self hasChildNodes])
-        return @&quot;&quot;;
-
-    unsigned limit = 0;
-    NSMutableString *preview = [[NSMutableString alloc] initWithCapacity:100];
-    [preview appendString:@&quot; &quot;];
-
-    // always skip whitespace here
-    DOMNode *currentNode = [self _traverseNextNodeSkippingWhitespaceStayingWithin:self];
-    while (currentNode) {
-        if ([currentNode nodeType] == DOM_TEXT_NODE)
-            [preview appendString:[[currentNode nodeValue] _webkit_stringByCollapsingWhitespaceCharacters]];
-        else
-            [preview appendString:[currentNode _displayName]];
-        currentNode = [currentNode _traverseNextNodeStayingWithin:self];
-        if (++limit &gt; 4) {
-            unichar ellipsis = 0x2026;
-            [preview appendString:[NSString stringWithCharacters:&amp;ellipsis length:1]];
-            break;
-        }
-    }
-
-    return [preview autorelease];
-}
-
-#pragma mark -
-
</del><span class="cx"> - (BOOL)_isAncestorOfNode:(DOMNode *)node
</span><span class="cx"> {
</span><span class="cx">     DOMNode *currentNode = [node parentNode];
</span><span class="lines">@@ -1129,269 +639,4 @@
</span><span class="cx">     }
</span><span class="cx">     return NO;
</span><span class="cx"> }
</span><del>-
-- (BOOL)_isDescendantOfNode:(DOMNode *)node
-{
-    return [node _isAncestorOfNode:self];
-}
-
-#pragma mark -
-
-- (BOOL)_isWhitespace
-{
-    static NSCharacterSet *characters = nil;
-    if (!characters)
-        characters = [[[NSCharacterSet whitespaceAndNewlineCharacterSet] invertedSet] retain];
-    NSRange range = [[self nodeValue] rangeOfCharacterFromSet:characters];
-    return (range.location == NSNotFound);
-}
-
-- (unsigned long)_lengthOfChildNodesIgnoringWhitespace
-{
-    if (!lengthIgnoringWhitespaceCache) {
-        NSMapTableValueCallBacks integerMapValueCallBacks = {NULL, NULL, NULL};
-        lengthIgnoringWhitespaceCache = NSCreateMapTable(NSObjectMapKeyCallBacks, integerMapValueCallBacks, 300);
-    }
-
-    void *lookup = NSMapGet(lengthIgnoringWhitespaceCache, self);
-    if (lookup)
-        return (unsigned long)lookup;
-
-    unsigned long count = 0;
-    DOMNode *node = [self _firstChildSkippingWhitespace];
-    while (node) {
-        node = [node _nextSiblingSkippingWhitespace];
-        count++;
-    }
-
-    NSMapInsert(lengthIgnoringWhitespaceCache, self, (void *)count);
-    return count;
-}
-
-- (DOMNode *)_childNodeAtIndexIgnoringWhitespace:(unsigned long)nodeIndex
-{
-    unsigned long count = 0;
-    DOMNode *node = nil;
-
-    if (!lastChildIgnoringWhitespaceCache)
-        lastChildIgnoringWhitespaceCache = NSCreateMapTable(NSObjectMapKeyCallBacks, NSObjectMapValueCallBacks, 300);
-    if (!lastChildIndexIgnoringWhitespaceCache) {
-        NSMapTableValueCallBacks integerMapValueCallBacks = {NULL, NULL, NULL};
-        lastChildIndexIgnoringWhitespaceCache = NSCreateMapTable(NSObjectMapKeyCallBacks, integerMapValueCallBacks, 300);
-    }
-
-    void *cachedLastIndex = NSMapGet(lastChildIndexIgnoringWhitespaceCache, self);
-    if (cachedLastIndex) {
-        DOMNode *lastChild = (DOMNode *)NSMapGet(lastChildIgnoringWhitespaceCache, self);
-        if (lastChild) {
-            unsigned long cachedIndex = (unsigned long)cachedLastIndex;
-            if (nodeIndex == cachedIndex) {
-                return lastChild;
-            } else if (nodeIndex &gt; cachedIndex) {
-                node = lastChild;
-                count = cachedIndex;
-            }
-        }
-    }
-
-    if (!node)
-        node = [self _firstChildSkippingWhitespace];
-
-    while (node &amp;&amp; count &lt; nodeIndex) {
-        node = [node _nextSiblingSkippingWhitespace];
-        count++;
-    }
-
-    if (node) {
-        NSMapInsert(lastChildIndexIgnoringWhitespaceCache, self, (void *)count);
-        NSMapInsert(lastChildIgnoringWhitespaceCache, self, node);
-    } else {
-        NSMapRemove(lastChildIndexIgnoringWhitespaceCache, self);
-        NSMapRemove(lastChildIgnoringWhitespaceCache, self);
-    }
-
-    return node;
-}
-
-#pragma mark -
-
-- (DOMNode *)_nextSiblingSkippingWhitespace
-{
-    DOMNode *node = [self nextSibling];
-    while ([node nodeType] == DOM_TEXT_NODE &amp;&amp; [node _isWhitespace])
-        node = [node nextSibling];
-    return node;
-}
-
-- (DOMNode *)_previousSiblingSkippingWhitespace
-{
-    DOMNode *node = [self previousSibling];
-    while ([node nodeType] == DOM_TEXT_NODE &amp;&amp; [node _isWhitespace])
-        node = [node previousSibling];
-    return node;
-}
-
-- (DOMNode *)_firstChildSkippingWhitespace
-{
-    DOMNode *node = [self firstChild];
-    while ([node nodeType] == DOM_TEXT_NODE &amp;&amp; [node _isWhitespace])
-        node = [node _nextSiblingSkippingWhitespace];
-    return node;
-}
-
-- (DOMNode *)_lastChildSkippingWhitespace
-{
-    DOMNode *node = [self lastChild];
-    while ([node nodeType] == DOM_TEXT_NODE &amp;&amp; [node _isWhitespace])
-        node = [node _previousSiblingSkippingWhitespace];
-    return node;
-}
-
-#pragma mark -
-
-- (DOMNode *)_firstAncestorCommonWithNode:(DOMNode *)node
-{
-    if ([[self parentNode] isSameNode:[node parentNode]])
-        return [self parentNode];
-
-    NSMutableArray *ancestorsOne = [[[NSMutableArray alloc] init] autorelease];
-    NSMutableArray *ancestorsTwo = [[[NSMutableArray alloc] init] autorelease];
-
-    DOMNode *currentNode = [self parentNode];
-    while (currentNode) {
-        [ancestorsOne addObject:currentNode];
-        currentNode = [currentNode parentNode];
-    }
-
-    currentNode = [node parentNode];
-    while (currentNode) {
-        [ancestorsTwo addObject:currentNode];
-        currentNode = [currentNode parentNode];
-    }
-
-    return [ancestorsOne firstObjectCommonWithArray:ancestorsTwo];
-}
-
-#pragma mark -
-
-- (DOMNode *)_traverseNextNodeStayingWithin:(DOMNode *)stayWithin
-{
-    DOMNode *node = [self firstChild];
-    if (node)
-        return node;
-
-    if ([self isSameNode:stayWithin])
-        return 0;
-
-    node = [self nextSibling];
-    if (node)
-        return node;
-
-    node = self;
-    while (node &amp;&amp; ![node nextSibling] &amp;&amp; (!stayWithin || ![[node parentNode] isSameNode:stayWithin]))
-        node = [node parentNode];
-
-    return [node nextSibling];
-}
-
-- (DOMNode *)_traverseNextNodeSkippingWhitespaceStayingWithin:(DOMNode *)stayWithin
-{
-    DOMNode *node = [self _firstChildSkippingWhitespace];
-    if (node)
-        return node;
-
-    if ([self isSameNode:stayWithin])
-        return 0;
-
-    node = [self _nextSiblingSkippingWhitespace];
-    if (node)
-        return node;
-
-    node = self;
-    while (node &amp;&amp; ![node _nextSiblingSkippingWhitespace] &amp;&amp; (!stayWithin || ![[node parentNode] isSameNode:stayWithin]))
-        node = [node parentNode];
-
-    return [node _nextSiblingSkippingWhitespace];
-}
-
-- (DOMNode *)_traversePreviousNode
-{
-    DOMNode *node = [self previousSibling];
-    while ([node lastChild])
-        node = [node lastChild];
-    if (node)
-        return node;
-    return [self parentNode];
-}
-
-- (DOMNode *)_traversePreviousNodeSkippingWhitespace
-{
-    DOMNode *node = [self _previousSiblingSkippingWhitespace];
-    while ([node _lastChildSkippingWhitespace])
-        node = [node _lastChildSkippingWhitespace];
-    if (node)
-        return node;
-    return [self parentNode];
-}
-
-#pragma mark -
-
-- (NSString *)_displayName
-{
-    switch([self nodeType]) {
-        case DOM_DOCUMENT_NODE:
-            return @&quot;Document&quot;;
-        case DOM_ELEMENT_NODE: {
-            if ([self hasAttributes]) {
-                NSMutableString *name = [NSMutableString stringWithFormat:@&quot;&lt;%@&quot;, [[self nodeName] lowercaseString]];
-                NSString *value = [(DOMElement *)self getAttribute:@&quot;id&quot;];
-                if ([value length])
-                    [name appendFormat:@&quot; id=\&quot;%@\&quot;&quot;, value];
-                value = [(DOMElement *)self getAttribute:@&quot;class&quot;];
-                if ([value length])
-                    [name appendFormat:@&quot; class=\&quot;%@\&quot;&quot;, value];
-                if ([[self nodeName] caseInsensitiveCompare:@&quot;a&quot;] == NSOrderedSame) {
-                    value = [(DOMElement *)self getAttribute:@&quot;name&quot;];
-                    if ([value length])
-                        [name appendFormat:@&quot; name=\&quot;%@\&quot;&quot;, value];
-                    value = [(DOMElement *)self getAttribute:@&quot;href&quot;];
-                    if ([value length])
-                        [name appendFormat:@&quot; href=\&quot;%@\&quot;&quot;, value];
-                } else if ([[self nodeName] caseInsensitiveCompare:@&quot;img&quot;] == NSOrderedSame) {
-                    value = [(DOMElement *)self getAttribute:@&quot;src&quot;];
-                    if ([value length])
-                        [name appendFormat:@&quot; src=\&quot;%@\&quot;&quot;, value];
-                } else if ([[self nodeName] caseInsensitiveCompare:@&quot;iframe&quot;] == NSOrderedSame) {
-                    value = [(DOMElement *)self getAttribute:@&quot;src&quot;];
-                    if ([value length])
-                        [name appendFormat:@&quot; src=\&quot;%@\&quot;&quot;, value];
-                } else if ([[self nodeName] caseInsensitiveCompare:@&quot;input&quot;] == NSOrderedSame) {
-                    value = [(DOMElement *)self getAttribute:@&quot;name&quot;];
-                    if ([value length])
-                        [name appendFormat:@&quot; name=\&quot;%@\&quot;&quot;, value];
-                    value = [(DOMElement *)self getAttribute:@&quot;type&quot;];
-                    if ([value length])
-                        [name appendFormat:@&quot; type=\&quot;%@\&quot;&quot;, value];
-                } else if ([[self nodeName] caseInsensitiveCompare:@&quot;form&quot;] == NSOrderedSame) {
-                    value = [(DOMElement *)self getAttribute:@&quot;action&quot;];
-                    if ([value length])
-                        [name appendFormat:@&quot; action=\&quot;%@\&quot;&quot;, value];
-                }
-                [name appendString:@&quot;&gt;&quot;];
-                return name;
-            }
-            return [NSString stringWithFormat:@&quot;&lt;%@&gt;&quot;, [[self nodeName] lowercaseString]];
-        }
-        case DOM_TEXT_NODE: {
-            if ([self _isWhitespace])
-                return @&quot;(whitespace)&quot;;
-            NSString *value = [[self nodeValue] _webkit_stringByCollapsingWhitespaceCharacters];
-            CFStringTrimWhitespace((CFMutableStringRef)value);
-            return [NSString stringWithFormat:@&quot;\&quot;%@\&quot;&quot;, value];
-        }
-        case DOM_COMMENT_NODE:
-            return [NSString stringWithFormat:@&quot;&lt;!--%@--&gt;&quot;, [self nodeValue]];
-    }
-    return [[self nodeName] lowercaseString];
-}
</del><span class="cx"> @end
</span></span></pre></div>
<a id="branchesWebInspectorRefreshWebKitWebInspectorWebInspectorInternalh"></a>
<div class="modfile"><h4>Modified: branches/WebInspectorRefresh/WebKit/WebInspector/WebInspectorInternal.h (20697 => 20698)</h4>
<pre class="diff"><span>
<span class="info">--- branches/WebInspectorRefresh/WebKit/WebInspector/WebInspectorInternal.h        2007-04-04 06:36:41 UTC (rev 20697)
+++ branches/WebInspectorRefresh/WebKit/WebInspector/WebInspectorInternal.h        2007-04-04 06:39:11 UTC (rev 20698)
</span><span class="lines">@@ -35,7 +35,6 @@
</span><span class="cx"> @class WebView;
</span><span class="cx"> @class WebFrame;
</span><span class="cx"> @class DOMHTMLDocument;
</span><del>-@class NSOutlineView;
</del><span class="cx"> @class WebNodeHighlight;
</span><span class="cx"> 
</span><span class="cx"> @interface WebInspectorPrivate : NSObject
</span><span class="lines">@@ -47,59 +46,25 @@
</span><span class="cx">     DOMNode *rootNode;
</span><span class="cx">     DOMNode *focusedNode;
</span><span class="cx">     NSString *searchQuery;
</span><del>-    NSMutableSet *nodeCache;
-    NSMutableArray *searchResults;
-    NSScrollView *treeScrollView;
-    NSOutlineView *treeOutlineView;
</del><span class="cx">     WebNodeHighlight *currentHighlight;
</span><del>-    NSImage *rightArrowImage;
-    NSImage *downArrowImage;
-    BOOL ignoreWhitespace;
-    BOOL showUserAgentStyles;
</del><ins>+#ifndef NDEBUG
+    NSMutableDictionary *debugFileMap;
+#endif
</ins><span class="cx">     BOOL webViewLoaded;
</span><del>-    BOOL searchResultsVisible;
</del><span class="cx">     BOOL preventHighlight;
</span><del>-    BOOL preventRevealOnFocus;
-    BOOL preventSelectionRefocus;
</del><span class="cx">     BOOL isSharedInspector;
</span><span class="cx"> }
</span><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @interface WebInspector (WebInspectorPrivate)
</span><span class="cx"> - (void)_highlightNode:(DOMNode *)node;
</span><del>-- (void)_revealAndSelectNodeInTree:(DOMNode *)node;
</del><span class="cx"> - (void)_update;
</span><span class="cx"> - (void)_updateRoot;
</span><span class="cx"> - (void)_updateSystemColors;
</span><span class="cx"> - (void)_updateTreeScrollbar;
</span><del>-- (void)_updateTraversalButtons;
-- (void)_refreshSearch;
</del><span class="cx"> - (void)_webFrameDetached:(WebFrame *)frame;
</span><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @interface DOMNode (DOMNodeInspectorAdditions)
</span><del>-- (NSString *)_contentPreview;
-
</del><span class="cx"> - (BOOL)_isAncestorOfNode:(DOMNode *)node;
</span><del>-- (BOOL)_isDescendantOfNode:(DOMNode *)node;
-
-- (BOOL)_isWhitespace;
-
-- (unsigned long)_lengthOfChildNodesIgnoringWhitespace;
-- (DOMNode *)_childNodeAtIndexIgnoringWhitespace:(unsigned long)nodeIndex;
-
-- (DOMNode *)_nextSiblingSkippingWhitespace;
-- (DOMNode *)_previousSiblingSkippingWhitespace;
-
-- (DOMNode *)_firstChildSkippingWhitespace;
-- (DOMNode *)_lastChildSkippingWhitespace;
-
-- (DOMNode *)_firstAncestorCommonWithNode:(DOMNode *)node;
-
-- (DOMNode *)_traverseNextNodeStayingWithin:(DOMNode *)stayWithin;
-- (DOMNode *)_traverseNextNodeSkippingWhitespaceStayingWithin:(DOMNode *)stayWithin;
-- (DOMNode *)_traversePreviousNode;
-- (DOMNode *)_traversePreviousNodeSkippingWhitespace;
-
-- (NSString *)_displayName;
</del><span class="cx"> @end
</span></span></pre></div>
<a id="branchesWebInspectorRefreshWebKitWebInspectorWebInspectorOutlineViewh"></a>
<div class="delfile"><h4>Deleted: branches/WebInspectorRefresh/WebKit/WebInspector/WebInspectorOutlineView.h (20697 => 20698)</h4>
<pre class="diff"><span>
<span class="info">--- branches/WebInspectorRefresh/WebKit/WebInspector/WebInspectorOutlineView.h        2007-04-04 06:36:41 UTC (rev 20697)
+++ branches/WebInspectorRefresh/WebKit/WebInspector/WebInspectorOutlineView.h        2007-04-04 06:39:11 UTC (rev 20698)
</span><span class="lines">@@ -1,32 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. (&quot;Apple&quot;) nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import &lt;AppKit/NSOutlineView.h&gt;
-
-@interface WebInspectorOutlineView : NSOutlineView
-@end
</del></span></pre></div>
<a id="branchesWebInspectorRefreshWebKitWebInspectorWebInspectorOutlineViewm"></a>
<div class="delfile"><h4>Deleted: branches/WebInspectorRefresh/WebKit/WebInspector/WebInspectorOutlineView.m (20697 => 20698)</h4>
<pre class="diff"><span>
<span class="info">--- branches/WebInspectorRefresh/WebKit/WebInspector/WebInspectorOutlineView.m        2007-04-04 06:36:41 UTC (rev 20697)
+++ branches/WebInspectorRefresh/WebKit/WebInspector/WebInspectorOutlineView.m        2007-04-04 06:39:11 UTC (rev 20698)
</span><span class="lines">@@ -1,93 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. (&quot;Apple&quot;) nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import &quot;WebInspectorOutlineView.h&quot;
-
-@implementation WebInspectorOutlineView
-- (BOOL)isOpaque
-{
-    return NO;
-}
-
-- (NSColor *)_highlightColorForCell:(NSCell *)cell
-{
-    // return nil to prevent normal selection drawing
-    return nil;
-}
-
-- (void)_highlightRow:(int)row clipRect:(NSRect)clip {
-    NSColor *selectionColor = nil;
-    if ([[self window] firstResponder] == self &amp;&amp; [[self window] isKeyWindow])
-        selectionColor = [[NSColor alternateSelectedControlColor] colorWithAlphaComponent:0.333f];
-    selectionColor = [[NSColor alternateSelectedControlColor] colorWithAlphaComponent:0.45f];
-
-    if ([self numberOfColumns] &gt; 0) {
-        NSRect highlight = [self rectOfRow:row];
-        NSRect drawRect = NSIntersectionRect(clip, highlight);
-        BOOL solid = ([[self window] firstResponder] == self &amp;&amp; [[self window] isKeyWindow]);
-        if (NSContainsRect(drawRect,clip) &amp;&amp; !NSEqualRects(drawRect,highlight)) {
-            // draw a solid rect when the outline view wants to draw inside the row rect
-            if ([NSGraphicsContext currentContextDrawingToScreen] &amp;&amp; solid) {
-                [selectionColor set];
-                NSRectFillUsingOperation(drawRect, NSCompositeSourceOver);
-            }
-        } else {
-            // draw a rounded rect for the full row
-            if ([NSGraphicsContext currentContextDrawingToScreen]) {
-                NSBezierPath *path = [[NSBezierPath alloc] init];
-
-                float radius = 6.0f;
-                NSRect irect = NSInsetRect(highlight, radius, radius);
-                if (!solid)
-                    irect = NSInsetRect(irect, 1.0f, 1.0f);
-                [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(irect), NSMinY(irect)) radius:radius startAngle:180.0f endAngle:270.0f];
-                [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(irect), NSMinY(irect)) radius:radius startAngle:270.0f endAngle:360.0f];
-                [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(irect), NSMaxY(irect)) radius:radius startAngle:0.0f endAngle:90.0f];
-                [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(irect), NSMaxY(irect)) radius:radius startAngle:90.0f endAngle:180.0f];
-                [path closePath];
-
-                NSRectClip(clip);
-                [selectionColor set];
-                if (solid) {
-                    [path fill];
-                } else {
-                    [path setLineWidth:2.0f];
-                    [path stroke];
-                }
-
-                [path release];
-            }
-        }
-    }
-}
-
-- (void)drawBackgroundInClipRect:(NSRect)clipRect
-{
-    // don't draw a background
-}
-@end
</del></span></pre></div>
<a id="branchesWebInspectorRefreshWebKitWebInspectorwebInspectorinspectorcss"></a>
<div class="modfile"><h4>Modified: branches/WebInspectorRefresh/WebKit/WebInspector/webInspector/inspector.css (20697 => 20698)</h4>
<pre class="diff"><span>
<span class="info">--- branches/WebInspectorRefresh/WebKit/WebInspector/webInspector/inspector.css        2007-04-04 06:36:41 UTC (rev 20697)
+++ branches/WebInspectorRefresh/WebKit/WebInspector/webInspector/inspector.css        2007-04-04 06:39:11 UTC (rev 20698)
</span><span class="lines">@@ -353,7 +353,7 @@
</span><span class="cx">     -webkit-dashboard-region: dashboard-region(control rectangle);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#treeScrollArea {
</del><ins>+#treeOutlineScrollView {
</ins><span class="cx">     position: absolute;
</span><span class="cx">     top: 0; 
</span><span class="cx">     left: 3px;
</span><span class="lines">@@ -361,16 +361,8 @@
</span><span class="cx">     bottom: 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#treeOutlineView {
</del><ins>+#treeOutlineScrollbar {
</ins><span class="cx">     position: absolute;
</span><del>-    top: 0;
-    left: 0;
-    width: 100%;
-    height: 100%