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

Unified Diff: chrome/browser/resources/pdf/pdf.js

Issue 1366053004: Material PDF: Improve layout of PDF viewer in very small windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak behaviour Created 5 years, 3 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 | « chrome/browser/resources/pdf/index-material.css ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/pdf/pdf.js
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js
index e3cd1f346c96643af0e7550fb2da638d896e0f41..2d244062de7a3f8b4dc451f742772ce166f36853 100644
--- a/chrome/browser/resources/pdf/pdf.js
+++ b/chrome/browser/resources/pdf/pdf.js
@@ -95,6 +95,13 @@ PDFViewer.MIN_TOOLBAR_OFFSET = 15;
PDFViewer.MATERIAL_TOOLBAR_HEIGHT = 56;
/**
+ * Minimum height for the material toolbar to show (px). Should match the media
+ * query in index-material.css. If the window is smaller than this at load,
+ * leave no space for the toolbar.
+ */
+PDFViewer.TOOLBAR_WINDOW_MIN_HEIGHT = 250;
+
+/**
* The light-gray background color used for print preview.
*/
PDFViewer.LIGHT_BACKGROUND_COLOR = '0xFFCCCCCC';
@@ -143,8 +150,9 @@ function PDFViewer(browserApi) {
}
// Create the viewport.
+ var shortWindow = window.innerHeight < PDFViewer.TOOLBAR_WINDOW_MIN_HEIGHT;
raymes 2015/09/28 07:42:45 Perhaps we should set the toolbar to display none
tsergeant 2015/09/30 01:26:48 The media query is nice because it automatically u
var topToolbarHeight =
- (this.isMaterial_ && !this.isPrintPreview_) ?
+ (this.isMaterial_ && !this.isPrintPreview_ && !shortWindow) ?
PDFViewer.MATERIAL_TOOLBAR_HEIGHT : 0;
this.viewport_ = new Viewport(window,
this.sizer_,
« no previous file with comments | « chrome/browser/resources/pdf/index-material.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698