Index: chrome/browser/resources/shared/js/cr/ui/overlay.js |
diff --git a/chrome/browser/resources/shared/js/cr/ui/overlay.js b/chrome/browser/resources/shared/js/cr/ui/overlay.js |
index 0a4e04dbf6da0f00b5b1daf058e6d3643e9320c7..e43f7b98ef65a332ffc9e207609cdaff43687a87 100644 |
--- a/chrome/browser/resources/shared/js/cr/ui/overlay.js |
+++ b/chrome/browser/resources/shared/js/cr/ui/overlay.js |
@@ -45,14 +45,21 @@ cr.define('cr.ui.overlay', function() { |
} |
}); |
- window.addEventListener('resize', function() { |
- var overlay = getTopOverlay(); |
- var page = overlay ? overlay.querySelector('.page:not([hidden])') : null; |
- if (!page) |
- return; |
+ window.addEventListener('resize', setMaxHeightAllPages); |
- page.style.maxHeight = Math.min(0.9 * window.innerHeight, 640) + 'px'; |
- }); |
+ setMaxHeightAllPages(); |
+ } |
+ |
+ /** |
+ * Sets the max-height of all pages in all overlays, based on the window |
+ * height. |
+ */ |
+ function setMaxHeightAllPages() { |
+ var pages = document.querySelectorAll('.overlay .page'); |
+ |
+ var maxHeight = Math.min(0.9 * window.innerHeight, 640) + 'px'; |
+ for (var i = 0; i < pages.length; i++) |
+ pages[i].style.maxHeight = maxHeight; |
} |
/** |