Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(534)

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js

Issue 1461283004: DevTools: defer reveal in TreeOutline using rAF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/SidebarTreeElement.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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}
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/SidebarTreeElement.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698