| Index: third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js b/third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js
|
| index d89fc48f5685235f4c4d4a9ebd91b899ad30fd3d..ea34853ee87197fdae2dff686c1fd584c1cfbe67 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js
|
| @@ -237,39 +237,13 @@ TreeOutline.prototype = {
|
| } else if (event.key === "ArrowDown" && !event.altKey) {
|
| handled = this.selectNext();
|
| } else if (event.key === "ArrowLeft") {
|
| - if (this.selectedTreeElement.expanded) {
|
| - if (event.altKey)
|
| - this.selectedTreeElement.collapseRecursively();
|
| - else
|
| - this.selectedTreeElement.collapse();
|
| - handled = true;
|
| - } else if (this.selectedTreeElement.parent && !this.selectedTreeElement.parent.root) {
|
| - handled = true;
|
| - if (this.selectedTreeElement.parent.selectable) {
|
| - nextSelectedElement = this.selectedTreeElement.parent;
|
| - while (nextSelectedElement && !nextSelectedElement.selectable)
|
| - nextSelectedElement = nextSelectedElement.parent;
|
| - handled = nextSelectedElement ? true : false;
|
| - } else if (this.selectedTreeElement.parent)
|
| - this.selectedTreeElement.parent.collapse();
|
| - }
|
| + handled = this.selectedTreeElement.collapseOrAscend(event.altKey);
|
| } else if (event.key === "ArrowRight") {
|
| if (!this.selectedTreeElement.revealed()) {
|
| this.selectedTreeElement.reveal();
|
| handled = true;
|
| - } else if (this.selectedTreeElement._expandable) {
|
| - handled = true;
|
| - if (this.selectedTreeElement.expanded) {
|
| - nextSelectedElement = this.selectedTreeElement.firstChild();
|
| - while (nextSelectedElement && !nextSelectedElement.selectable)
|
| - nextSelectedElement = nextSelectedElement.nextSibling;
|
| - handled = nextSelectedElement ? true : false;
|
| - } else {
|
| - if (event.altKey)
|
| - this.selectedTreeElement.expandRecursively();
|
| - else
|
| - this.selectedTreeElement.expand();
|
| - }
|
| + } else {
|
| + handled = this.selectedTreeElement.descendOrExpand(event.altKey);
|
| }
|
| } else if (event.keyCode === 8 /* Backspace */ || event.keyCode === 46 /* Delete */)
|
| handled = this.selectedTreeElement.ondelete();
|
| @@ -278,11 +252,6 @@ TreeOutline.prototype = {
|
| else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Space.code)
|
| handled = this.selectedTreeElement.onspace();
|
|
|
| - if (nextSelectedElement) {
|
| - nextSelectedElement.reveal();
|
| - nextSelectedElement.select(false, true);
|
| - }
|
| -
|
| if (handled)
|
| event.consume(true);
|
| },
|
| @@ -913,6 +882,74 @@ TreeElement.prototype = {
|
| }
|
| },
|
|
|
| +
|
| + /**
|
| + * @param {boolean} altKey
|
| + * @return {boolean}
|
| + */
|
| + collapseOrAscend: function(altKey)
|
| + {
|
| + if (this.expanded) {
|
| + if (altKey)
|
| + this.collapseRecursively();
|
| + else
|
| + this.collapse();
|
| + return true;
|
| + }
|
| +
|
| + if (!this.parent || this.parent.root)
|
| + return false;
|
| +
|
| + var handled = true;
|
| + var nextSelectedElement;
|
| + if (this.parent.selectable) {
|
| + nextSelectedElement = this.parent;
|
| + while (nextSelectedElement && !nextSelectedElement.selectable)
|
| + nextSelectedElement = nextSelectedElement.parent;
|
| + handled = nextSelectedElement ? true : false;
|
| + } else if (this.parent) {
|
| + this.parent.collapse();
|
| + }
|
| +
|
| + if (nextSelectedElement) {
|
| + nextSelectedElement.reveal();
|
| + nextSelectedElement.select(false, true);
|
| + }
|
| +
|
| + return handled;
|
| + },
|
| +
|
| + /**
|
| + * @param {boolean} altKey
|
| + * @return {boolean}
|
| + */
|
| + descendOrExpand: function(altKey)
|
| + {
|
| + if (!this._expandable)
|
| + return false;
|
| +
|
| + var handled = true;
|
| + var nextSelectedElement;
|
| + if (this.expanded) {
|
| + nextSelectedElement = this.firstChild();
|
| + while (nextSelectedElement && !nextSelectedElement.selectable)
|
| + nextSelectedElement = nextSelectedElement.nextSibling;
|
| + handled = nextSelectedElement ? true : false;
|
| + } else {
|
| + if (altKey)
|
| + this.expandRecursively();
|
| + else
|
| + this.expand();
|
| + }
|
| +
|
| + if (nextSelectedElement) {
|
| + nextSelectedElement.reveal();
|
| + nextSelectedElement.select(false, true);
|
| + }
|
| +
|
| + return handled;
|
| + },
|
| +
|
| /**
|
| * @param {boolean=} center
|
| */
|
|
|