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

Side by Side Diff: chrome/browser/resources/options/cookies_list.js

Issue 8608007: cr/ui/list.js: Support rows with variable heights. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Omit the custom lead item height Created 9 years 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
« no previous file with comments | « no previous file | chrome/browser/resources/options/intents_list.js » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 cr.define('options', function() { 5 cr.define('options', function() {
6 const DeletableItemList = options.DeletableItemList; 6 const DeletableItemList = options.DeletableItemList;
7 const DeletableItem = options.DeletableItem; 7 const DeletableItem = options.DeletableItem;
8 const ArrayDataModel = cr.ui.ArrayDataModel; 8 const ArrayDataModel = cr.ui.ArrayDataModel;
9 const ListSingleSelectionModel = cr.ui.ListSingleSelectionModel; 9 const ListSingleSelectionModel = cr.ui.ListSingleSelectionModel;
10 10
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 this.expanded_ = expanded; 153 this.expanded_ = expanded;
154 if (expanded) { 154 if (expanded) {
155 var oldExpanded = this.list.expandedItem; 155 var oldExpanded = this.list.expandedItem;
156 this.list.expandedItem = this; 156 this.list.expandedItem = this;
157 this.updateItems_(); 157 this.updateItems_();
158 if (oldExpanded) 158 if (oldExpanded)
159 oldExpanded.expanded = false; 159 oldExpanded.expanded = false;
160 this.classList.add('show-items'); 160 this.classList.add('show-items');
161 } else { 161 } else {
162 if (this.list.expandedItem == this) { 162 if (this.list.expandedItem == this) {
163 this.list.leadItemHeight = 0;
164 this.list.expandedItem = null; 163 this.list.expandedItem = null;
165 } 164 }
166 this.style.height = ''; 165 this.style.height = '';
167 this.itemsChild.style.height = ''; 166 this.itemsChild.style.height = '';
168 this.classList.remove('show-items'); 167 this.classList.remove('show-items');
169 } 168 }
170 }, 169 },
171 170
172 /** 171 /**
173 * The callback for the "remove" button shown when an item is selected. 172 * The callback for the "remove" button shown when an item is selected.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 var itemsHeight = getItemHeight(this.itemsChild); 205 var itemsHeight = getItemHeight(this.itemsChild);
207 var fixedHeight = getItemHeight(this) + itemsHeight - this.itemsHeight_; 206 var fixedHeight = getItemHeight(this) + itemsHeight - this.itemsHeight_;
208 this.itemsChild.style.height = this.itemsHeight_ + 'px'; 207 this.itemsChild.style.height = this.itemsHeight_ + 'px';
209 // Force relayout before enabling animation, so that if we have 208 // Force relayout before enabling animation, so that if we have
210 // changed things since the last layout, they will not be animated 209 // changed things since the last layout, they will not be animated
211 // during subsequent layouts. 210 // during subsequent layouts.
212 this.itemsChild.offsetHeight; 211 this.itemsChild.offsetHeight;
213 this.classList.remove('measure-items'); 212 this.classList.remove('measure-items');
214 this.itemsChild.style.height = itemsHeight + 'px'; 213 this.itemsChild.style.height = itemsHeight + 'px';
215 this.style.height = fixedHeight + 'px'; 214 this.style.height = fixedHeight + 'px';
216 if (this.expanded)
217 this.list.leadItemHeight = fixedHeight;
218 }, 215 },
219 216
220 /** 217 /**
221 * Updates the origin summary to reflect changes in its items. 218 * Updates the origin summary to reflect changes in its items.
222 * Both CookieListItem and CookieTreeNode implement this API. 219 * Both CookieListItem and CookieTreeNode implement this API.
223 * This implementation scans the descendants to update the text. 220 * This implementation scans the descendants to update the text.
224 */ 221 */
225 updateOrigin: function() { 222 updateOrigin: function() {
226 var info = { 223 var info = {
227 cookies: 0, 224 cookies: 0,
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 DeletableItemList.prototype.decorate.call(this); 613 DeletableItemList.prototype.decorate.call(this);
617 this.classList.add('cookie-list'); 614 this.classList.add('cookie-list');
618 this.data_ = []; 615 this.data_ = [];
619 this.dataModel = new ArrayDataModel(this.data_); 616 this.dataModel = new ArrayDataModel(this.data_);
620 this.addEventListener('keydown', this.handleKeyLeftRight_.bind(this)); 617 this.addEventListener('keydown', this.handleKeyLeftRight_.bind(this));
621 var sm = new ListSingleSelectionModel(); 618 var sm = new ListSingleSelectionModel();
622 sm.addEventListener('change', this.cookieSelectionChange_.bind(this)); 619 sm.addEventListener('change', this.cookieSelectionChange_.bind(this));
623 sm.addEventListener('leadIndexChange', this.cookieLeadChange_.bind(this)); 620 sm.addEventListener('leadIndexChange', this.cookieLeadChange_.bind(this));
624 this.selectionModel = sm; 621 this.selectionModel = sm;
625 this.infoNodes = {}; 622 this.infoNodes = {};
623 this.fixedHeight = false;
626 var doc = this.ownerDocument; 624 var doc = this.ownerDocument;
627 // Create a table for each type of site data (e.g. cookies, databases, 625 // Create a table for each type of site data (e.g. cookies, databases,
628 // etc.) and save it so that we can reuse it for all origins. 626 // etc.) and save it so that we can reuse it for all origins.
629 for (var type in cookieInfo) { 627 for (var type in cookieInfo) {
630 var table = doc.createElement('table'); 628 var table = doc.createElement('table');
631 table.className = 'cookie-details-table'; 629 table.className = 'cookie-details-table';
632 var tbody = doc.createElement('tbody'); 630 var tbody = doc.createElement('tbody');
633 table.appendChild(tbody); 631 table.appendChild(tbody);
634 var info = {}; 632 var info = {};
635 for (var i = 0; i < cookieInfo[type].length; i++) { 633 for (var i = 0; i < cookieInfo[type].length; i++) {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 parent.clear(); 844 parent.clear();
847 this.addByParent_(parent, 0, children); 845 this.addByParent_(parent, 0, children);
848 parent.endBatchUpdates(); 846 parent.endBatchUpdates();
849 }, 847 },
850 }; 848 };
851 849
852 return { 850 return {
853 CookiesList: CookiesList 851 CookiesList: CookiesList
854 }; 852 };
855 }); 853 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/options/intents_list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698