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

Side by Side Diff: chrome/browser/resources/file_manager/js/file_table.js

Issue 15809008: Make resizing in Files.app more responsive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed. Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/file_manager/js/file_manager.js ('k') | 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 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * Namespace for utility functions. 8 * Namespace for utility functions.
9 */ 9 */
10 var filelist = {}; 10 var filelist = {};
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 e.preventDefault(); 156 e.preventDefault();
157 }); 157 });
158 } 158 }
159 159
160 var handleSelectionChange = function() { 160 var handleSelectionChange = function() {
161 var selectAll = self.querySelector('#select-all-checkbox'); 161 var selectAll = self.querySelector('#select-all-checkbox');
162 if (selectAll) 162 if (selectAll)
163 self.updateSelectAllCheckboxState_(selectAll); 163 self.updateSelectAllCheckboxState_(selectAll);
164 }; 164 };
165 165
166 self.relayoutAggregation_ =
167 new AsyncUtil.Aggregation(self.relayoutImmediately_.bind(self));
168
166 Object.defineProperty(self.list_, 'selectionModel', { 169 Object.defineProperty(self.list_, 'selectionModel', {
167 get: function() { 170 get: function() {
168 return this.selectionModel_; 171 return this.selectionModel_;
169 }, 172 },
170 set: function(value) { 173 set: function(value) {
171 var sm = this.selectionModel; 174 var sm = this.selectionModel;
172 if (sm) 175 if (sm)
173 sm.removeEventListener('change', handleSelectionChange); 176 sm.removeEventListener('change', handleSelectionChange);
174 177
175 util.callInheritedSetter(this, 'selectionModel', value); 178 util.callInheritedSetter(this, 'selectionModel', value);
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 var icon = this.ownerDocument.createElement('div'); 665 var icon = this.ownerDocument.createElement('div');
663 icon.className = 'detail-icon'; 666 icon.className = 'detail-icon';
664 icon.setAttribute('file-type-icon', FileType.getIcon(entry)); 667 icon.setAttribute('file-type-icon', FileType.getIcon(entry));
665 return icon; 668 return icon;
666 }; 669 };
667 670
668 /** 671 /**
669 * Redraws the UI. Skips multiple consecutive calls. 672 * Redraws the UI. Skips multiple consecutive calls.
670 */ 673 */
671 FileTable.prototype.relayout = function() { 674 FileTable.prototype.relayout = function() {
672 if (this.resizeTableTimer_) { 675 this.relayoutAggregation_.run();
673 clearTimeout(this.resizeTableTimer_);
674 this.resizeTableTimer_ = null;
675 }
676 this.resizeTableTimer_ = setTimeout(function() {
677 if (util.platform.newUI()) {
678 if (this.clientWidth > 0)
679 this.normalizeColumns();
680 }
681 this.redraw();
682 cr.dispatchSimpleEvent(this.list, 'relayout');
683 this.resizeTableTimer_ = null;
684 }.bind(this), 100);
685 }; 676 };
686 677
687 /** 678 /**
679 * Redraws the UI immediately.
680 * @private
681 */
682 FileTable.prototype.relayoutImmediately_ = function() {
683 if (util.platform.newUI()) {
684 if (this.clientWidth > 0)
685 this.normalizeColumns();
686 }
687 this.redraw();
688 cr.dispatchSimpleEvent(this.list, 'relayout');
689 };
690
691 /**
688 * Decorates (and wire up) a checkbox to be used in either a detail or a 692 * Decorates (and wire up) a checkbox to be used in either a detail or a
689 * thumbnail list item. 693 * thumbnail list item.
690 * @param {HTMLInputElement} input Element to decorate. 694 * @param {HTMLInputElement} input Element to decorate.
691 */ 695 */
692 filelist.decorateCheckbox = function(input) { 696 filelist.decorateCheckbox = function(input) {
693 var stopEventPropagation = function(event) { 697 var stopEventPropagation = function(event) {
694 if (!event.shiftKey) 698 if (!event.shiftKey)
695 event.stopPropagation(); 699 event.stopPropagation();
696 }; 700 };
697 input.setAttribute('type', 'checkbox'); 701 input.setAttribute('type', 'checkbox');
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 break; 837 break;
834 } 838 }
835 } 839 }
836 if (url) { 840 if (url) {
837 iconDiv.style.backgroundImage = 'url(' + url + ')'; 841 iconDiv.style.backgroundImage = 'url(' + url + ')';
838 } else { 842 } else {
839 iconDiv.style.backgroundImage = null; 843 iconDiv.style.backgroundImage = null;
840 } 844 }
841 } 845 }
842 }; 846 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/file_manager/js/file_manager.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698