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

Side by Side Diff: chrome/browser/resources/help/help_base_page.js

Issue 68723003: Make chrome/ be documentElement/body agnostic with regards to scrollTop/Left (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_305800
Patch Set: Created 7 years, 1 month 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // Helper base class for all help pages and overlays, which controls 5 // Helper base class for all help pages and overlays, which controls
6 // overlays, focus and scroll. This class is partially based on 6 // overlays, focus and scroll. This class is partially based on
7 // OptionsPage, but simpler and contains only overlay- and focus- 7 // OptionsPage, but simpler and contains only overlay- and focus-
8 // handling logic. As in OptionsPage each page can be an overlay itself, 8 // handling logic. As in OptionsPage each page can be an overlay itself,
9 // but each page contains its own list of registered overlays which can be 9 // but each page contains its own list of registered overlays which can be
10 // displayed over it. 10 // displayed over it.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 return null; 109 return null;
110 }, 110 },
111 111
112 /** 112 /**
113 * Freezes current page, makes it impossible to scroll it. 113 * Freezes current page, makes it impossible to scroll it.
114 * @param {boolean} freeze True if the page should be frozen. 114 * @param {boolean} freeze True if the page should be frozen.
115 * @private 115 * @private
116 */ 116 */
117 freeze_: function(freeze) { 117 freeze_: function(freeze) {
118 var scrollTop = scrollTopForDocument(document);
119 var scrollLeft = scrollLeftForDocument(document);
120
118 if (freeze) { 121 if (freeze) {
119 this.lastScrollTop = document.documentElement.scrollTop; 122 this.lastScrollTop = scrollTop;
Dan Beam 2013/11/13 23:31:07 nit: replace `var scrollTop = ...;` with: this.
120 document.body.style.overflow = 'hidden'; 123 document.body.style.overflow = 'hidden';
121 window.scroll(document.documentElement.scrollLeft, 0); 124 window.scroll(scrollLeft, 0);
122 } else { 125 } else {
123 document.body.style.overflow = 'auto'; 126 document.body.style.overflow = 'auto';
124 window.scroll(document.documentElement.scrollLeft, this.lastScrollTop); 127 window.scroll(scrollLeft, this.lastScrollTop);
125 } 128 }
126 }, 129 },
127 130
128 /** 131 /**
129 * Initializes current page. 132 * Initializes current page.
130 * @param {string} name Name of the current page. 133 * @param {string} name Name of the current page.
131 */ 134 */
132 initialize: function(name) { 135 initialize: function(name) {
133 this.name = name; 136 this.name = name;
134 this.pageDiv = $(name); 137 this.pageDiv = $(name);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 return; 239 return;
237 } 240 }
238 }, 241 },
239 }; 242 };
240 243
241 // Export 244 // Export
242 return { 245 return {
243 HelpBasePage: HelpBasePage 246 HelpBasePage: HelpBasePage
244 }; 247 };
245 }); 248 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698