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

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

Issue 2041083002: MD Settings: Workaround for section expand/collapse animation jank. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? Created 4 years, 6 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 | chrome/browser/resources/settings/settings_page_css.html » ('j') | 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 // Fast out, slow in. 5 // Fast out, slow in.
6 var EASING_FUNCTION = 'cubic-bezier(0.4, 0, 0.2, 1)'; 6 var EASING_FUNCTION = 'cubic-bezier(0.4, 0, 0.2, 1)';
7 var EXPAND_DURATION = 350; 7 var EXPAND_DURATION = 350;
8 8
9 /** 9 /**
10 * Provides animations to expand and collapse individual sections in a page. 10 * Provides animations to expand and collapse individual sections in a page.
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 var element = this.getSection_(this.currentRoute.section); 353 var element = this.getSection_(this.currentRoute.section);
354 if (!element) 354 if (!element)
355 return; 355 return;
356 356
357 var host = findAncestor(element, function(n) { return n.host; }).host; 357 var host = findAncestor(element, function(n) { return n.host; }).host;
358 if (host.scrollHeight == 0) { 358 if (host.scrollHeight == 0) {
359 setTimeout(pollForScrollHeight.bind(this), 100); 359 setTimeout(pollForScrollHeight.bind(this), 100);
360 return; 360 return;
361 } 361 }
362 362
363 element.scrollIntoView(); 363 // TODO(michaelpg): due to the workaround for crbug.com/617827 in
364 // settings_page_css.html, we have to use element.offsetTop instead of
365 // relying on element.scrollIntoView() so the margin is included.
366 host.scroller.scrollTop = element.offsetTop;
364 }.bind(this)); 367 }.bind(this));
365 }, 368 },
366 369
367 /** @private */ 370 /** @private */
368 currentRouteChanged_: function(newRoute, oldRoute) { 371 currentRouteChanged_: function(newRoute, oldRoute) {
369 var newRouteIsSubpage = newRoute && newRoute.subpage.length; 372 var newRouteIsSubpage = newRoute && newRoute.subpage.length;
370 var oldRouteIsSubpage = oldRoute && oldRoute.subpage.length; 373 var oldRouteIsSubpage = oldRoute && oldRoute.subpage.length;
371 374
372 if (!oldRoute && newRouteIsSubpage) { 375 if (!oldRoute && newRouteIsSubpage) {
373 // Allow the page to load before expanding the section. TODO(michaelpg): 376 // Allow the page to load before expanding the section. TODO(michaelpg):
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 this.$$('[section=' + section + ']')); 408 this.$$('[section=' + section + ']'));
406 }, 409 },
407 }; 410 };
408 411
409 412
410 /** @polymerBehavior */ 413 /** @polymerBehavior */
411 var RoutableBehavior = [ 414 var RoutableBehavior = [
412 MainPageBehavior, 415 MainPageBehavior,
413 RoutableBehaviorImpl 416 RoutableBehaviorImpl
414 ]; 417 ];
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/settings/settings_page_css.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698