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

Unified Diff: chrome/browser/resources/settings/settings_page/main_page_behavior.js

Issue 2378933004: MD Settings: Skip unseen collapse animation (Closed)
Patch Set: work with about subpage too 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/settings/settings_page/settings_section.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2e556e3a46f6075459ec02a691aa1a450ca472de..32087242d024aab72b1cb216e04aac380d3a78dc 100644
--- a/chrome/browser/resources/settings/settings_page/main_page_behavior.js
+++ b/chrome/browser/resources/settings/settings_page/main_page_behavior.js
@@ -210,8 +210,16 @@ var MainPageBehaviorImpl = {
assert(this.scroller);
assert(section.classList.contains('expanded'));
- var canAnimateCollapse = section.canAnimateCollapse();
- if (canAnimateCollapse) {
+ // Don't animate the collapse if we are transitioning between Basic/Advanced
+ // and About, since the section won't be visible.
+ var needAnimate =
+ settings.Route.ABOUT.contains(settings.getCurrentRoute()) ==
+ (section.domHost.tagName == 'SETTINGS-ABOUT-PAGE');
+
+ // Animate the collapse if the section knows the original height, except
+ // when switching between Basic/Advanced and About.
+ var shouldAnimateCollapse = needAnimate && section.canAnimateCollapse();
+ if (shouldAnimateCollapse) {
this.toggleScrolling_(false);
// Do the initial collapse setup, which takes the section out of the flow,
// before showing everything.
@@ -224,7 +232,7 @@ var MainPageBehaviorImpl = {
this.toggleOtherSectionsHidden_(section.section, false);
this.classList.remove('showing-subpage');
- if (!canAnimateCollapse) {
+ if (!shouldAnimateCollapse) {
// Finish by restoring the section into the page.
section.setFrozen(false);
return Promise.resolve();
« no previous file with comments | « no previous file | chrome/browser/resources/settings/settings_page/settings_section.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698