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

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: function/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 25 matching lines...) Expand all
36 observer: 'currentRouteChanged_', 36 observer: 'currentRouteChanged_',
37 }, 37 },
38 38
39 // If false the 'basic' page should be shown. 39 // If false the 'basic' page should be shown.
40 showAdvancedPage_: { 40 showAdvancedPage_: {
41 type: Boolean, 41 type: Boolean,
42 value: false 42 value: false
43 } 43 }
44 }, 44 },
45 45
46 listeners: {
47 'expand-animation-complete': 'onExpandAnimationComplete_',
48 },
49
50 /** @private */ 46 /** @private */
51 currentRouteChanged_: function(newRoute, oldRoute) { 47 currentRouteChanged_: function(newRoute, oldRoute) {
52 this.showAdvancedPage_ = newRoute.page == 'advanced'; 48 this.showAdvancedPage_ = newRoute.page == 'advanced';
53
54 var pageContainer = this.$.pageContainer;
55 if (!oldRoute) {
56 pageContainer.classList.toggle('expanded', newRoute.section);
57 return;
58 }
59
60 // For contraction only, apply new styling immediately.
61 if (!newRoute.section && oldRoute.section) {
62 pageContainer.classList.remove('expanded');
63
64 // TODO(tommycli): Save and restore scroll position. crbug.com/537359.
65 pageContainer.scrollTop = 0;
66 }
67 },
68
69 /** @private */
70 onExpandAnimationComplete_: function() {
71 if (this.currentRoute.section) {
72 var pageContainer = this.$.pageContainer;
73 pageContainer.classList.add('expanded');
74 pageContainer.scrollTop = 0;
75 }
76 }, 49 },
77 }); 50 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/settings_main/settings_main.css ('k') | chrome/browser/resources/settings/settings_page.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698