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

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

Issue 7903001: Improve Tab-key navigation for editing Autofill addresses and credit cards. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: De-nitting Created 9 years, 3 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) 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 // 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 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 851
852 // We cache the list items since creating the DOM nodes is the most 852 // We cache the list items since creating the DOM nodes is the most
853 // expensive part of redrawing. 853 // expensive part of redrawing.
854 var cachedItems = this.cachedItems_ || {}; 854 var cachedItems = this.cachedItems_ || {};
855 var newCachedItems = {}; 855 var newCachedItems = {};
856 856
857 var desiredScrollHeight = this.getHeightsForIndex_(dataModel.length).top; 857 var desiredScrollHeight = this.getHeightsForIndex_(dataModel.length).top;
858 858
859 var autoExpands = this.autoExpands_; 859 var autoExpands = this.autoExpands_;
860 var firstIndex = autoExpands ? 0 : this.getIndexForListOffset_(scrollTop); 860 var firstIndex = autoExpands ? 0 : this.getIndexForListOffset_(scrollTop);
861 // This is a bit tricky. We take the minimum of the available items to
862 // show and the number we want to show, so as not to go off the end of the
863 // list. For the number we want to show, we take the maximum of the number
864 // that would fit without a differently-sized lead item, and with one. We
865 // do this so that if the size of the lead item changes without a scroll
866 // event to trigger redrawing the list, we won't end up with empty space.
867 var itemsInViewPort = this.getItemsInViewPort(itemHeight, firstIndex, 861 var itemsInViewPort = this.getItemsInViewPort(itemHeight, firstIndex,
868 scrollTop); 862 scrollTop);
869 var lastIndex = firstIndex + itemsInViewPort; 863 var lastIndex = firstIndex + itemsInViewPort;
870 864
871 this.textContent = ''; 865 this.textContent = '';
872 866
873 this.beforeFiller_.style.height = 867 this.beforeFiller_.style.height =
874 this.getHeightsForIndex_(firstIndex).top + 'px'; 868 this.getHeightsForIndex_(firstIndex).top + 'px';
875 this.appendChild(this.beforeFiller_); 869 this.appendChild(this.beforeFiller_);
876 870
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 * because list items can contain controls that can be focused, and for some 939 * because list items can contain controls that can be focused, and for some
946 * purposes (e.g., styling), the list can still be conceptually focused at 940 * purposes (e.g., styling), the list can still be conceptually focused at
947 * that point even though it doesn't actually have the page focus. 941 * that point even though it doesn't actually have the page focus.
948 */ 942 */
949 cr.defineProperty(List, 'hasElementFocus', cr.PropertyKind.BOOL_ATTR); 943 cr.defineProperty(List, 'hasElementFocus', cr.PropertyKind.BOOL_ATTR);
950 944
951 return { 945 return {
952 List: List 946 List: List
953 } 947 }
954 }); 948 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698