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

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

Issue 305813005: DevTools: Fix regression that slows down "Goto Source" dialog (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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/sources/FilteredItemSelectionDialog.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 1c049796772c249fb013f5ff477d4a045ed599d3..80fc0820200c41a3a01b411bab206c377cfd44df 100644
--- a/Source/devtools/front_end/ui/ViewportControl.js
+++ b/Source/devtools/front_end/ui/ViewportControl.js
@@ -66,6 +66,12 @@ WebInspector.ViewportControl.Provider = function()
WebInspector.ViewportControl.Provider.prototype = {
/**
+ * @param {number} index
+ * @return {number}
+ */
+ fastHeight: function(index) { return 0; },
+
+ /**
* @return {number}
*/
itemCount: function() { return 0; },
@@ -87,11 +93,6 @@ WebInspector.ViewportElement.prototype = {
wasShown: function() { },
/**
- * @return {number}
- */
- fastHeight: function() { },
-
- /**
* @return {!Element}
*/
element: function() { },
@@ -101,12 +102,10 @@ WebInspector.ViewportElement.prototype = {
* @constructor
* @implements {WebInspector.ViewportElement}
* @param {!Element} element
- * @param {number} height
*/
-WebInspector.StaticViewportElement = function(element, height)
+WebInspector.StaticViewportElement = function(element)
{
this._element = element;
- this._height = height;
}
WebInspector.StaticViewportElement.prototype = {
@@ -115,14 +114,6 @@ WebInspector.StaticViewportElement.prototype = {
wasShown: function() { },
/**
- * @return {number}
- */
- fastHeight: function()
- {
- return this._height;
- },
-
- /**
* @return {!Element}
*/
element: function()
@@ -188,9 +179,9 @@ WebInspector.ViewportControl.prototype = {
if (!itemCount)
return;
this._cumulativeHeights = new Int32Array(itemCount);
- this._cumulativeHeights[0] = this._provider.itemElement(0).fastHeight();
+ this._cumulativeHeights[0] = this._provider.fastHeight(0);
for (var i = 1; i < itemCount; ++i)
- this._cumulativeHeights[i] = this._cumulativeHeights[i - 1] + this._provider.itemElement(i).fastHeight();
+ this._cumulativeHeights[i] = this._cumulativeHeights[i - 1] + this._provider.fastHeight(i);
},
/**
@@ -361,7 +352,7 @@ WebInspector.ViewportControl.prototype = {
for (var i = 0; i < this._renderedItems.length; ++i) {
this._renderedItems[i].willHide();
// Tolerate 1-pixel error due to double-to-integer rounding errors.
- if (this._cumulativeHeights && Math.abs(this._cachedItemHeight(this._firstVisibleIndex + i) - this._renderedItems[i].fastHeight()) > 1)
+ if (this._cumulativeHeights && Math.abs(this._cachedItemHeight(this._firstVisibleIndex + i) - this._provider.fastHeight(i + this._firstVisibleIndex)) > 1)
delete this._cumulativeHeights;
}
this._rebuildCumulativeHeightsIfNeeded();
« no previous file with comments | « Source/devtools/front_end/sources/FilteredItemSelectionDialog.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698