diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/inspector/front-end/treeoutline.js')
-rw-r--r-- | src/3rdparty/webkit/WebCore/inspector/front-end/treeoutline.js | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/treeoutline.js b/src/3rdparty/webkit/WebCore/inspector/front-end/treeoutline.js index ecc322b972..b6e35bbb85 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/treeoutline.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/treeoutline.js @@ -40,6 +40,9 @@ function TreeOutline(listNode) this.expanded = true; this.selected = false; this.treeOutline = this; + + this._childrenListNode.tabIndex = 0; + this._childrenListNode.addEventListener("keydown", this._treeKeyDown.bind(this), true); } TreeOutline._knownTreeElementNextIdentifier = 1; @@ -141,7 +144,15 @@ TreeOutline._removeChildAtIndex = function(childIndex) var child = this.children[childIndex]; this.children.splice(childIndex, 1); - child.deselect(); + var parent = child.parent; + if (child.deselect()) { + if (child.previousSibling) + child.previousSibling.select(); + else if (child.nextSibling) + child.nextSibling.select(); + else + parent.select(); + } if (child.previousSibling) child.previousSibling.nextSibling = child.nextSibling; @@ -327,10 +338,13 @@ TreeOutline.prototype.treeElementFromPoint = function(x, y) return null; } -TreeOutline.prototype.handleKeyEvent = function(event) +TreeOutline.prototype._treeKeyDown = function(event) { + if (event.target !== this._childrenListNode) + return; + if (!this.selectedTreeElement || event.shiftKey || event.metaKey || event.ctrlKey) - return false; + return; var handled = false; var nextSelectedElement; @@ -386,8 +400,6 @@ TreeOutline.prototype.handleKeyEvent = function(event) event.preventDefault(); event.stopPropagation(); } - - return handled; } TreeOutline.prototype.expand = function() @@ -624,7 +636,7 @@ TreeElement.treeElementDoubleClicked = function(event) return; if (element.treeElement.ondblclick) - element.treeElement.ondblclick(element.treeElement, event); + element.treeElement.ondblclick.call(element.treeElement, event); else if (element.treeElement.hasChildren && !element.treeElement.expanded) element.treeElement.expand(); } @@ -764,6 +776,7 @@ TreeElement.prototype.select = function(supressOnSelect) this.treeOutline.selectedTreeElement.deselect(); this.selected = true; + this.treeOutline._childrenListNode.focus(); this.treeOutline.selectedTreeElement = this; if (this._listItemNode) this._listItemNode.addStyleClass("selected"); @@ -775,7 +788,7 @@ TreeElement.prototype.select = function(supressOnSelect) TreeElement.prototype.deselect = function(supressOnDeselect) { if (!this.treeOutline || this.treeOutline.selectedTreeElement !== this || !this.selected) - return; + return false; this.selected = false; this.treeOutline.selectedTreeElement = null; @@ -784,6 +797,7 @@ TreeElement.prototype.deselect = function(supressOnDeselect) if (this.ondeselect && !supressOnDeselect) this.ondeselect(this); + return true; } TreeElement.prototype.traverseNextTreeElement = function(skipHidden, stayWithin, dontPopulate, info) |