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

Side by Side Diff: chrome/browser/resources/pdf/pdf.js

Issue 885733003: Remove toolbar offset in Material Design PDF Viewer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * @return {number} Width of a scrollbar in pixels 8 * @return {number} Width of a scrollbar in pixels
9 */ 9 */
10 function getScrollbarWidth() { 10 function getScrollbarWidth() {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // to be displayed in the window. It is sized according to the document size 79 // to be displayed in the window. It is sized according to the document size
80 // of the pdf and zoom level. 80 // of the pdf and zoom level.
81 this.sizer_ = $('sizer'); 81 this.sizer_ = $('sizer');
82 this.toolbar_ = $('toolbar'); 82 this.toolbar_ = $('toolbar');
83 this.pageIndicator_ = $('page-indicator'); 83 this.pageIndicator_ = $('page-indicator');
84 this.progressBar_ = $('progress-bar'); 84 this.progressBar_ = $('progress-bar');
85 this.passwordScreen_ = $('password-screen'); 85 this.passwordScreen_ = $('password-screen');
86 this.passwordScreen_.addEventListener('password-submitted', 86 this.passwordScreen_.addEventListener('password-submitted',
87 this.onPasswordSubmitted_.bind(this)); 87 this.onPasswordSubmitted_.bind(this));
88 this.errorScreen_ = $('error-screen'); 88 this.errorScreen_ = $('error-screen');
89 this.toolbarHeight_ = this.isMaterial_ ? $('pdf-toolbar').clientHeight : 0;
90 this.bookmarksPane = $('bookmarks-pane'); 89 this.bookmarksPane = $('bookmarks-pane');
91 90
92 // Create the viewport. 91 // Create the viewport.
93 this.viewport_ = new Viewport(window, 92 this.viewport_ = new Viewport(window,
94 this.sizer_, 93 this.sizer_,
95 this.viewportChanged_.bind(this), 94 this.viewportChanged_.bind(this),
96 this.beforeZoom_.bind(this), 95 this.beforeZoom_.bind(this),
97 this.afterZoom_.bind(this), 96 this.afterZoom_.bind(this),
98 getScrollbarWidth(), 97 getScrollbarWidth());
99 this.toolbarHeight_);
100 // Create the plugin object dynamically so we can set its src. The plugin 98 // Create the plugin object dynamically so we can set its src. The plugin
101 // element is sized to fill the entire window and is set to be fixed 99 // element is sized to fill the entire window and is set to be fixed
102 // positioning, acting as a viewport. The plugin renders into this viewport 100 // positioning, acting as a viewport. The plugin renders into this viewport
103 // according to the scroll position of the window. 101 // according to the scroll position of the window.
104 this.plugin_ = document.createElement('embed'); 102 this.plugin_ = document.createElement('embed');
105 // NOTE: The plugin's 'id' field must be set to 'plugin' since 103 // NOTE: The plugin's 'id' field must be set to 'plugin' since
106 // chrome/renderer/printing/print_web_view_helper.cc actually references it. 104 // chrome/renderer/printing/print_web_view_helper.cc actually references it.
107 this.plugin_.id = 'plugin'; 105 this.plugin_.id = 'plugin';
108 this.plugin_.type = 'application/x-google-chrome-pdf'; 106 this.plugin_.type = 'application/x-google-chrome-pdf';
109 this.plugin_.addEventListener('message', this.handlePluginMessage_.bind(this), 107 this.plugin_.addEventListener('message', this.handlePluginMessage_.bind(this),
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 * Each bookmark is an Object containing a: 753 * Each bookmark is an Object containing a:
756 * - title 754 * - title
757 * - page (optional) 755 * - page (optional)
758 * - array of children (themselves bookmarks) 756 * - array of children (themselves bookmarks)
759 * @type {Array} the top-level bookmarks of the PDF. 757 * @type {Array} the top-level bookmarks of the PDF.
760 */ 758 */
761 get bookmarks() { 759 get bookmarks() {
762 return this.bookmarks_; 760 return this.bookmarks_;
763 } 761 }
764 }; 762 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/pdf/index-material.css ('k') | chrome/browser/resources/pdf/viewport.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698