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

Side by Side Diff: chrome/browser/resources/shared/js/cr/ui/list.js

Issue 9568039: Added guard to not set scrollTop if it hasn't changed. Surprisingly, this speeds up the list.redraw… (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Removed setting of scrollTop. Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // require: array_data_model.js 5 // require: array_data_model.js
6 // require: list_selection_model.js 6 // require: list_selection_model.js
7 // require: list_selection_controller.js 7 // require: list_selection_controller.js
8 // require: list_item.js 8 // require: list_item.js
9 9
10 /** 10 /**
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 var listItem = null; 1113 var listItem = null;
1114 if (leadIndex != -1 && newCachedItems[leadIndex]) 1114 if (leadIndex != -1 && newCachedItems[leadIndex])
1115 newCachedItems[leadIndex].lead = true; 1115 newCachedItems[leadIndex].lead = true;
1116 for (var y = firstIndex; y < lastIndex; y++) { 1116 for (var y = firstIndex; y < lastIndex; y++) {
1117 if (sm.getIndexSelected(y)) 1117 if (sm.getIndexSelected(y))
1118 newCachedItems[y].selected = true; 1118 newCachedItems[y].selected = true;
1119 else if (y != leadIndex) 1119 else if (y != leadIndex)
1120 listItem = newCachedItems[y]; 1120 listItem = newCachedItems[y];
1121 } 1121 }
1122 1122
1123 this.scrollTop = scrollTop;
1124
1125 this.firstIndex_ = firstIndex; 1123 this.firstIndex_ = firstIndex;
1126 this.lastIndex_ = lastIndex; 1124 this.lastIndex_ = lastIndex;
1127 1125
1128 this.remainingSpace_ = itemsInViewPort.last > dataModel.length; 1126 this.remainingSpace_ = itemsInViewPort.last > dataModel.length;
1129 this.cachedItems_ = newCachedItems; 1127 this.cachedItems_ = newCachedItems;
1130 1128
1131 // Mesurings must be placed after adding all the elements, to prevent 1129 // Mesurings must be placed after adding all the elements, to prevent
1132 // performance reducing. 1130 // performance reducing.
1133 if (!this.fixedHeight_) { 1131 if (!this.fixedHeight_) {
1134 for (var y = firstIndex; y < lastIndex; y++) 1132 for (var y = firstIndex; y < lastIndex; y++)
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 * because list items can contain controls that can be focused, and for some 1246 * because list items can contain controls that can be focused, and for some
1249 * purposes (e.g., styling), the list can still be conceptually focused at 1247 * purposes (e.g., styling), the list can still be conceptually focused at
1250 * that point even though it doesn't actually have the page focus. 1248 * that point even though it doesn't actually have the page focus.
1251 */ 1249 */
1252 cr.defineProperty(List, 'hasElementFocus', cr.PropertyKind.BOOL_ATTR); 1250 cr.defineProperty(List, 'hasElementFocus', cr.PropertyKind.BOOL_ATTR);
1253 1251
1254 return { 1252 return {
1255 List: List 1253 List: List
1256 } 1254 }
1257 }); 1255 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698