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

Unified Diff: chrome/browser/resources/options/browser_options.js

Issue 102673002: Fix scroll to section in the settings page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/browser_options.js
diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js
index 0035745e533cf38ae68ec192ce807e7761b68a1d..421074cfdd625f25f8e02edda36e4c427c3c9c51 100644
--- a/chrome/browser/resources/options/browser_options.js
+++ b/chrome/browser/resources/options/browser_options.js
@@ -639,13 +639,13 @@ cr.define('options', function() {
var sectionTop = section.offsetTop;
if (pageTop + sectionBottom > document.body.scrollHeight ||
pageTop + sectionTop < 0) {
- pageContainer.oldScrollTop = -pageTop;
// Currently not all layout updates are guaranteed to precede the
// initializationComplete event (for example 'set-as-default-browser'
// button) leaving some uncertainty in the optimal scroll position.
// The section is placed approximately in the middle of the screen.
- pageContainer.style.top = document.body.scrollHeight / 2 -
- sectionBottom + 'px';
+ var top = Math.min(0, document.body.scrollHeight / 2 - sectionBottom);
+ pageContainer.style.top = top + 'px';
+ pageContainer.oldScrollTop = -top;
}
},
« 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