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

Unified Diff: chrome/browser/resources/shared/js/cr/ui/overlay.js

Issue 9844024: Set maxHeight of all overlay pages at startup and on resize (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698