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

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

Issue 2197093002: MD Settings: Fix starting height of expanding sections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@FixErrors
Patch Set: rebase Created 4 years, 4 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/settings_animated_pages.html ('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-animated-pages' is a container for a page and animated subpages. 7 * 'settings-animated-pages' is a container for a page and animated subpages.
8 * It provides a set of common behaviors and animations. 8 * It provides a set of common behaviors and animations.
9 * 9 *
10 * Example: 10 * Example:
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // For transitioning between subpages at different levels, slide. 101 // For transitioning between subpages at different levels, slide.
102 if (newRoute.subpage.length > oldRoute.subpage.length) { 102 if (newRoute.subpage.length > oldRoute.subpage.length) {
103 this.$.animatedPages.exitAnimation = 'slide-left-animation'; 103 this.$.animatedPages.exitAnimation = 'slide-left-animation';
104 this.$.animatedPages.entryAnimation = 'slide-from-right-animation'; 104 this.$.animatedPages.entryAnimation = 'slide-from-right-animation';
105 } else { 105 } else {
106 this.$.animatedPages.exitAnimation = 'slide-right-animation'; 106 this.$.animatedPages.exitAnimation = 'slide-right-animation';
107 this.$.animatedPages.entryAnimation = 'slide-from-left-animation'; 107 this.$.animatedPages.entryAnimation = 'slide-from-left-animation';
108 } 108 }
109 } 109 }
110 110
111 if (newRouteIsSubpage && newRoute.section == this.section) 111 if (newRouteIsSubpage && newRoute.section == this.section) {
112 if (!oldRouteIsSubpage) {
113 // Set the height the expand animation should start at before beginning
114 // the transition to the new sub-page.
115 // TODO(michaelpg): Remove MainPageBehavior's dependency on this height
116 // being set.
117 this.style.height = this.clientHeight + 'px';
118 this.async(function() {
119 this.style.height = '';
120 });
121 }
112 this.$.animatedPages.selected = newRoute.subpage.slice(-1)[0]; 122 this.$.animatedPages.selected = newRoute.subpage.slice(-1)[0];
113 else 123 } else {
114 this.$.animatedPages.selected = 'main'; 124 this.$.animatedPages.selected = 'main';
125 }
115 }, 126 },
116 127
117 /** 128 /**
118 * Ensures that the template enclosing the subpage is stamped. 129 * Ensures that the template enclosing the subpage is stamped.
119 * @private 130 * @private
120 */ 131 */
121 ensureSubpageInstance_: function() { 132 ensureSubpageInstance_: function() {
122 var id = this.currentRoute.subpage.slice(-1)[0]; 133 var id = this.currentRoute.subpage.slice(-1)[0];
123 var template = Polymer.dom(this).querySelector( 134 var template = Polymer.dom(this).querySelector(
124 'template[name="' + id + '"]'); 135 'template[name="' + id + '"]');
125 136
126 // Nothing to do if the subpage isn't wrapped in a <template> or the 137 // Nothing to do if the subpage isn't wrapped in a <template> or the
127 // template is already stamped. 138 // template is already stamped.
128 if (!template || template.if) 139 if (!template || template.if)
129 return; 140 return;
130 141
131 // Set the subpage's id for use by neon-animated-pages. 142 // Set the subpage's id for use by neon-animated-pages.
132 var subpage = /** @type {{_content: DocumentFragment}} */(template)._content 143 var subpage = /** @type {{_content: DocumentFragment}} */(template)._content
133 .querySelector('settings-subpage'); 144 .querySelector('settings-subpage');
134 if (!subpage.id) 145 if (!subpage.id)
135 subpage.id = id; 146 subpage.id = id;
136 147
137 // Render synchronously so neon-animated-pages can select the subpage. 148 // Render synchronously so neon-animated-pages can select the subpage.
138 template.if = true; 149 template.if = true;
139 template.render(); 150 template.render();
140 }, 151 },
141 }); 152 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/settings_page/settings_animated_pages.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698