<!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 "WebFrame.h"
</span><span class="cx"> #import "WebFrameInternal.h"
</span><del>-#import "WebHTMLView.h"
-#import "WebInspectorOutlineView.h"
</del><span class="cx"> #import "WebInspectorPanel.h"
</span><del>-#import "WebKitNSStringExtras.h"
-#import "WebLocalizableStrings.h"
</del><span class="cx"> #import "WebNodeHighlight.h"
</span><span class="cx"> #import "WebPreferences.h"
</span><del>-#import "WebTypesInternal.h"
</del><ins>+#import "WebScriptDebugDelegate.h"
</ins><span class="cx"> #import "WebView.h"
</span><span class="cx"> #import "WebViewPrivate.h"
</span><span class="cx">
</span><span class="cx"> #import <WebKit/DOMCore.h>
</span><del>-#import <WebKit/DOMHTML.h>
-#import <WebKit/DOMCSS.h>
</del><span class="cx"> #import <WebKit/DOMExtensions.h>
</span><del>-#import <WebKit/DOMPrivate.h>
</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:@"Web Inspector"];
</span><span class="cx">
</span><span class="cx"> _private = [[WebInspectorPrivate alloc] init];
</span><del>- _private->ignoreWhitespace = YES;
- _private->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->webView setPreferences:preferences];
</span><span class="cx"> [_private->webView setFrameLoadDelegate:self];
</span><span class="cx"> [_private->webView setUIDelegate:self];
</span><ins>+#ifndef NDEBUG
+ [_private->webView setScriptDebugDelegate:self];
+#endif
</ins><span class="cx"> [_private->webView setDrawsBackground:NO];
</span><span class="cx"> [_private->webView setProhibitsMainFrameScrolling:YES];
</span><span class="cx"> [_private->webView _setDashboardBehavior:WebDashboardBehaviorAlwaysSendMouseEventsToAllWindows to:YES];
</span><span class="lines">@@ -205,7 +195,6 @@
</span><span class="cx"> [_private->webFrame _addInspector:self];
</span><span class="cx"> }
</span><span class="cx">
</span><del>- [_private->treeOutlineView setAllowsEmptySelection:NO];
</del><span class="cx"> _private->preventHighlight = YES;
</span><span class="cx"> [self setFocusedDOMNode:[webFrame DOMDocument]];
</span><span class="cx"> _private->preventHighlight = NO;
</span><span class="lines">@@ -255,7 +244,6 @@
</span><span class="cx"> if (!_private->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->preventHighlight) {
</span><span class="lines">@@ -309,13 +297,6 @@
</span><span class="cx"> {
</span><span class="cx"> return _private->searchQuery;
</span><span class="cx"> }
</span><del>-
-#pragma mark -
-
-- (NSArray *)searchResults
-{
- return [NSArray arrayWithArray:_private->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:@"Ignore Whitespace"];
</span><span class="cx"> [item setTarget:self];
</span><span class="cx"> [item setAction:@selector(_toggleIgnoreWhitespace:)];
</span><del>- [item setState:_private->ignoreWhitespace];
</del><ins>+
+ id value = [[_private->webView windowScriptObject] valueForKey:@"ignoreWhitespace"];
+ [item setState:( value && [value isKindOfClass:[NSNumber class]] && [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:@"Show User Agent Styles"];
</span><span class="cx"> [item setTarget:self];
</span><span class="cx"> [item setAction:@selector(_toggleShowUserAgentStyles:)];
</span><del>- [item setState:_private->showUserAgentStyles];
</del><ins>+
+ value = [[_private->webView windowScriptObject] valueForKey:@"showUserAgentStyles"];
+ [item setState:( value && [value isKindOfClass:[NSNumber class]] && [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->webView];
</span><span class="cx"> [menu release];
</span><span class="lines">@@ -349,22 +338,6 @@
</span><span class="cx"> [[[[_private->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:@"clientHeight"];
- NSString *newValue = [NSString stringWithFormat:@"%dpx", [baseValue unsignedLongValue] - delta];
</del><ins>+ NSString *newValue = [NSString stringWithFormat:@"%dpx", [topArea clientHeight] - delta];
</ins><span class="cx"> [[topArea style] setProperty:@"height" value:newValue priority:@""];
</span><span class="cx">
</span><del>- baseValue = [splitter valueForKey:@"offsetTop"];
- newValue = [NSString stringWithFormat:@"%dpx", [baseValue unsignedLongValue] - delta];
</del><ins>+ newValue = [NSString stringWithFormat:@"%dpx", [splitter offsetTop] - delta];
</ins><span class="cx"> [[splitter style] setProperty:@"top" value:newValue priority:@""];
</span><span class="cx">
</span><del>- baseValue = [bottomArea valueForKey:@"offsetTop"];
- newValue = [NSString stringWithFormat:@"%dpx", [baseValue unsignedLongValue] - delta];
</del><ins>+ newValue = [NSString stringWithFormat:@"%dpx", [bottomArea offsetTop] - delta];
</ins><span class="cx"> [[bottomArea style] setProperty:@"top" value:newValue priority:@""];
</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->treeOutlineView frame]) - NSHeight([_private->treeScrollView documentVisibleRect]);
- number = MAX(0.0f, MIN(bottom, number));
- [[_private->treeScrollView contentView] scrollToPoint:NSMakePoint(0.0f, number)];
-}
-
-- (float)treeViewOffsetTop
-{
- return NSMinY([_private->treeScrollView documentVisibleRect]);
-}
-
-- (float)treeViewScrollHeight
-{
- return NSHeight([_private->treeOutlineView frame]);
-}
-
-- (void)traverseTreeBackward
-{
- if (_private->searchResultsVisible) {
- // if we have a search showing, we will only walk up and down the results
- int row = [_private->treeOutlineView selectedRow];
- if (row == -1)
- return;
- if ((row - 1) >= 0) {
- row--;
- [_private->treeOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
- [_private->treeOutlineView scrollRowToVisible:row];
- }
- return;
- }
-
- DOMNode *node = nil;
- // traverse backward, holding opton will traverse only to the previous sibling
- if ([[[self window] currentEvent] modifierFlags] & NSAlternateKeyMask) {
- if (!_private->ignoreWhitespace)
- node = [_private->focusedNode previousSibling];
- else
- node = [_private->focusedNode _previousSiblingSkippingWhitespace];
- } else {
- if (!_private->ignoreWhitespace)
- node = [_private->focusedNode _traversePreviousNode];
- else
- node = [_private->focusedNode _traversePreviousNodeSkippingWhitespace];
- }
-
- if (node) {
- DOMNode *root = [self rootDOMNode];
- if (![root isSameNode:node] && ![root _isAncestorOfNode:node])
- [self setRootDOMNode:[[self focusedDOMNode] _firstAncestorCommonWithNode:node]];
- [self setFocusedDOMNode:node];
- }
-}
-
-- (void)traverseTreeForward
-{
- if (_private->searchResultsVisible) {
- // if we have a search showing, we will only walk up and down the results
- int row = [_private->treeOutlineView selectedRow];
- if (row == -1)
- return;
- if ((row + 1) < (int)[_private->searchResults count]) {
- row++;
- [_private->treeOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
- [_private->treeOutlineView scrollRowToVisible:row];
- }
- return;
- }
-
- DOMNode *node = nil;
- // traverse forward, holding opton will traverse only to the next sibling
- if ([[[self window] currentEvent] modifierFlags] & NSAlternateKeyMask) {
- if (!_private->ignoreWhitespace)
- node = [_private->focusedNode nextSibling];
- else
- node = [_private->focusedNode _nextSiblingSkippingWhitespace];
- } else {
- if (!_private->ignoreWhitespace)
- node = [_private->focusedNode _traverseNextNodeStayingWithin:nil];
- else
- node = [_private->focusedNode _traverseNextNodeSkippingWhitespaceStayingWithin:nil];
- }
-
- if (node) {
- DOMNode *root = [self rootDOMNode];
- if (![root isSameNode:node] && ![root _isAncestorOfNode:node])
- [self setRootDOMNode:[[self focusedDOMNode] _firstAncestorCommonWithNode:node]];
- [self setFocusedDOMNode:node];
- }
-}
-
-- (void)searchPerformed:(NSString *)query
-{
- [query retain];
- [_private->searchQuery release];
- _private->searchQuery = query;
-
- BOOL show = [query length];
- if (show != _private->searchResultsVisible) {
- [_private->treeOutlineView setDoubleAction:(show ? @selector(_exitSearch:) : @selector(_focusRootNode:))];
- _private->preventRevealOnFocus = show;
- _private->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->ignoreWhitespace = !_private->ignoreWhitespace;
- [_private->treeOutlineView reloadData];
- [self _updateTreeScrollbar];
</del><ins>+ if (_private->webViewLoaded)
+ [[_private->webView windowScriptObject] callWebScriptMethod:@"toggleIgnoreWhitespace" 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->showUserAgentStyles = !_private->showUserAgentStyles;
</del><span class="cx"> if (_private->webViewLoaded)
</span><del>- [[_private->webView windowScriptObject] evaluateWebScript:@"toggleShowUserAgentStyles()"];
</del><ins>+ [[_private->webView windowScriptObject] callWebScriptMethod:@"toggleShowUserAgentStyles" 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->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->treeOutlineView selectedRow];
- if (index == -1 || !_private->treeOutlineView)
- return;
- DOMNode *node = [_private->treeOutlineView itemAtRow:index];
- if (![node isSameNode:[self rootDOMNode]])
- [self setRootDOMNode:node];
-}
-
-- (void)_revealAndSelectNodeInTree:(DOMNode *)node
-{
- if (!_private->webViewLoaded)
- return;
-
- if (!_private->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->treeOutlineView expandItem:currentNode];
-
- [ancestors release];
- }
-
- int index = [_private->treeOutlineView rowForItem:node];
- if (index != -1) {
- [_private->treeOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:index] byExtendingSelection:NO];
- [_private->treeOutlineView scrollRowToVisible:index];
- } else {
- [_private->treeOutlineView deselectAll:self];
- }
- [self _updateTreeScrollbar];
-}
-
-- (void)_refreshSearch
-{
- BOOL selectFirst = ![_private->searchResults count];
-
- if (!_private->searchResults)
- _private->searchResults = [[NSMutableArray alloc] initWithCapacity:100];
- else
- [_private->searchResults removeAllObjects];
-
- NSString *query = _private->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->preventSelectionRefocus = YES;
- [_private->treeOutlineView reloadData];
- _private->preventSelectionRefocus = NO;
-
- [self _revealAndSelectNodeInTree:node];
- [self _updateTraversalButtons];
- [node release];
-
- [[_private->webView windowScriptObject] callWebScriptMethod:@"toggleNoSelection" withArguments:[NSArray arrayWithObject:[NSNumber numberWithBool:NO]]];
- return;
- }
-
- unsigned count = 0;
- DOMNode *node = nil;
-
- if ([query hasPrefix:@"/"]) {
- // search document by Xpath query
- id nodeList = [[_private->webView windowScriptObject] callWebScriptMethod:@"resultsWithXpathQuery" withArguments:[NSArray arrayWithObject:query]];
- if ([nodeList isKindOfClass:[WebScriptObject class]]) {
- if ([[nodeList valueForKey:@"snapshotLength"] isKindOfClass:[NSNumber class]]) {
- count = [[nodeList valueForKey:@"snapshotLength"] unsignedLongValue];
- for( unsigned i = 0; i < count; i++ ) {
- NSNumber *index = [[NSNumber alloc] initWithUnsignedLong:i];
- NSArray *args = [[NSArray alloc] initWithObjects:&index count:1];
- node = [nodeList callWebScriptMethod:@"snapshotItem" withArguments:args];
- if (node)
- [_private->searchResults addObject:node];
- [args release];
- [index release];
- }
- }
- }
- } else {
- // search nodes by node name, node value, id and class name
- node = [_private->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 && [[node nodeValue] _webkit_hasCaseInsensitiveSubstring:query])
- matched = YES;
- else if ([node isKindOfClass:[DOMHTMLElement class]] && [[(DOMHTMLElement *)node idName] _webkit_hasCaseInsensitiveSubstring:query])
- matched = YES;
- else if ([node isKindOfClass:[DOMHTMLElement class]] && [[(DOMHTMLElement *)node className] _webkit_hasCaseInsensitiveSubstring:query])
- matched = YES;
- if (matched) {
- [_private->searchResults addObject:node];
- count++;
- }
- }
- }
-
- DOMHTMLElement *searchCount = (DOMHTMLElement *)[_private->domDocument getElementById:@"searchCount"];
- if (count == 1)
- [searchCount setInnerText:@"1 node"];
- else
- [searchCount setInnerText:[NSString stringWithFormat:@"%u nodes", count]];
-
- [_private->treeOutlineView reloadData];
- [self _updateTreeScrollbar];
-
- [[_private->webView windowScriptObject] callWebScriptMethod:@"toggleNoSelection" withArguments:[NSArray arrayWithObject:[NSNumber numberWithBool:!count]]];
-
- if (selectFirst && count)
- [_private->treeOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:0] byExtendingSelection:NO];
-}
-
</del><span class="cx"> - (void)_update
</span><span class="cx"> {
</span><span class="cx"> if (_private->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->domDocument getElementById:@"traverseUp"];
- DOMHTMLButtonElement *forward = (DOMHTMLButtonElement *)[_private->domDocument getElementById:@"traverseDown"];
- if (_private->searchResultsVisible) {
- int row = [_private->treeOutlineView selectedRow];
- if (row != -1) {
- [forward setDisabled:!((row + 1) < (int)[_private->searchResults count])];
- [back setDisabled:!((row - 1) >= 0)];
- }
- } else {
- if (!_private->ignoreWhitespace)
- node = [_private->focusedNode _traverseNextNodeStayingWithin:nil];
- else
- node = [_private->focusedNode _traverseNextNodeSkippingWhitespaceStayingWithin:nil];
- [forward setDisabled:!node];
-
- if (!_private->ignoreWhitespace)
- node = [_private->focusedNode _traversePreviousNode];
- else
- node = [_private->focusedNode _traversePreviousNodeSkippingWhitespace];
- [back setDisabled:!node];
- }
-}
-
</del><span class="cx"> - (void)_updateRoot
</span><span class="cx"> {
</span><del>- if (!_private->webViewLoaded || _private->searchResultsVisible)
</del><ins>+ if (!_private->webViewLoaded)
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- DOMHTMLElement *popup = (DOMHTMLElement *)[_private->domDocument getElementById:@"treePopup"];
- [popup setInnerHTML:@""]; // reset the list
-
- DOMNode *currentNode = [self rootDOMNode];
- while (currentNode) {
- DOMHTMLOptionElement *option = (DOMHTMLOptionElement *)[_private->domDocument createElement:@"option"];
- [option setTextContent:[currentNode _displayName]];
- [popup appendChild:option];
- currentNode = [currentNode parentNode];
- }
-
- _private->preventSelectionRefocus = YES;
- DOMNode *focusedNode = [[self focusedDOMNode] retain];
- [_private->treeOutlineView reloadData];
- if ([self rootDOMNode])
- [_private->treeOutlineView expandItem:[self rootDOMNode]];
- [self _revealAndSelectNodeInTree:focusedNode];
- [focusedNode release];
- _private->preventSelectionRefocus = NO;
</del><ins>+ [[_private->webView windowScriptObject] callWebScriptMethod:@"updateTreeOutline" 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->webViewLoaded)
</span><del>- [[_private->webView windowScriptObject] evaluateWebScript:@"treeScrollbar.refresh()"];
</del><ins>+ [[_private->webView windowScriptObject] evaluateWebScript:@"treeOutlineScrollArea.refresh()"];
</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:&red green:&green blue:&blue alpha:NULL];
</span><span class="cx">
</span><del>- NSString *colorText = [NSString stringWithFormat:@"background-color: rgba(%d, %d, %d, 0.4) !important", (int)(red * 255), (int)(green * 255), (int)(blue * 255)];
- NSString *styleText = [NSString stringWithFormat:@"#styleRulesScrollview > .row.focused { %@ }; .treeList li.focused { %1$@ }", colorText];
</del><ins>+ NSString *colorText = [NSString stringWithFormat:@"rgba(%d,%d,%d,0.4) !important", (int)(red * 255), (int)(green * 255), (int)(blue * 255)];
+ NSString *styleText = [NSString stringWithFormat:@".focused .selected { background-color: %1$@ } .blured .selected { border-color: %1$@ }", colorText];
</ins><span class="cx"> DOMElement *style = [_private->domDocument getElementById:@"systemColors"];
</span><span class="cx"> if (!style) {
</span><span class="cx"> style = [_private->domDocument createElement:@"style"];
</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->treeOutlineView setAllowsEmptySelection:YES];
- [_private->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:@"WebPlugInAttributesKey"];
- if ([[attributes objectForKey:@"type"] isEqualToString:@"application/x-inspector-tree"]) {
- if (!_private->treeOutlineView) {
- _private->treeScrollView = [[NSScrollView alloc] initWithFrame:NSMakeRect(0.0f, 0.0f, 250.0f, 100.0f)];
- [_private->treeScrollView setDrawsBackground:NO];
- [_private->treeScrollView setBorderType:NSNoBorder];
- [_private->treeScrollView setVerticalScroller:NO];
- [_private->treeScrollView setHasHorizontalScroller:NO];
- [_private->treeScrollView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
- [_private->treeScrollView setFocusRingType:NSFocusRingTypeNone];
-
- _private->treeOutlineView = [[WebInspectorOutlineView alloc] initWithFrame:[_private->treeScrollView frame]];
- [_private->treeOutlineView setHeaderView:nil];
- [_private->treeOutlineView setAllowsMultipleSelection:NO];
- [_private->treeOutlineView setAllowsEmptySelection:NO];
- [_private->treeOutlineView setDelegate:self];
- [_private->treeOutlineView setDataSource:self];
- [_private->treeOutlineView sendActionOn:(NSLeftMouseUpMask | NSLeftMouseDownMask | NSLeftMouseDraggedMask)];
- [_private->treeOutlineView setFocusRingType:NSFocusRingTypeNone];
- [_private->treeOutlineView setAutoresizesOutlineColumn:NO];
- [_private->treeOutlineView setRowHeight:15.0f];
- [_private->treeOutlineView setTarget:self];
- [_private->treeOutlineView setDoubleAction:@selector(_focusRootNode:)];
- [_private->treeOutlineView setIndentationPerLevel:12.0f];
- [_private->treeScrollView setDocumentView:_private->treeOutlineView];
-
- NSCell *headerCell = [[NSCell alloc] initTextCell:@""];
- NSCell *dataCell = [[NSCell alloc] initTextCell:@""];
- [dataCell setFont:[NSFont systemFontOfSize:11.0f]];
-
- NSTableColumn *tableColumn = [[NSTableColumn alloc] initWithIdentifier:@"node"];
- [tableColumn setHeaderCell:headerCell];
- [tableColumn setDataCell:dataCell];
- [tableColumn setMinWidth:50];
- [tableColumn setWidth:300];
- [tableColumn setEditable:NO];
- [_private->treeOutlineView addTableColumn:tableColumn];
- [_private->treeOutlineView setOutlineTableColumn:tableColumn];
-
- [_private->treeOutlineView sizeLastColumnToFit];
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_updateTreeScrollbar) name:NSViewFrameDidChangeNotification object:_private->treeOutlineView];
- }
-
- return [_private->treeOutlineView enclosingScrollView];
- }
-
- return nil;
</del><ins>+ NSLog(@"%@", 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->treeOutlineView) {
- if (!node && _private->searchResultsVisible)
- return [_private->searchResults count];
- if (!node)
- return 1;
- if (!_private->ignoreWhitespace)
- return [[node childNodes] length];
- return [node _lengthOfChildNodesIgnoringWhitespace];
- }
- return 0;
</del><ins>+ if (!_private->debugFileMap)
+ _private->debugFileMap = [[NSMutableDictionary alloc] init];
+ if (url)
+ [_private->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->treeOutlineView) {
- if (!_private->ignoreWhitespace)
- return [node hasChildNodes];
- return ([node _firstChildSkippingWhitespace] ? YES : NO);
- }
- return NO;
-}
</del><ins>+ NSURL *url = [_private->debugFileMap objectForKey:[NSNumber numberWithInt:sid]];
+ NSLog(@"JS exception: %@ line %d", url, lineno);
</ins><span class="cx">
</span><del>-- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item
-{
- DOMNode *parent = item;
- if (outlineView == _private->treeOutlineView) {
- if (!parent && _private->searchResultsVisible)
- return [_private->searchResults objectAtIndex:index];
- if (!parent)
- return [self rootDOMNode];
- id node = nil;
- if (!_private->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:@"(anonymous function)"];
</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->nodeCache addObject:node];
- return node;
</del><ins>+ [stack addObject:@"(global scope)"];
+ 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->treeOutlineView && 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] && ![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(@"Stack trace:\n%@", [stack componentsJoinedByString:@"\n"]);
+ [stack release];
</ins><span class="cx"> }
</span><del>-
-- (void)outlineView:(NSOutlineView *)outlineView willDisplayOutlineCell:(NSCell *)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
-{
- if (outlineView == _private->treeOutlineView)
- [cell setImage:([cell state] ? _private->downArrowImage : _private->rightArrowImage)];
-}
-
-- (void)outlineViewItemDidCollapse:(NSNotification *)notification
-{
- if ([notification object] == _private->treeOutlineView) {
- DOMNode *node = [[notification userInfo] objectForKey:@"NSObject"];
- 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->nodeCache removeObject:node];
- node = [node nextSibling];
- }
- }
-}
-
-- (void)outlineViewSelectionDidChange:(NSNotification *)notification
-{
- if ([notification object] == _private->treeOutlineView && !_private->preventSelectionRefocus && _private->webViewLoaded) {
- int index = [_private->treeOutlineView selectedRow];
- if (index != -1)
- [self setFocusedDOMNode:[_private->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:@"rightTriangle" ofType:@"png" inDirectory:@"webInspector/Images"]];
- downArrowImage = [[NSImage alloc] initWithContentsOfFile:[[NSBundle bundleForClass:[self class]] pathForResource:@"downTriangle" ofType:@"png" inDirectory:@"webInspector/Images"]];
- 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 @"";
-
- unsigned limit = 0;
- NSMutableString *preview = [[NSMutableString alloc] initWithCapacity:100];
- [preview appendString:@" "];
-
- // 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 > 4) {
- unichar ellipsis = 0x2026;
- [preview appendString:[NSString stringWithCharacters:&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 > cachedIndex) {
- node = lastChild;
- count = cachedIndex;
- }
- }
- }
-
- if (!node)
- node = [self _firstChildSkippingWhitespace];
-
- while (node && count < 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 && [node _isWhitespace])
- node = [node nextSibling];
- return node;
-}
-
-- (DOMNode *)_previousSiblingSkippingWhitespace
-{
- DOMNode *node = [self previousSibling];
- while ([node nodeType] == DOM_TEXT_NODE && [node _isWhitespace])
- node = [node previousSibling];
- return node;
-}
-
-- (DOMNode *)_firstChildSkippingWhitespace
-{
- DOMNode *node = [self firstChild];
- while ([node nodeType] == DOM_TEXT_NODE && [node _isWhitespace])
- node = [node _nextSiblingSkippingWhitespace];
- return node;
-}
-
-- (DOMNode *)_lastChildSkippingWhitespace
-{
- DOMNode *node = [self lastChild];
- while ([node nodeType] == DOM_TEXT_NODE && [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 && ![node nextSibling] && (!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 && ![node _nextSiblingSkippingWhitespace] && (!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 @"Document";
- case DOM_ELEMENT_NODE: {
- if ([self hasAttributes]) {
- NSMutableString *name = [NSMutableString stringWithFormat:@"<%@", [[self nodeName] lowercaseString]];
- NSString *value = [(DOMElement *)self getAttribute:@"id"];
- if ([value length])
- [name appendFormat:@" id=\"%@\"", value];
- value = [(DOMElement *)self getAttribute:@"class"];
- if ([value length])
- [name appendFormat:@" class=\"%@\"", value];
- if ([[self nodeName] caseInsensitiveCompare:@"a"] == NSOrderedSame) {
- value = [(DOMElement *)self getAttribute:@"name"];
- if ([value length])
- [name appendFormat:@" name=\"%@\"", value];
- value = [(DOMElement *)self getAttribute:@"href"];
- if ([value length])
- [name appendFormat:@" href=\"%@\"", value];
- } else if ([[self nodeName] caseInsensitiveCompare:@"img"] == NSOrderedSame) {
- value = [(DOMElement *)self getAttribute:@"src"];
- if ([value length])
- [name appendFormat:@" src=\"%@\"", value];
- } else if ([[self nodeName] caseInsensitiveCompare:@"iframe"] == NSOrderedSame) {
- value = [(DOMElement *)self getAttribute:@"src"];
- if ([value length])
- [name appendFormat:@" src=\"%@\"", value];
- } else if ([[self nodeName] caseInsensitiveCompare:@"input"] == NSOrderedSame) {
- value = [(DOMElement *)self getAttribute:@"name"];
- if ([value length])
- [name appendFormat:@" name=\"%@\"", value];
- value = [(DOMElement *)self getAttribute:@"type"];
- if ([value length])
- [name appendFormat:@" type=\"%@\"", value];
- } else if ([[self nodeName] caseInsensitiveCompare:@"form"] == NSOrderedSame) {
- value = [(DOMElement *)self getAttribute:@"action"];
- if ([value length])
- [name appendFormat:@" action=\"%@\"", value];
- }
- [name appendString:@">"];
- return name;
- }
- return [NSString stringWithFormat:@"<%@>", [[self nodeName] lowercaseString]];
- }
- case DOM_TEXT_NODE: {
- if ([self _isWhitespace])
- return @"(whitespace)";
- NSString *value = [[self nodeValue] _webkit_stringByCollapsingWhitespaceCharacters];
- CFStringTrimWhitespace((CFMutableStringRef)value);
- return [NSString stringWithFormat:@"\"%@\"", value];
- }
- case DOM_COMMENT_NODE:
- return [NSString stringWithFormat:@"<!--%@-->", [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. ("Apple") 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 "AS IS" 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 <AppKit/NSOutlineView.h>
-
-@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. ("Apple") 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 "AS IS" 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 "WebInspectorOutlineView.h"
-
-@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 && [[self window] isKeyWindow])
- selectionColor = [[NSColor alternateSelectedControlColor] colorWithAlphaComponent:0.333f];
- selectionColor = [[NSColor alternateSelectedControlColor] colorWithAlphaComponent:0.45f];
-
- if ([self numberOfColumns] > 0) {
- NSRect highlight = [self rectOfRow:row];
- NSRect drawRect = NSIntersectionRect(clip, highlight);
- BOOL solid = ([[self window] firstResponder] == self && [[self window] isKeyWindow]);
- if (NSContainsRect(drawRect,clip) && !NSEqualRects(drawRect,highlight)) {
- // draw a solid rect when the outline view wants to draw inside the row rect
- if ([NSGraphicsContext currentContextDrawingToScreen] && 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%