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..3fb61482a5e994149ec83f6ad9d9a90705b18a9a 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 |
@@ -104,13 +110,16 @@ function PDFViewer(browserApi) { |
this.errorScreen_ = $('error-screen'); |
// Create the viewport. |
+ var topToolbarHeight = |
+ this.isMaterial_ ? PDFViewer.MATERIAL_TOOLBAR_HEIGHT : 0; |
this.viewport_ = new Viewport(window, |
this.sizer_, |
this.viewportChanged_.bind(this), |
this.beforeZoom_.bind(this), |
this.afterZoom_.bind(this), |
getScrollbarWidth(), |
- this.browserApi_.getDefaultZoom()); |
+ this.browserApi_.getDefaultZoom(), |
+ topToolbarHeight); |
// Create the plugin object dynamically so we can set its src. The plugin |
// element is sized to fill the entire window and is set to be fixed |
@@ -143,8 +152,11 @@ 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); |
+ } |
if (!this.browserApi_.getStreamInfo().embedded) |
this.plugin_.setAttribute('full-frame', ''); |