Chromium Code Reviews| Index: chrome/browser/resources/options/cookies_view.js |
| =================================================================== |
| --- chrome/browser/resources/options/cookies_view.js (revision 86234) |
| +++ chrome/browser/resources/options/cookies_view.js (working copy) |
| @@ -50,6 +50,7 @@ |
| var cookiesList = $('cookies-list'); |
| options.CookiesList.decorate(cookiesList); |
| + window.addEventListener('resize', this.handleResize_.bind(this)); |
| this.addEventListener('visibleChange', this.handleVisibleChange_); |
| }, |
| @@ -83,12 +84,14 @@ |
| /** |
| * Handler for OptionsPage's visible property change event. |
| + * @param {Event} e Property change event. |
| * @private |
| - * @param {Event} e Property change event. |
| */ |
| handleVisibleChange_: function(e) { |
| if (!this.visible) |
| return; |
| + // Resize the cookies list whenever the options page becomes visible. |
| + this.handleResize_(null); |
| if (!this.initialized_) { |
| this.initialized_ = true; |
| this.searchCookie(); |
| @@ -96,6 +99,21 @@ |
| $('cookies-list').redraw(); |
| } |
| }, |
| + |
| + /** |
| + * Handler for when the window changes size. We want to resize the cookies |
|
James Hawkins
2011/05/23 02:07:20
nit: s/We want to resize/Resize/
Mike Mammarella
2011/05/23 02:16:00
Done.
|
| + * list to match the window height. |
| + * @param {?Event} e Window resize event, or null if called directly. |
| + * @private |
| + */ |
| + handleResize_: function(e) { |
| + if (!this.visible) |
| + return; |
| + var cookiesList = $('cookies-list'); |
| + // 25 pixels from the window bottom seems like a visually pleasing amount. |
| + var height = window.innerHeight - cookiesList.offsetTop - 25; |
| + cookiesList.style.height = height + 'px'; |
| + }, |
| }; |
| // CookiesViewHandler callbacks. |