Reviewed by Adam.
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Oct 2007 18:41:40 +0000 (18:41 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Oct 2007 18:41:40 +0000 (18:41 +0000)
        Bug 15476: DOM tree fully expands some elements when arrowing up
        http://bugs.webkit.org/show_bug.cgi?id=15476

        Add a new expandTreeElementsWhenArrowing option to TreeOutline. This option
        is used only for the sidebar and search results.

        * page/inspector/inspector.js: Opt-in for the sidebar and search results.
        * page/inspector/treeoutline.js: Add expandTreeElementsWhenArrowing and pass
          this option to traverseNextTreeElement and traversePreviousTreeElement.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@26997 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/page/inspector/inspector.js
WebCore/page/inspector/treeoutline.js

index 36c2070..e4204f4 100644 (file)
@@ -1,3 +1,17 @@
+2007-10-24  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Adam.
+
+        Bug 15476: DOM tree fully expands some elements when arrowing up
+        http://bugs.webkit.org/show_bug.cgi?id=15476
+
+        Add a new expandTreeElementsWhenArrowing option to TreeOutline. This option
+        is used only for the sidebar and search results.
+
+        * page/inspector/inspector.js: Opt-in for the sidebar and search results.
+        * page/inspector/treeoutline.js: Add expandTreeElementsWhenArrowing and pass
+          this option to traverseNextTreeElement and traversePreviousTreeElement.
+
 2007-10-24  Anders Carlsson  <andersca@apple.com>
 
         Reviewed by Geoff and Mitz.
index b9eed4d..9dd8453 100644 (file)
@@ -196,7 +196,10 @@ var WebInspector = {
 WebInspector.loaded = function(event)
 {
     this.fileOutline = new TreeOutline(document.getElementById("list"));
+    this.fileOutline.expandTreeElementsWhenArrowing = true;
+
     this.statusOutline = new TreeOutline(document.getElementById("status"));
+    this.statusOutline.expandTreeElementsWhenArrowing = true;
 
     this.resourceCategories = {
         documents: new WebInspector.ResourceCategory("documents"),
@@ -738,7 +741,9 @@ WebInspector.performSearch = function(query)
     var fileList = document.createElement("ol");
     fileList.className = "outline-disclosure";
     resultsContainer.appendChild(fileList);
+
     this.searchResultsTree = new TreeOutline(fileList);
+    this.searchResultsTree.expandTreeElementsWhenArrowing = true;
 
     var sourceResultSelected = function(element)
     {
index 4e83c82..b9bdc75 100644 (file)
@@ -34,6 +34,7 @@ function TreeOutline(listNode)
     this._childrenListNode.removeChildren();
     this._knownTreeElements = [];
     this._treeElementsExpandedState = [];
+    this.expandTreeElementsWhenArrowing = false;
     this.root = true;
     this.hasChildren = false;
     this.expanded = true;
@@ -295,12 +296,12 @@ TreeOutline.prototype.handleKeyEvent = function(event)
     if (event.keyIdentifier === "Up" && !event.altKey) {
         nextSelectedElement = this.selectedTreeElement.traversePreviousTreeElement(true);
         while (nextSelectedElement && !nextSelectedElement.selectable)
-            nextSelectedElement = nextSelectedElement.traversePreviousTreeElement(false);
+            nextSelectedElement = nextSelectedElement.traversePreviousTreeElement(!this.expandTreeElementsWhenArrowing);
         handled = nextSelectedElement ? true : false;
     } else if (event.keyIdentifier === "Down" && !event.altKey) {
         nextSelectedElement = this.selectedTreeElement.traverseNextTreeElement(true);
         while (nextSelectedElement && !nextSelectedElement.selectable)
-            nextSelectedElement = nextSelectedElement.traverseNextTreeElement(false);
+            nextSelectedElement = nextSelectedElement.traverseNextTreeElement(!this.expandTreeElementsWhenArrowing);
         handled = nextSelectedElement ? true : false;
     } else if (event.keyIdentifier === "Left") {
         if (this.selectedTreeElement.expanded) {