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

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

Issue 2865753002: test instant subpage load with animation duration 0 (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 * Responds to route changes by expanding, collapsing, or scrolling to sections 6 * Responds to route changes by expanding, collapsing, or scrolling to sections
7 * on the page. Expanded sections take up the full height of the container. At 7 * on the page. Expanded sections take up the full height of the container. At
8 * most one section should be expanded at any given time. 8 * most one section should be expanded at any given time.
9 * @polymerBehavior MainPageBehavior 9 * @polymerBehavior MainPageBehavior
10 */ 10 */
(...skipping 18 matching lines...) Expand all
29 type: Boolean, 29 type: Boolean,
30 value: false, 30 value: false,
31 observer: 'inSearchModeChanged_', 31 observer: 'inSearchModeChanged_',
32 }, 32 },
33 }, 33 },
34 34
35 /** @type {?HTMLElement} The scrolling container. */ 35 /** @type {?HTMLElement} The scrolling container. */
36 scroller: null, 36 scroller: null,
37 37
38 listeners: { 38 listeners: {
39 'neon-animation-finish': 'onNeonAnimationFinish_' 39 'neon-animation-finish': 'onNeonAnimationFinish_',
40 'subpage-expand': 'onSubpageExpand_',
41 },
42
43 onSubpageExpand_: function() {
44 debugger;
45 if (this.oldDuration_) {
46 settings.animation.Timing.DURATION = this.oldDuration_;
47 document.body.querySelector('settings-ui::shadow #container').style.visibi lity = 'visible';
48 this.oldDuration_ = undefined;
49 }
40 }, 50 },
41 51
42 /** @override */ 52 /** @override */
43 attached: function() { 53 attached: function() {
44 this.scroller = this.domHost ? this.domHost.parentNode : document.body; 54 this.scroller = this.domHost ? this.domHost.parentNode : document.body;
45 }, 55 },
46 56
47 /** 57 /**
48 * Remove the is-animating attribute once the animation is complete. 58 * Remove the is-animating attribute once the animation is complete.
49 * This may catch animations finishing more often than needed, which is not 59 * This may catch animations finishing more often than needed, which is not
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 97
88 // TODO(dschuyler): This doesn't set the flag in the case of going to or 98 // TODO(dschuyler): This doesn't set the flag in the case of going to or
89 // from the main page. It seems sensible to set the flag in those cases, 99 // from the main page. It seems sensible to set the flag in those cases,
90 // unfortunately bug 708465 happens. Figure out why that is and then set 100 // unfortunately bug 708465 happens. Figure out why that is and then set
91 // this flag more broadly. 101 // this flag more broadly.
92 if (oldRoute && oldRoute.isSubpage() && newRoute.isSubpage()) 102 if (oldRoute && oldRoute.isSubpage() && newRoute.isSubpage())
93 this.isSubpageAnimating = true; 103 this.isSubpageAnimating = true;
94 104
95 // For previously uncreated pages (including on first load), allow the page 105 // For previously uncreated pages (including on first load), allow the page
96 // to render before scrolling to or expanding the section. 106 // to render before scrolling to or expanding the section.
97 if (!oldRoute || this.scrollHeight == 0) 107 if (!oldRoute) {
108 if (newRoute.isSubpage()) {
109 this.oldDuration_ = settings.animation.Timing.DURATION;
110 settings.animation.Timing.DURATION = 0;
111 document.body.querySelector('settings-ui::shadow #container').style.visi bility = 'hidden';
michaelpg 2017/05/05 20:42:44 using visibility: hidden instead of display: none
michaelpg 2017/05/22 22:10:51 (Copying scottchen's response to this thread:)
112 }
98 setTimeout(this.tryTransitionToSection_.bind(this, scrollToSection)); 113 setTimeout(this.tryTransitionToSection_.bind(this, scrollToSection));
114 }
99 else 115 else
100 this.tryTransitionToSection_(scrollToSection); 116 this.tryTransitionToSection_(scrollToSection);
101 }, 117 },
102 118
103 /** 119 /**
104 * When exiting search mode, we need to make another attempt to scroll to 120 * When exiting search mode, we need to make another attempt to scroll to
105 * the correct section, since it has just been re-rendered. 121 * the correct section, since it has just been re-rendered.
106 * @private 122 * @private
107 */ 123 */
108 inSearchModeChanged_: function(inSearchMode) { 124 inSearchModeChanged_: function(inSearchMode) {
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 return /** @type {?SettingsSectionElement} */( 365 return /** @type {?SettingsSectionElement} */(
350 this.$$('settings-section[section="' + section + '"]')); 366 this.$$('settings-section[section="' + section + '"]'));
351 }, 367 },
352 }; 368 };
353 369
354 /** @polymerBehavior */ 370 /** @polymerBehavior */
355 var MainPageBehavior = [ 371 var MainPageBehavior = [
356 settings.RouteObserverBehavior, 372 settings.RouteObserverBehavior,
357 MainPageBehaviorImpl, 373 MainPageBehaviorImpl,
358 ]; 374 ];
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698