Chromium Code Reviews| Index: chrome/browser/resources/settings/settings_page/main_page_behavior.js |
| diff --git a/chrome/browser/resources/settings/settings_page/main_page_behavior.js b/chrome/browser/resources/settings/settings_page/main_page_behavior.js |
| index 6983546cefafa7429188c946682390539963ffc3..f2c42fc78118a6c0fc7e68ec4f4cb42a71a6a02b 100644 |
| --- a/chrome/browser/resources/settings/settings_page/main_page_behavior.js |
| +++ b/chrome/browser/resources/settings/settings_page/main_page_behavior.js |
| @@ -35,9 +35,7 @@ var MainPageBehaviorImpl = { |
| /** @type {?HTMLElement} The scrolling container. */ |
| scroller: null, |
| - listeners: { |
| - 'neon-animation-finish': 'onNeonAnimationFinish_' |
| - }, |
| + listeners: {'neon-animation-finish': 'onNeonAnimationFinish_'}, |
| /** @override */ |
| attached: function() { |
| @@ -90,9 +88,12 @@ var MainPageBehaviorImpl = { |
| // For previously uncreated pages (including on first load), allow the page |
| // to render before scrolling to or expanding the section. |
| - if (!oldRoute || this.scrollHeight == 0) |
| - setTimeout(this.tryTransitionToSection_.bind(this, scrollToSection)); |
| - else |
| + if (!oldRoute || this.scrollHeight == 0) { |
| + document.body.querySelector('settings-ui::shadow #container') |
|
michaelpg
2017/04/22 04:01:58
::shadow makes me sad, is there no other way to ge
scottchen
2017/04/26 17:26:40
I changed settings-ui to pass a "shouldHideContain
|
| + .setAttribute('hidden', true); |
|
scottchen
2017/04/19 18:05:22
without this line, the basic page will briefly app
michaelpg
2017/04/22 04:01:58
Yeah, it's probably necessary unless we want to ma
scottchen
2017/04/26 17:26:40
Acknowledged.
|
| + setTimeout( |
| + this.tryTransitionToSection_.bind(this, scrollToSection, true)); |
| + } else |
| this.tryTransitionToSection_(scrollToSection); |
| }, |
| @@ -118,7 +119,9 @@ var MainPageBehaviorImpl = { |
| * @param {boolean} scrollToSection |
| * @private |
| */ |
| - tryTransitionToSection_: function(scrollToSection) { |
| + tryTransitionToSection_: function(scrollToSection, immediate) { |
| + document.body.querySelector('settings-ui::shadow #container') |
|
michaelpg
2017/04/22 04:01:58
Does this only take effect on the first call? Perh
scottchen
2017/04/26 17:26:40
Done.
|
| + .removeAttribute('hidden'); |
| var currentRoute = settings.getCurrentRoute(); |
| var currentSection = this.getSection(currentRoute.section); |
| @@ -144,7 +147,7 @@ var MainPageBehaviorImpl = { |
| } else if (currentSection) { |
| // Expand the section into a subpage or scroll to it on the main page. |
| if (currentRoute.isSubpage()) |
| - promise = this.expandSection_(currentSection); |
| + promise = this.expandSection_(currentSection, immediate); |
| else if (scrollToSection) |
| currentSection.scrollIntoView(); |
| } else if ( |
| @@ -207,9 +210,20 @@ var MainPageBehaviorImpl = { |
| * @return {!Promise} Resolved when the transition is finished or canceled. |
| * @private |
| */ |
| - expandSection_: function(section) { |
| + expandSection_: function(section, immediate) { |
| assert(this.scroller); |
| + if (immediate) { |
| + section.immediateExpand(this.scroller); |
| + |
| + this.classList.add('showing-subpage'); |
| + this.toggleOtherSectionsHidden_(section.section, true); |
| + this.scroller.scrollTop = 0; |
|
michaelpg
2017/04/22 04:01:58
when is this not starting at 0?
scottchen
2017/04/26 17:26:41
Never, this is not necessary. Removing.
|
| + // Notify that the page is fully expanded. |
| + this.fire('subpage-expand'); |
| + return; |
| + } |
| + |
| if (!section.canAnimateExpand()) { |
| // Try to wait for the section to be created. |
|
michaelpg
2017/04/22 04:01:58
We *might* not need this anymore if the goal is to
scottchen
2017/04/26 17:26:40
Using !section.canAnimateExpand() to indicate firs
|
| return new Promise(function(resolve, reject) { |