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

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

Issue 2314283002: Roll Polymer (Closed)
Patch Set: dep Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/v1_0/components-chromium/iron-list/iron-list-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/iron-list/iron-list-extracted.js b/third_party/polymer/v1_0/components-chromium/iron-list/iron-list-extracted.js
index 50fda9d32d4382b9c38d37c8d5430b67247c3c81..57f1260dd4598a7df9a823652a56c487f9d078cd 100644
--- a/third_party/polymer/v1_0/components-chromium/iron-list/iron-list-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/iron-list/iron-list-extracted.js
@@ -1179,9 +1179,11 @@
if (typeof idx !== 'number' || idx < 0 || idx > this.items.length - 1) {
return;
}
-
Polymer.dom.flush();
-
+ // Items should have been rendered prior scrolling to an index.
+ if (!this._itemsRendered) {
+ return;
+ }
idx = Math.min(Math.max(idx, 0), this._virtualCount-1);
// update the virtual start only when needed
if (!this._isIndexRendered(idx) || idx >= this._maxVirtualStart) {
@@ -1193,16 +1195,13 @@
this._assignModels();
// measure the new sizes
this._updateMetrics();
-
// estimate new physical offset
- var estPhysicalTop = Math.floor(this._virtualStart / this._itemsPerRow) * this._physicalAverage;
- this._physicalTop = estPhysicalTop;
+ this._physicalTop = Math.floor(this._virtualStart / this._itemsPerRow) * this._physicalAverage;
var currentTopItem = this._physicalStart;
var currentVirtualItem = this._virtualStart;
var targetOffsetTop = 0;
var hiddenContentSize = this._hiddenContentSize;
-
// scroll to the item as much as we can
while (currentVirtualItem < idx && targetOffsetTop <= hiddenContentSize) {
targetOffsetTop = targetOffsetTop + this._getPhysicalSizeIncrement(currentTopItem);
@@ -1391,9 +1390,10 @@
model.tabIndex = SECRET_TABINDEX;
activeElTabIndex = activeEl ? activeEl.tabIndex : -1;
model.tabIndex = modelTabIndex;
+
// Only select the item if the tap wasn't on a focusable child
// or the element bound to `tabIndex`
- if (activeEl && physicalItem.contains(activeEl) && activeElTabIndex !== SECRET_TABINDEX) {
+ if (activeEl && physicalItem !== activeEl && physicalItem.contains(activeEl) && activeElTabIndex !== SECRET_TABINDEX) {
return;
}
this.toggleSelectionForItem(model[this.as]);

Powered by Google App Engine
This is Rietveld 408576698