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

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

Issue 1463143005: DevTools: avoid layout thrashing on Layers panel (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/timeline/Layers3DView.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..2cdf83aaa1e72e68149b7ebe0c0f4a483d3fdd15 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,28 @@ TreeOutline.prototype = {
event.consume(true);
},
+ /**
+ * @param {!TreeElement} treeElement
+ */
+ _deferredScrollIntoView: function(treeElement)
+ {
+ if (!this._treeElementToScrollIntoView)
+ this.element.window().requestAnimationFrame(deferredScrollIntoView.bind(this));
+ this._treeElementToScrollIntoView = treeElement;
+ /**
+ * @this {TreeOutline}
+ */
+ function deferredScrollIntoView()
+ {
+ var treeElement = this._treeElementToScrollIntoView;
+ delete this._treeElementToScrollIntoView;
+ if (treeElement.treeOutline !== this || !treeElement.listItemElement)
pfeldman 2015/11/20 22:48:52 nuke those
+ return;
+ treeElement.listItemElement.scrollIntoViewIfNeeded();
+ treeElement.onreveal();
+ }
+ },
+
__proto__: WebInspector.Object.prototype
}
@@ -861,9 +883,12 @@ TreeElement.prototype = {
currentAncestor = currentAncestor.parent;
}
- this.listItemElement.scrollIntoViewIfNeeded();
+ this.treeOutline._deferredScrollIntoView(this);
+ },
- this.onreveal();
pfeldman 2015/11/20 22:48:52 I think you want it there synchronously.
+ _deferredScrollIntoView: function()
pfeldman 2015/11/20 22:48:52 unused
+ {
+ this.listItemElement.scrollIntoViewIfNeeded();
},
/**
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/Layers3DView.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698