Commit 73e2c8cd authored by mdm@chromium.org's avatar mdm@chromium.org

WebUI: size the cookies list according to the window height.

BUG=75678
Review URL: http://codereview.chromium.org/6990030

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86247 0039d316-1c4b-4281-b951-d872f2087c98
parent 76a74149
...@@ -42,10 +42,6 @@ html[dir=rtl] #remove-all-cookies-search-column { ...@@ -42,10 +42,6 @@ html[dir=rtl] #remove-all-cookies-search-column {
#cookies-list { #cookies-list {
border: 1px solid #D9D9D9; border: 1px solid #D9D9D9;
/* it would be nice if we could make this expand as necessary up to the height
* of the window, but the panel doesn't have a known height and that would
* probably confuse cr.ui.List (which doesn't expect that) anyway */
height: 600px;
margin: 0; margin: 0;
} }
......
...@@ -50,6 +50,7 @@ cr.define('options', function() { ...@@ -50,6 +50,7 @@ cr.define('options', function() {
var cookiesList = $('cookies-list'); var cookiesList = $('cookies-list');
options.CookiesList.decorate(cookiesList); options.CookiesList.decorate(cookiesList);
window.addEventListener('resize', this.handleResize_.bind(this));
this.addEventListener('visibleChange', this.handleVisibleChange_); this.addEventListener('visibleChange', this.handleVisibleChange_);
}, },
...@@ -83,12 +84,14 @@ cr.define('options', function() { ...@@ -83,12 +84,14 @@ cr.define('options', function() {
/** /**
* Handler for OptionsPage's visible property change event. * Handler for OptionsPage's visible property change event.
* @private
* @param {Event} e Property change event. * @param {Event} e Property change event.
* @private
*/ */
handleVisibleChange_: function(e) { handleVisibleChange_: function(e) {
if (!this.visible) if (!this.visible)
return; return;
// Resize the cookies list whenever the options page becomes visible.
this.handleResize_(null);
if (!this.initialized_) { if (!this.initialized_) {
this.initialized_ = true; this.initialized_ = true;
this.searchCookie(); this.searchCookie();
...@@ -96,6 +99,21 @@ cr.define('options', function() { ...@@ -96,6 +99,21 @@ cr.define('options', function() {
$('cookies-list').redraw(); $('cookies-list').redraw();
} }
}, },
/**
* Handler for when the window changes size. Resizes the cookies 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. // CookiesViewHandler callbacks.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment