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

Unified Diff: Source/devtools/front_end/ui/ViewportControl.js

Issue 340483003: DevTools: [Console] Separate height caching from willHide event (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: cacheHeight -> cacheFastHeight Created 6 years, 6 months 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 | « Source/devtools/front_end/console/ConsoleViewMessage.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/ui/ViewportControl.js
diff --git a/Source/devtools/front_end/ui/ViewportControl.js b/Source/devtools/front_end/ui/ViewportControl.js
index 580097376d608b847b6704f41f1cfd83b9265362..51f12f5ca016291ff239e7e30518b3cf7be45a0f 100644
--- a/Source/devtools/front_end/ui/ViewportControl.js
+++ b/Source/devtools/front_end/ui/ViewportControl.js
@@ -88,6 +88,8 @@ WebInspector.ViewportControl.Provider.prototype = {
*/
WebInspector.ViewportElement = function() { }
WebInspector.ViewportElement.prototype = {
+ cacheFastHeight: function() { },
+
willHide: function() { },
wasShown: function() { },
@@ -109,6 +111,8 @@ WebInspector.StaticViewportElement = function(element)
}
WebInspector.StaticViewportElement.prototype = {
+ cacheFastHeight: function() { },
+
willHide: function() { },
wasShown: function() { },
@@ -330,6 +334,8 @@ WebInspector.ViewportControl.prototype = {
var itemCount = this._provider.itemCount();
if (!itemCount) {
for (var i = 0; i < this._renderedItems.length; ++i)
+ this._renderedItems[i].cacheFastHeight();
+ for (var i = 0; i < this._renderedItems.length; ++i)
this._renderedItems[i].willHide();
this._renderedItems = [];
this._contentElement.removeChildren();
@@ -350,7 +356,7 @@ WebInspector.ViewportControl.prototype = {
if (this._cumulativeHeights && itemCount !== this._cumulativeHeights.length)
delete this._cumulativeHeights;
for (var i = 0; i < this._renderedItems.length; ++i) {
- this._renderedItems[i].willHide();
+ this._renderedItems[i].cacheFastHeight();
// Tolerate 1-pixel error due to double-to-integer rounding errors.
if (this._cumulativeHeights && Math.abs(this._cachedItemHeight(this._firstVisibleIndex + i) - this._provider.fastHeight(i + this._firstVisibleIndex)) > 1)
delete this._cumulativeHeights;
@@ -372,6 +378,8 @@ WebInspector.ViewportControl.prototype = {
this._bottomGapElement._active = !!bottomGapHeight;
this._contentElement.style.setProperty("height", "10000000px");
+ for (var i = 0; i < this._renderedItems.length; ++i)
+ this._renderedItems[i].willHide();
this._renderedItems = [];
this._contentElement.removeChildren();
for (var i = this._firstVisibleIndex; i <= this._lastVisibleIndex; ++i) {
« no previous file with comments | « Source/devtools/front_end/console/ConsoleViewMessage.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698