Changeset 21007 in webkit


Ignore:
Timestamp:
Apr 22, 2007, 3:12:00 PM (18 years ago)
Author:
thatcher
Message:

Reviewed by Mitz.

Bug 13436: Make Option-clicking a disclosure triangle expand the entire subtree
http://bugs.webkit.org/show_bug.cgi?id=13436

Makes option-click recursively expand and collapse the sub-tree. Pressing option-left
and -right also recursively expands and collapses the sub-tree.

Location:
trunk/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/ChangeLog

    r21006 r21007  
     12007-04-22  Timothy Hatcher  <timothy@apple.com>
     2
     3        Reviewed by Mitz.
     4
     5        Bug 13436: Make Option-clicking a disclosure triangle expand the entire subtree
     6        http://bugs.webkit.org/show_bug.cgi?id=13436
     7
     8        Makes option-click recursively expand and collapse the sub-tree. Pressing option-left
     9        and -right also recursively expands and collapses the sub-tree.
     10
     11        * WebInspector/webInspector/treeoutline.js:
     12
    1132007-04-22  Timothy Hatcher  <timothy@apple.com>
    214
  • trunk/WebKit/WebInspector/webInspector/treeoutline.js

    r20986 r21007  
    188188TreeOutline.prototype.handleKeyEvent = function(event)
    189189{
    190     if (!this.selectedTreeElement || event.shiftKey || event.metaKey || event.altKey || event.ctrlKey)
     190    if (!this.selectedTreeElement || event.shiftKey || event.metaKey || event.ctrlKey)
    191191        return;
    192192
    193193    var handled = false;
    194194    var nextSelectedElement;
    195     if (event.keyIdentifier === "Up") {
     195    if (event.keyIdentifier === "Up" && !event.altKey) {
    196196        nextSelectedElement = this.selectedTreeElement.traversePreviousTreeElement(true);
    197197        handled = true;
    198     } else if (event.keyIdentifier === "Down") {
     198    } else if (event.keyIdentifier === "Down" && !event.altKey) {
    199199        nextSelectedElement = this.selectedTreeElement.traverseNextTreeElement(true);
    200200        handled = true;
    201201    } else if (event.keyIdentifier === "Left") {
    202202        if (this.selectedTreeElement.expanded) {
    203             this.selectedTreeElement.collapse();
     203            if (event.altKey)
     204                this.selectedTreeElement.collapseRecursively();
     205            else
     206                this.selectedTreeElement.collapse();
    204207            handled = true;
    205208        } else if (this.selectedTreeElement.parent && !this.selectedTreeElement.parent.root) {
     
    209212    } else if (event.keyIdentifier === "Right") {
    210213        if (this.selectedTreeElement.hasChildren) {
    211             this.selectedTreeElement.expand();
     214            if (event.altKey)
     215                this.selectedTreeElement.expandRecursively();
     216            else
     217                this.selectedTreeElement.expand();
    212218            handled = true;
    213219        }
     
    347353    if (event.offsetX <= 20 && element.treeElement.hasChildren) {
    348354        if (element.treeElement.expanded) {
    349             element.treeElement.collapse();
     355            if (event.altKey)
     356                element.treeElement.collapseRecursively();
     357            else
     358                element.treeElement.collapse();
    350359        } else {
    351             element.treeElement.expand();
     360            if (event.altKey)
     361                element.treeElement.expandRecursively();
     362            else
     363                element.treeElement.expand();
    352364        }
    353365    }
     
    382394}
    383395
     396TreeElement.prototype.collapseRecursively = function()
     397{
     398    var item = this;
     399    while (item) {
     400        if (item.expanded)
     401            item.collapse();
     402        item = item.traverseNextTreeElement(false, this, true);
     403    }
     404}
     405
    384406TreeElement.prototype.expand = function()
    385407{
     
    423445    if (this.onexpand)
    424446        this.onexpand(this);
     447}
     448
     449TreeElement.prototype.expandRecursively = function()
     450{
     451    var item = this;
     452    while (item) {
     453        item.expand();
     454        item = item.traverseNextTreeElement(false, this);
     455    }
    425456}
    426457
Note: See TracChangeset for help on using the changeset viewer.