Title: [185629] trunk/Source/WebInspectorUI
Revision
185629
Author
mattba...@apple.com
Date
2015-06-16 17:33:06 -0700 (Tue, 16 Jun 2015)

Log Message

Web Inspector: REGRESSION (r171645): up/down key navigation of timeline sidebar tree elements is broken when scope bar filters are applied
https://bugs.webkit.org/show_bug.cgi?id=142315

Reviewed by Timothy Hatcher.

TreeOutline's element traversal algorithms have been rewritten to correctly skip over unrevealed tree elements.
Previously traversal would halt after encountering a hidden element. We now use an iterative approach, with
each iteration producing the next (or previous) element, with respect to the last candidate element. Iteration
begins with the current node, and halts once a valid element is found or candidate elements are exhausted.

* UserInterface/Views/TreeOutline.js:
(WebInspector.TreeElement.prototype.traverseNextTreeElement.shouldSkip):
(WebInspector.TreeElement.prototype.traverseNextTreeElement):
(WebInspector.TreeElement.prototype.traversePreviousTreeElement.shouldSkip):
(WebInspector.TreeElement.prototype.traversePreviousTreeElement):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (185628 => 185629)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-06-17 00:12:56 UTC (rev 185628)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-06-17 00:33:06 UTC (rev 185629)
@@ -1,3 +1,21 @@
+2015-06-16  Matt Baker  <mattba...@apple.com>
+
+        Web Inspector: REGRESSION (r171645): up/down key navigation of timeline sidebar tree elements is broken when scope bar filters are applied
+        https://bugs.webkit.org/show_bug.cgi?id=142315
+
+        Reviewed by Timothy Hatcher.
+
+        TreeOutline's element traversal algorithms have been rewritten to correctly skip over unrevealed tree elements.
+        Previously traversal would halt after encountering a hidden element. We now use an iterative approach, with
+        each iteration producing the next (or previous) element, with respect to the last candidate element. Iteration
+        begins with the current node, and halts once a valid element is found or candidate elements are exhausted.
+
+        * UserInterface/Views/TreeOutline.js:
+        (WebInspector.TreeElement.prototype.traverseNextTreeElement.shouldSkip):
+        (WebInspector.TreeElement.prototype.traverseNextTreeElement):
+        (WebInspector.TreeElement.prototype.traversePreviousTreeElement.shouldSkip):
+        (WebInspector.TreeElement.prototype.traversePreviousTreeElement):
+
 2015-06-15  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: Stylize Node Previews

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js (185628 => 185629)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js	2015-06-17 00:12:56 UTC (rev 185628)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js	2015-06-17 00:33:06 UTC (rev 185629)
@@ -1032,58 +1032,54 @@
 
     traverseNextTreeElement(skipUnrevealed, stayWithin, dontPopulate, info)
     {
-        if (!dontPopulate && this.hasChildren)
-            this.onpopulate.call(this); // FIXME: This shouldn't need to use call, but this is working around a JSC bug. https://webkit.org/b/74811
-
-        if (info)
-            info.depthChange = 0;
-
-        var element = skipUnrevealed ? (this.revealed() ? this.children[0] : null) : this.children[0];
-        if (element && (!skipUnrevealed || (skipUnrevealed && this.expanded))) {
-            if (info)
-                info.depthChange = 1;
-            return element;
+        function shouldSkip(element) {
+            return skipUnrevealed && !element.revealed();
         }
 
-        if (this === stayWithin)
-            return null;
+        var depthChange = 0;
+        var element = this;
+        do {
+            if (element.hasChildren && element.expanded && !shouldSkip(element)) {
+                if (!dontPopulate)
+                    element.onpopulate();
+                element = element.children[0];
+                depthChange += 1;
+            } else {
+                while (element && !element.nextSibling && element.parent && !element.parent.root && element.parent !== stayWithin) {
+                    element = element.parent;
+                    depthChange -= 1;
+                }
 
-        element = skipUnrevealed ? (this.revealed() ? this.nextSibling : null) : this.nextSibling;
-        if (element)
-            return element;
+                if (element)
+                    element = element.nextSibling;
+            }
+        } while (element && shouldSkip(element));
 
-        element = this;
-        while (element && !element.root && !(skipUnrevealed ? (element.revealed() ? element.nextSibling : null) : element.nextSibling) && element.parent !== stayWithin) {
-            if (info)
-                info.depthChange -= 1;
-            element = element.parent;
-        }
-
-        if (!element)
-            return null;
-
-        return (skipUnrevealed ? (element.revealed() ? element.nextSibling : null) : element.nextSibling);
+        if (info)
+            info.depthChange = depthChange;
+        return element;
     }
 
     traversePreviousTreeElement(skipUnrevealed, dontPopulate)
     {
-        var element = skipUnrevealed ? (this.revealed() ? this.previousSibling : null) : this.previousSibling;
-        if (!dontPopulate && element && element.hasChildren)
-            element.onpopulate();
-
-        while (element && (skipUnrevealed ? (element.revealed() && element.expanded ? element.children[element.children.length - 1] : null) : element.children[element.children.length - 1])) {
-            if (!dontPopulate && element.hasChildren)
-                element.onpopulate();
-            element = (skipUnrevealed ? (element.revealed() && element.expanded ? element.children[element.children.length - 1] : null) : element.children[element.children.length - 1]);
+        function shouldSkip(element) {
+            return skipUnrevealed && !element.revealed();
         }
 
-        if (element)
-            return element;
+        var element = this;
+        do {
+            if (element.previousSibling) {
+                element = element.previousSibling;
+                while (element && element.hasChildren && element.expanded && !shouldSkip(element)) {
+                    if (!dontPopulate)
+                        element.onpopulate();
+                    element = element.children.lastValue;
+                }
+            } else
+                element = element.parent && element.parent.root ? null : element.parent;
+        } while (element && shouldSkip(element));
 
-        if (!this.parent || this.parent.root)
-            return null;
-
-        return this.parent;
+        return element;
     }
 
     isEventWithinDisclosureTriangle(event)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to