Chromium Code Reviews| Index: ui/webui/resources/js/cr/ui/list.js |
| diff --git a/ui/webui/resources/js/cr/ui/list.js b/ui/webui/resources/js/cr/ui/list.js |
| index 0849e5bb26c8dfb2a0f4e5ae0872d3db63a80dea..f3d9a1cfcc35ede8e7a3c041e0536dc24fc727fb 100644 |
| --- a/ui/webui/resources/js/cr/ui/list.js |
| +++ b/ui/webui/resources/js/cr/ui/list.js |
| @@ -719,12 +719,11 @@ cr.define('cr.ui', function() { |
| /** |
| * Ensures that a given index is inside the viewport. |
| * @param {number} index The index of the item to scroll into view. |
| - * @return {boolean} Whether any scrolling was needed. |
| */ |
| scrollIndexIntoView: function(index) { |
| var dataModel = this.dataModel; |
| if (!dataModel || index < 0 || index >= dataModel.length) |
| - return false; |
| + return; |
| var itemHeight = this.getItemHeightByIndex_(index); |
| var scrollTop = this.scrollTop; |
| @@ -740,27 +739,24 @@ cr.define('cr.ui', function() { |
| // Function to adjust the tops of viewport and row. |
| function scrollToAdjustTop() { |
| self.scrollTop = top; |
|
Dan Beam
2015/10/21 01:35:26
these should be 2 spaces less indented
fukino
2015/10/21 04:00:28
Sorry! I forgot to fix these indents. Done.
|
| - return true; |
| - }; |
| + } |
| // Function to adjust the bottoms of viewport and row. |
| function scrollToAdjustBottom() { |
| self.scrollTop = top + itemHeight - availableHeight; |
| - return true; |
| - }; |
| + } |
| // Check if the entire of given indexed row can be shown in the viewport. |
| if (itemHeight <= availableHeight) { |
| if (top < scrollTop) |
| - return scrollToAdjustTop(); |
| - if (scrollTop + availableHeight < top + itemHeight) |
| - return scrollToAdjustBottom(); |
| + scrollToAdjustTop(); |
| + else if (scrollTop + availableHeight < top + itemHeight) |
| + scrollToAdjustBottom(); |
| } else { |
| if (scrollTop < top) |
| - return scrollToAdjustTop(); |
| - if (top + itemHeight < scrollTop + availableHeight) |
| - return scrollToAdjustBottom(); |
| + scrollToAdjustTop(); |
| + else if (top + itemHeight < scrollTop + availableHeight) |
| + scrollToAdjustBottom(); |
| } |
| - return false; |
| }, |
| /** |