OLD | NEW |
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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 this.sizer_.style.display = 'none'; | 401 this.sizer_.style.display = 'none'; |
402 this.toolbar_.style.visibility = 'hidden'; | 402 this.toolbar_.style.visibility = 'hidden'; |
403 if (this.passwordScreen_.active) { | 403 if (this.passwordScreen_.active) { |
404 this.passwordScreen_.deny(); | 404 this.passwordScreen_.deny(); |
405 this.passwordScreen_.active = false; | 405 this.passwordScreen_.active = false; |
406 } | 406 } |
407 } else if (progress == 100) { | 407 } else if (progress == 100) { |
408 // Document load complete. | 408 // Document load complete. |
409 if (this.lastViewportPosition_) | 409 if (this.lastViewportPosition_) |
410 this.viewport_.position = this.lastViewportPosition_; | 410 this.viewport_.position = this.lastViewportPosition_; |
411 if (!this.isMaterial_) | |
412 this.pageIndicator_.style.visibility = 'visible'; | |
413 this.handleURLParams_(); | 411 this.handleURLParams_(); |
414 this.loaded_ = true; | 412 this.loaded_ = true; |
415 this.sendScriptingMessage_({ | 413 this.sendScriptingMessage_({ |
416 type: 'documentLoaded' | 414 type: 'documentLoaded' |
417 }); | 415 }); |
418 while (this.delayedScriptingMessages_.length > 0) | 416 while (this.delayedScriptingMessages_.length > 0) |
419 this.handleScriptingMessage(this.delayedScriptingMessages_.shift()); | 417 this.handleScriptingMessage(this.delayedScriptingMessages_.shift()); |
420 } | 418 } |
421 }, | 419 }, |
422 | 420 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 this.toolbar_.style.right = toolbarRight + 'px'; | 600 this.toolbar_.style.right = toolbarRight + 'px'; |
603 this.toolbar_.style.bottom = toolbarBottom + 'px'; | 601 this.toolbar_.style.bottom = toolbarBottom + 'px'; |
604 // Hide the toolbar if it doesn't fit in the viewport. | 602 // Hide the toolbar if it doesn't fit in the viewport. |
605 if (this.toolbar_.offsetLeft < 0 || this.toolbar_.offsetTop < 0) | 603 if (this.toolbar_.offsetLeft < 0 || this.toolbar_.offsetTop < 0) |
606 this.toolbar_.style.visibility = 'hidden'; | 604 this.toolbar_.style.visibility = 'hidden'; |
607 else | 605 else |
608 this.toolbar_.style.visibility = 'visible'; | 606 this.toolbar_.style.visibility = 'visible'; |
609 | 607 |
610 // Update the page indicator. | 608 // Update the page indicator. |
611 var visiblePage = this.viewport_.getMostVisiblePage(); | 609 var visiblePage = this.viewport_.getMostVisiblePage(); |
612 if (this.isMaterial_) | 610 if (this.isMaterial_) { |
613 this.materialToolbar_.pageIndex = visiblePage; | 611 this.materialToolbar_.pageIndex = visiblePage; |
614 else | 612 } else { |
615 this.pageIndicator_.index = visiblePage; | 613 this.pageIndicator_.index = visiblePage; |
616 | |
617 if (!this.isMaterial_) { | |
618 if (this.documentDimensions_.pageDimensions.length > 1 && | 614 if (this.documentDimensions_.pageDimensions.length > 1 && |
619 hasScrollbars.vertical) { | 615 hasScrollbars.vertical) { |
620 this.pageIndicator_.style.visibility = 'visible'; | 616 this.pageIndicator_.style.visibility = 'visible'; |
621 } else { | 617 } else { |
622 this.pageIndicator_.style.visibility = 'hidden'; | 618 this.pageIndicator_.style.visibility = 'hidden'; |
623 } | 619 } |
624 } | 620 } |
625 | 621 |
626 var visiblePageDimensions = this.viewport_.getPageScreenRect(visiblePage); | 622 var visiblePageDimensions = this.viewport_.getPageScreenRect(visiblePage); |
627 var size = this.viewport_.size; | 623 var size = this.viewport_.size; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 * Each bookmark is an Object containing a: | 755 * Each bookmark is an Object containing a: |
760 * - title | 756 * - title |
761 * - page (optional) | 757 * - page (optional) |
762 * - array of children (themselves bookmarks) | 758 * - array of children (themselves bookmarks) |
763 * @type {Array} the top-level bookmarks of the PDF. | 759 * @type {Array} the top-level bookmarks of the PDF. |
764 */ | 760 */ |
765 get bookmarks() { | 761 get bookmarks() { |
766 return this.bookmarks_; | 762 return this.bookmarks_; |
767 } | 763 } |
768 }; | 764 }; |
OLD | NEW |