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

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

Issue 1255403002: Add a scroll offset to PDF documents to account for the top material design toolbar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | chrome/browser/resources/pdf/viewport.js » ('j') | chrome/browser/resources/pdf/viewport.js » ('J')
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 dfa2d31dde07bfb508bd55551cb4e8d61b3acc0e..4b10b534e3fa4201f4a82749bc0db11da5f54375 100644
--- a/chrome/browser/resources/pdf/pdf.js
+++ b/chrome/browser/resources/pdf/pdf.js
@@ -75,6 +75,12 @@ function shouldIgnoreKeyEvents(activeElement) {
PDFViewer.MIN_TOOLBAR_OFFSET = 15;
/**
+ * The height of the toolbar along the top of the page. The document will be
+ * shifted down by this much in the viewport.
+ */
+PDFViewer.MATERIAL_TOOLBAR_HEIGHT = 64;
+
+/**
* Creates a new PDFViewer. There should only be one of these objects per
* document.
* @constructor
@@ -143,8 +149,12 @@ function PDFViewer(browserApi) {
}
this.plugin_.setAttribute('headers', headers);
- if (this.isMaterial_)
+ if (this.isMaterial_) {
this.plugin_.setAttribute('is-material', '');
+ this.plugin_.setAttribute('top-toolbar-height',
+ PDFViewer.MATERIAL_TOOLBAR_HEIGHT);
+ this.viewport_.topToolbarHeight = PDFViewer.MATERIAL_TOOLBAR_HEIGHT;
+ }
if (!this.browserApi_.getStreamInfo().embedded)
this.plugin_.setAttribute('full-frame', '');
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/viewport.js » ('j') | chrome/browser/resources/pdf/viewport.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698