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 c8f4645b1693cbbd22c23c00b5400f4d6d283ef2..a92882c9a28a8fe1a40809d87ce8c0315017d29d 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js |
+++ b/third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js |
@@ -286,6 +286,27 @@ TreeOutline.prototype = { |
event.consume(true); |
}, |
+ /** |
+ * @param {!TreeElement} treeElement |
+ * @param {boolean} center |
+ */ |
+ _deferredScrollIntoView: function(treeElement, center) |
+ { |
+ if (!this._treeElementToScrollIntoView) |
+ this.element.window().requestAnimationFrame(deferredScrollIntoView.bind(this)); |
+ this._treeElementToScrollIntoView = treeElement; |
+ this._centerUponScrollIntoView = center; |
+ /** |
+ * @this {TreeOutline} |
+ */ |
+ function deferredScrollIntoView() |
+ { |
+ this._treeElementToScrollIntoView.listItemElement.scrollIntoViewIfNeeded(this._centerUponScrollIntoView); |
+ delete this._treeElementToScrollIntoView; |
+ delete this._centerUponScrollIntoView; |
+ } |
+ }, |
+ |
__proto__: WebInspector.Object.prototype |
} |
@@ -852,7 +873,10 @@ TreeElement.prototype = { |
} |
}, |
- reveal: function() |
+ /** |
+ * @param {boolean=} center |
+ */ |
+ reveal: function(center) |
{ |
var currentAncestor = this.parent; |
while (currentAncestor && !currentAncestor.root) { |
@@ -861,9 +885,7 @@ TreeElement.prototype = { |
currentAncestor = currentAncestor.parent; |
} |
- this.listItemElement.scrollIntoViewIfNeeded(); |
- |
- this.onreveal(); |
+ this.treeOutline._deferredScrollIntoView(this, !!center); |
}, |
/** |
@@ -923,7 +945,7 @@ TreeElement.prototype = { |
*/ |
revealAndSelect: function(omitFocus) |
{ |
- this.reveal(); |
+ this.reveal(true); |
this.select(omitFocus); |
}, |
@@ -1006,10 +1028,6 @@ TreeElement.prototype = { |
return false; |
}, |
- onreveal: function() |
- { |
- }, |
- |
/** |
* @param {boolean=} selectedByUser |
* @return {boolean} |