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

Unified Diff: chrome/browser/resources/settings/settings_page/main_page_behavior.js

Issue 1962943002: MD Settings: Fix minor vertical jumps in animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@AnimationFixes
Patch Set: dpapad Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/settings/settings_page/settings_subpage.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/settings/settings_page/main_page_behavior.js
diff --git a/chrome/browser/resources/settings/settings_page/main_page_behavior.js b/chrome/browser/resources/settings/settings_page/main_page_behavior.js
index 1f8b2a87a9b6fd50fed541bd6d92b97cd4968f56..130a2881cdca9fca8e0c2f5934194daa3c515c59 100644
--- a/chrome/browser/resources/settings/settings_page/main_page_behavior.js
+++ b/chrome/browser/resources/settings/settings_page/main_page_behavior.js
@@ -264,7 +264,6 @@ var MainPageBehaviorImpl = {
*/
playCollapseSection_: function(section) {
var card = section.$.card;
- var cardStyle = getComputedStyle(card);
this.style.margin = '';
section.$.header.hidden = false;
@@ -293,6 +292,12 @@ var MainPageBehaviorImpl = {
// but account for scroll.
var targetTop = card.getBoundingClientRect().top - this.scroller.scrollTop;
+ // Account for the section header.
+ var headerStyle = getComputedStyle(section.$.header);
+ targetTop += section.$.header.offsetHeight +
+ parseInt(headerStyle.marginBottom, 10) +
+ parseInt(headerStyle.marginTop, 10);
+
var keyframes = [{
top: startingTop + 'px',
minHeight: cardHeightStart + 'px',
@@ -304,8 +309,7 @@ var MainPageBehaviorImpl = {
var options = /** @type {!KeyframeEffectOptions} */({
duration: EXPAND_DURATION
});
- var promise = this.animateElement('section', card, keyframes, options);
- return promise;
+ return this.animateElement('section', card, keyframes, options);
},
};
« no previous file with comments | « no previous file | chrome/browser/resources/settings/settings_page/settings_subpage.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698