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

Side by Side Diff: chrome/browser/resources/settings/settings_page/main_page_behavior.js

Issue 2305533002: MD Settings: Reset scroll when sliding subpages (Closed)
Patch Set: rebase 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 /** 5 /**
6 * Calls |readyTest| repeatedly until it returns true, then calls 6 * Calls |readyTest| repeatedly until it returns true, then calls
7 * |readyCallback|. 7 * |readyCallback|.
8 * @param {function():boolean} readyTest 8 * @param {function():boolean} readyTest
9 * @param {!Function} readyCallback 9 * @param {!Function} readyCallback
10 */ 10 */
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 var promise; 89 var promise;
90 var expandedSection = /** @type {?SettingsSectionElement} */( 90 var expandedSection = /** @type {?SettingsSectionElement} */(
91 this.$$('settings-section.expanded')); 91 this.$$('settings-section.expanded'));
92 if (expandedSection) { 92 if (expandedSection) {
93 // If the section shouldn't be expanded, collapse it. 93 // If the section shouldn't be expanded, collapse it.
94 if (!currentRoute.isSubpage() || expandedSection != currentSection) { 94 if (!currentRoute.isSubpage() || expandedSection != currentSection) {
95 promise = this.collapseSection_(expandedSection); 95 promise = this.collapseSection_(expandedSection);
96 // Scroll to the collapsed section. 96 // Scroll to the collapsed section.
97 if (currentSection && !settings.lastRouteChangeWasPopstate()) 97 if (currentSection && !settings.lastRouteChangeWasPopstate())
98 currentSection.scrollIntoView(); 98 currentSection.scrollIntoView();
99 } else {
100 // Scroll to top while sliding to another subpage.
101 this.scroller.scrollTop = 0;
99 } 102 }
100 } else if (currentSection) { 103 } else if (currentSection) {
101 // Expand the section into a subpage or scroll to it on the main page. 104 // Expand the section into a subpage or scroll to it on the main page.
102 if (currentRoute.isSubpage()) 105 if (currentRoute.isSubpage())
103 promise = this.expandSection_(currentSection); 106 promise = this.expandSection_(currentSection);
104 else if (!settings.lastRouteChangeWasPopstate()) 107 else if (!settings.lastRouteChangeWasPopstate())
105 currentSection.scrollIntoView(); 108 currentSection.scrollIntoView();
106 } 109 }
107 110
108 // When this animation ends, another may be necessary. Call this function 111 // When this animation ends, another may be necessary. Call this function
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 this.scroller.style.width = 'calc(100% - ' + scrollbarWidth + 'px)'; 301 this.scroller.style.width = 'calc(100% - ' + scrollbarWidth + 'px)';
299 } 302 }
300 } 303 }
301 }; 304 };
302 305
303 /** @polymerBehavior */ 306 /** @polymerBehavior */
304 var MainPageBehavior = [ 307 var MainPageBehavior = [
305 settings.RouteObserverBehavior, 308 settings.RouteObserverBehavior,
306 MainPageBehaviorImpl, 309 MainPageBehaviorImpl,
307 ]; 310 ];
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698