| 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 99dbc67c6181c689a6c3d63067f450ed323534c5..f00f038dd7d5627698a674cd3999f99d4fe01119 100644
|
| --- a/chrome/browser/resources/settings/settings_page/main_page_behavior.js
|
| +++ b/chrome/browser/resources/settings/settings_page/main_page_behavior.js
|
| @@ -309,12 +309,14 @@ var MainPageBehaviorImpl = {
|
| },
|
| };
|
|
|
| +
|
| /** @polymerBehavior */
|
| var MainPageBehavior = [
|
| TransitionBehavior,
|
| MainPageBehaviorImpl
|
| ];
|
|
|
| +
|
| /**
|
| * TODO(michaelpg): integrate slide animations.
|
| * @polymerBehavior RoutableBehavior
|
| @@ -329,13 +331,23 @@ var RoutableBehaviorImpl = {
|
| },
|
| },
|
|
|
| + /**
|
| + * @param {string} section Name of the item to scroll into view.
|
| + */
|
| + scrollToSection: function(section) {
|
| + if (section) {
|
| + // TODO(dschuyler): Determine whether this setTimeout can be removed.
|
| + // See also: https://github.com/Polymer/polymer/issues/3629
|
| + setTimeout(function() {
|
| + this.getSection_(section).scrollIntoView();
|
| + }.bind(this));
|
| + }
|
| + },
|
| +
|
| /** @private */
|
| currentRouteChanged_: function(newRoute, oldRoute) {
|
| - // route.section is only non-empty when the user is within a subpage.
|
| - // When the user is not in a subpage, but on the Basic page, route.section
|
| - // is an empty string.
|
| - var newRouteIsSubpage = newRoute && newRoute.section;
|
| - var oldRouteIsSubpage = oldRoute && oldRoute.section;
|
| + var newRouteIsSubpage = newRoute && newRoute.subpage.length;
|
| + var oldRouteIsSubpage = oldRoute && oldRoute.subpage.length;
|
|
|
| if (!oldRoute && newRouteIsSubpage) {
|
| // Allow the page to load before expanding the section. TODO(michaelpg):
|
| @@ -357,6 +369,8 @@ var RoutableBehaviorImpl = {
|
| var section = this.getSection_(newRoute.section);
|
| if (section)
|
| this.expandSection(section);
|
| + } else if (newRoute && newRoute.section) {
|
| + this.scrollToSection(newRoute.section);
|
| }
|
| },
|
|
|
| @@ -372,6 +386,7 @@ var RoutableBehaviorImpl = {
|
| },
|
| };
|
|
|
| +
|
| /** @polymerBehavior */
|
| var RoutableBehavior = [
|
| MainPageBehavior,
|
|
|