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

Side by Side Diff: chrome/browser/resources/settings/settings_main/settings_main.js

Issue 1736733003: MD Settings: Custom expand/collapse section animations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 * @fileoverview 6 * @fileoverview
7 * 'settings-main' displays the selected settings page. 7 * 'settings-main' displays the selected settings page.
8 * 8 *
9 * Example: 9 * Example:
10 * 10 *
(...skipping 28 matching lines...) Expand all
39 observer: 'currentRouteChanged_', 39 observer: 'currentRouteChanged_',
40 }, 40 },
41 41
42 // If false the 'basic' page should be shown. 42 // If false the 'basic' page should be shown.
43 showAdvancedPage_: { 43 showAdvancedPage_: {
44 type: Boolean, 44 type: Boolean,
45 value: false 45 value: false
46 } 46 }
47 }, 47 },
48 48
49 listeners: {
50 'expand-animation-complete': 'onExpandAnimationComplete_',
51 },
52
53 /** @private */ 49 /** @private */
54 currentRouteChanged_: function(newRoute, oldRoute) { 50 currentRouteChanged_: function(newRoute, oldRoute) {
55 this.showAdvancedPage_ = newRoute.page == 'advanced'; 51 this.showAdvancedPage_ = newRoute.page == 'advanced';
56
57 var pageContainer = this.$.pageContainer;
58 if (!oldRoute) {
59 pageContainer.classList.toggle('expanded', newRoute.section);
60 return;
61 }
62
63 // For contraction only, apply new styling immediately.
64 if (!newRoute.section && oldRoute.section) {
65 pageContainer.classList.remove('expanded');
66
67 // TODO(tommycli): Save and restore scroll position. crbug.com/537359.
68 pageContainer.scrollTop = 0;
69 }
70 },
71
72 /** @private */
73 onExpandAnimationComplete_: function() {
74 if (this.currentRoute.section) {
75 var pageContainer = this.$.pageContainer;
76 pageContainer.classList.add('expanded');
77 pageContainer.scrollTop = 0;
78 }
79 }, 52 },
80 }); 53 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698