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

Side by Side Diff: third_party/polymer/v1_0/components-chromium/iron-list/iron-list-extracted.js

Issue 2885723002: [MD Bookmarks] Add keyboard navigation and selection to bookmark list. (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 (function() { 1 (function() {
2 2
3 var IOS = navigator.userAgent.match(/iP(?:hone|ad;(?: U;)? CPU) OS (\d+)/); 3 var IOS = navigator.userAgent.match(/iP(?:hone|ad;(?: U;)? CPU) OS (\d+)/);
4 var IOS_TOUCH_SCROLLING = IOS && IOS[1] >= 8; 4 var IOS_TOUCH_SCROLLING = IOS && IOS[1] >= 8;
5 var DEFAULT_PHYSICAL_COUNT = 3; 5 var DEFAULT_PHYSICAL_COUNT = 3;
6 var HIDDEN_Y = '-10000px'; 6 var HIDDEN_Y = '-10000px';
7 var ITEM_WIDTH = 0; 7 var ITEM_WIDTH = 0;
8 var ITEM_HEIGHT = 1; 8 var ITEM_HEIGHT = 1;
9 var SECRET_TABINDEX = -100; 9 var SECRET_TABINDEX = -100;
10 10
(...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 }, 1459 },
1460 1460
1461 _isIndexVisible: function(idx) { 1461 _isIndexVisible: function(idx) {
1462 return idx >= this.firstVisibleIndex && idx <= this.lastVisibleIndex; 1462 return idx >= this.firstVisibleIndex && idx <= this.lastVisibleIndex;
1463 }, 1463 },
1464 1464
1465 _getPhysicalIndex: function(idx) { 1465 _getPhysicalIndex: function(idx) {
1466 return this._physicalIndexForKey[this._collection.getKey(this._getNormaliz edItem(idx))]; 1466 return this._physicalIndexForKey[this._collection.getKey(this._getNormaliz edItem(idx))];
1467 }, 1467 },
1468 1468
1469 _focusPhysicalItem: function(idx) { 1469 focusPhysicalItem: function(idx) {
1470 if (idx < 0 || idx >= this._virtualCount) { 1470 if (idx < 0 || idx >= this._virtualCount) {
1471 return; 1471 return;
1472 } 1472 }
1473 this._restoreFocusedItem(); 1473 this._restoreFocusedItem();
1474 // scroll to index to make sure it's rendered 1474 // scroll to index to make sure it's rendered
1475 if (!this._isIndexRendered(idx)) { 1475 if (!this._isIndexRendered(idx)) {
1476 this.scrollToIndex(idx); 1476 this.scrollToIndex(idx);
1477 } 1477 }
1478 1478
1479 var physicalItem = this._physicalItems[this._getPhysicalIndex(idx)]; 1479 var physicalItem = this._physicalItems[this._getPhysicalIndex(idx)];
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 fidx = targetModel[this.indexAs]; 1585 fidx = targetModel[this.indexAs];
1586 this._focusedIndex = fidx; 1586 this._focusedIndex = fidx;
1587 this._focusedItem = this._physicalItems[this._getPhysicalIndex(fidx)]; 1587 this._focusedItem = this._physicalItems[this._getPhysicalIndex(fidx)];
1588 if (hasOffscreenFocusedItem && !this._offscreenFocusedItem) { 1588 if (hasOffscreenFocusedItem && !this._offscreenFocusedItem) {
1589 this._update(); 1589 this._update();
1590 } 1590 }
1591 } 1591 }
1592 }, 1592 },
1593 1593
1594 _didMoveUp: function() { 1594 _didMoveUp: function() {
1595 this._focusPhysicalItem(this._focusedIndex - 1); 1595 this.focusPhysicalItem(this._focusedIndex - 1);
1596 }, 1596 },
1597 1597
1598 _didMoveDown: function(e) { 1598 _didMoveDown: function(e) {
1599 // disable scroll when pressing the down key 1599 // disable scroll when pressing the down key
1600 e.detail.keyboardEvent.preventDefault(); 1600 e.detail.keyboardEvent.preventDefault();
1601 this._focusPhysicalItem(this._focusedIndex + 1); 1601 this.focusPhysicalItem(this._focusedIndex + 1);
1602 }, 1602 },
1603 1603
1604 _didEnter: function(e) { 1604 _didEnter: function(e) {
1605 this._focusPhysicalItem(this._focusedIndex); 1605 this.focusPhysicalItem(this._focusedIndex);
1606 this._selectionHandler(e.detail.keyboardEvent); 1606 this._selectionHandler(e.detail.keyboardEvent);
1607 } 1607 },
1608
1609 getFocusedIndex: function() {
1610 return this._focusedIndex;
1611 },
1612
1613 getFocusedItem: function() {
1614 return this._focusedItem;
1615 },
1608 }); 1616 });
1609 1617
1610 })(); 1618 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698