| Index: ui/webui/resources/cr_elements/cr_scrollable_behavior.js
|
| diff --git a/ui/webui/resources/cr_elements/cr_scrollable_behavior.js b/ui/webui/resources/cr_elements/cr_scrollable_behavior.js
|
| index 5589c18ed448bc8ab46ad12fd051340f5f9d6e78..6e5dd3d28e98336c346a21a1f47051c47d298e8d 100644
|
| --- a/ui/webui/resources/cr_elements/cr_scrollable_behavior.js
|
| +++ b/ui/webui/resources/cr_elements/cr_scrollable_behavior.js
|
| @@ -36,10 +36,9 @@
|
|
|
| /** @polymerBehavior */
|
| var CrScrollableBehavior = {
|
| - properties: {
|
| - /** @private {number|null} */
|
| - intervalId_: {type: Number, value: null}
|
| - },
|
| +
|
| + /** @private {number|null} */
|
| + intervalId_: null,
|
|
|
| ready: function() {
|
| var scrollableElements = this.root.querySelectorAll('[scrollable]');
|
| @@ -93,6 +92,26 @@ var CrScrollableBehavior = {
|
| }.bind(this), 10);
|
| },
|
|
|
| + /** @param {!IronListElement} list */
|
| + saveScroll: function(list) {
|
| + // Store a FIFO of saved scroll positions so that multiple updates in a
|
| + // frame are applied correctly. Specifically we need to track when '0' is
|
| + // saved (but not apply it), and still handle patterns like [30, 0, 32].
|
| + list.savedScrollTops = list.savedScrollTops || [];
|
| + list.savedScrollTops.push(list.scrollTarget.scrollTop);
|
| + },
|
| +
|
| + /** @param {!IronListElement} list */
|
| + restoreScroll: function(list) {
|
| + this.async(function() {
|
| + var scrollTop = list.savedScrollTops.shift();
|
| + // Ignore scrollTop of 0 in case it was intermittent (we do not need to
|
| + // explicity scroll to 0).
|
| + if (scrollTop != 0)
|
| + list.scroll(0, scrollTop);
|
| + });
|
| + },
|
| +
|
| /**
|
| * Event wrapper for updateScroll_.
|
| * @param {!Event} event
|
|
|