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

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

Issue 2312423003: MD Settings: Set overscroll before attempting to scroll to section (Closed)
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/settings/settings_main/settings_main.js ('k') | no next file » | 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 32087242d024aab72b1cb216e04aac380d3a78dc..14110a63b5dc8776bf6ab463519a46489b00d24c 100644
--- a/chrome/browser/resources/settings/settings_page/main_page_behavior.js
+++ b/chrome/browser/resources/settings/settings_page/main_page_behavior.js
@@ -170,7 +170,7 @@ var MainPageBehaviorImpl = {
// Save the scroller position before freezing it.
this.origScrollTop_ = this.scroller.scrollTop;
- this.toggleScrolling_(false);
+ this.fire('freeze-scroll', true);
// Freeze the section's height so its card can be removed from the flow.
section.setFrozen(true);
@@ -196,7 +196,7 @@ var MainPageBehaviorImpl = {
finished = false;
}.bind(this)).then(function() {
- this.toggleScrolling_(true);
+ this.fire('freeze-scroll', false);
this.currentAnimation_ = null;
}.bind(this));
},
@@ -220,7 +220,7 @@ var MainPageBehaviorImpl = {
// when switching between Basic/Advanced and About.
var shouldAnimateCollapse = needAnimate && section.canAnimateCollapse();
if (shouldAnimateCollapse) {
- this.toggleScrolling_(false);
+ this.fire('freeze-scroll', true);
// Do the initial collapse setup, which takes the section out of the flow,
// before showing everything.
section.setUpAnimateCollapse(this.scroller);
@@ -257,7 +257,7 @@ var MainPageBehaviorImpl = {
// Clean up after the animation succeeds or cancels.
section.setFrozen(false);
section.classList.remove('collapsing');
- this.toggleScrolling_(true);
+ this.fire('freeze-scroll', false);
this.currentAnimation_ = null;
resolve();
}.bind(this));
@@ -290,25 +290,6 @@ var MainPageBehaviorImpl = {
return /** @type {?SettingsSectionElement} */(
this.$$('settings-section[section="' + section + '"]'));
},
-
- /**
- * Enables or disables user scrolling, via overscroll: hidden. Room for the
- * hidden scrollbar is added to prevent the page width from changing back and
- * forth.
- * @param {boolean} enabled
- * @private
- */
- toggleScrolling_: function(enabled) {
- if (enabled) {
- this.scroller.style.overflow = '';
- this.scroller.style.width = '';
- } else {
- var scrollerWidth = this.scroller.clientWidth;
- this.scroller.style.overflow = 'hidden';
- var scrollbarWidth = this.scroller.clientWidth - scrollerWidth;
- this.scroller.style.width = 'calc(100% - ' + scrollbarWidth + 'px)';
- }
- }
};
/** @polymerBehavior */
« no previous file with comments | « chrome/browser/resources/settings/settings_main/settings_main.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698