Chromium Code Reviews| Index: chrome/browser/resources/settings/settings_dialog.js |
| diff --git a/chrome/browser/resources/settings/settings_dialog.js b/chrome/browser/resources/settings/settings_dialog.js |
| index 888ae0d4c5cc5df61b9a4919539ac91877657e0f..bf8f55a09e26074338bc68b321dcd3db7e3260cb 100644 |
| --- a/chrome/browser/resources/settings/settings_dialog.js |
| +++ b/chrome/browser/resources/settings/settings_dialog.js |
| @@ -30,6 +30,34 @@ Polymer({ |
| behaviors: [Polymer.PaperDialogBehavior], |
| + /** @override */ |
| + center: function() { |
|
valdrin
2016/05/18 18:43:37
This should not be needed, as iron-fit-behavior is
valdrin
2016/05/18 18:47:18
Sorry, i meant max-width, max-height. If you set t
Dan Beam
2016/05/24 02:22:11
valdrin: every <settings-dialog> has a different h
|
| + Polymer.IronFitBehavior.center.call(this); |
| + |
| + // Height of stuff that should never scroll (i.e. title, buttons). |
| + var staticHeight = this.$$('.title-container').offsetHeight + |
| + this.$$('.button-container').offsetHeight + |
| + this.$$('.footer-container').offsetHeight; |
| + |
| + // The amount of space we've got to work with based on window size. |
| + var availableHeight = parseInt(this.style.maxHeight, 10); |
|
dpapad
2016/05/18 17:50:10
The code seems to assume that avaailableHeight is
|
| + |
| + var MIN_BODY_HEIGHT = 120; |
| + |
| + // Constrain body height to the remaining space; might add middle scrollbar. |
| + var bodyHeight = Math.max(availableHeight - staticHeight, MIN_BODY_HEIGHT); |
| + this.$$('.body-container').style.maxHeight = bodyHeight + 'px'; |
| + |
| + var requiredHeight = staticHeight + MIN_BODY_HEIGHT; |
| + var needsMinHeight = availableHeight < requiredHeight; |
| + this.style.minHeight = needsMinHeight ? requiredHeight + 'px' : ''; |
| + |
| + // TODO(dbeam): give a min-height to something like <body> so if the window |
| + // get smaller than this dialog, buttons can still be scrolled to. Adding a |
|
dpapad
2016/05/18 17:50:11
s/get/gets
|
| + // min-height to either this dialog or the backdropElement doesn't help as |
| + // they're position: fixed; and not in the flow of the page. |
| + }, |
| + |
| /** @return {!PaperIconButtonElement} */ |
| getCloseButton: function() { |
| return this.$.close; |