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

Side by Side Diff: chrome/browser/resources/settings/settings_page/settings_section.js

Issue 2378933004: MD Settings: Skip unseen collapse animation (Closed)
Patch Set: work with about subpage too Created 4 years, 2 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
« no previous file with comments | « chrome/browser/resources/settings/settings_page/main_page_behavior.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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-section' shows a paper material themed section with a header 7 * 'settings-section' shows a paper material themed section with a header
8 * which shows its page title. 8 * which shows its page title.
9 * 9 *
10 * The section can expand vertically to fill its container's padding edge. 10 * The section can expand vertically to fill its container's padding edge.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 animation.finished.then(function() { 132 animation.finished.then(function() {
133 this.classList.add('expanded'); 133 this.classList.add('expanded');
134 }.bind(this), function() {}).then(function() { 134 }.bind(this), function() {}).then(function() {
135 // Unset these changes whether the animation finished or canceled. 135 // Unset these changes whether the animation finished or canceled.
136 this.classList.remove('expanding'); 136 this.classList.remove('expanding');
137 this.style.height = ''; 137 this.style.height = '';
138 }.bind(this)); 138 }.bind(this));
139 return animation; 139 return animation;
140 }, 140 },
141 141
142 /** @return {boolean} True if the section is currently expanded. */ 142 /**
143 * @return {boolean} True if the section is currently expanded and we know
144 * what the collapsed height should be.
145 */
143 canAnimateCollapse: function() { 146 canAnimateCollapse: function() {
144 return this.classList.contains('expanded') && this.clientHeight > 0 && 147 return this.classList.contains('expanded') && this.clientHeight > 0 &&
145 !Number.isNaN(this.collapsedHeight_); 148 !Number.isNaN(this.collapsedHeight_);
146 }, 149 },
147 150
148 /** 151 /**
149 * Prepares for the animation before the other sections become visible. 152 * Prepares for the animation before the other sections become visible.
150 * Call before animateCollapse(). 153 * Call before animateCollapse().
151 * @param {!HTMLElement} container 154 * @param {!HTMLElement} container
152 */ 155 */
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 246
244 var options = /** @type {!KeyframeEffectOptions} */({ 247 var options = /** @type {!KeyframeEffectOptions} */({
245 duration: settings.animation.Timing.DURATION, 248 duration: settings.animation.Timing.DURATION,
246 easing: settings.animation.Timing.EASING, 249 easing: settings.animation.Timing.EASING,
247 }); 250 });
248 251
249 return new settings.animation.Animation( 252 return new settings.animation.Animation(
250 this.$.card, [startFrame, endFrame], options); 253 this.$.card, [startFrame, endFrame], options);
251 }, 254 },
252 }); 255 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/settings_page/main_page_behavior.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698