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

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

Issue 9379023: Tweaks for improving file manager performance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Non-trivial merge with trunk 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
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 /** 5 /**
6 * @fileoverview This implements a table header. 6 * @fileoverview This implements a table header.
7 */ 7 */
8 8
9 cr.define('cr.ui.table', function() { 9 cr.define('cr.ui.table', function() {
10 const TableSplitter = cr.ui.TableSplitter; 10 const TableSplitter = cr.ui.TableSplitter;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 var splitters = this.querySelectorAll('.table-header-splitter'); 61 var splitters = this.querySelectorAll('.table-header-splitter');
62 var rtl = this.ownerDocument.defaultView.getComputedStyle(this) 62 var rtl = this.ownerDocument.defaultView.getComputedStyle(this)
63 .direction == 'rtl'; 63 .direction == 'rtl';
64 for (var i = 0; i < cm.size - 1; i++) { 64 for (var i = 0; i < cm.size - 1; i++) {
65 leftPercent += cm.getWidth(i); 65 leftPercent += cm.getWidth(i);
66 splitters[i].style.left = rtl ? 66 splitters[i].style.left = rtl ?
67 100 - leftPercent + '%' : leftPercent + '%'; 67 100 - leftPercent + '%' : leftPercent + '%';
68 } 68 }
69 }, 69 },
70 70
71 batchCount_: 0,
72
73 startBatchUpdates: function() {
74 this.batchCount_++;
75 },
76
77 endBatchUpdates: function() {
78 this.batchCount_--;
79 if (this.batchCount_ == 0)
80 this.redraw();
81 },
82
71 /** 83 /**
72 * Redraws table header. 84 * Redraws table header.
73 */ 85 */
74 redraw: function() { 86 redraw: function() {
87 if (this.batchCount_ != 0)
88 return;
89
75 var cm = this.table_.columnModel; 90 var cm = this.table_.columnModel;
76 var dm = this.table_.dataModel; 91 var dm = this.table_.dataModel;
77 92
78 this.updateWidth(); 93 this.updateWidth();
79 this.headerInner_.textContent = ''; 94 this.headerInner_.textContent = '';
80 95
81 if (!cm || ! dm) { 96 if (!cm || ! dm) {
82 return; 97 return;
83 } 98 }
84 99
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 /** 176 /**
162 * The table associated with the header. 177 * The table associated with the header.
163 * @type {cr.ui.Table} 178 * @type {cr.ui.Table}
164 */ 179 */
165 cr.defineProperty(TableHeader, 'table'); 180 cr.defineProperty(TableHeader, 'table');
166 181
167 return { 182 return {
168 TableHeader: TableHeader 183 TableHeader: TableHeader
169 }; 184 };
170 }); 185 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698