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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 * chrome.resourcesPrivate. | 562 * chrome.resourcesPrivate. |
563 * @param {Object} strings Dictionary of translated strings | 563 * @param {Object} strings Dictionary of translated strings |
564 */ | 564 */ |
565 handleStrings_: function(strings) { | 565 handleStrings_: function(strings) { |
566 if (this.isMaterial_) { | 566 if (this.isMaterial_) { |
567 this.errorScreen_.strings = strings; | 567 this.errorScreen_.strings = strings; |
568 this.passwordScreen_.strings = strings; | 568 this.passwordScreen_.strings = strings; |
569 if (this.materialToolbar_) | 569 if (this.materialToolbar_) |
570 this.materialToolbar_.strings = strings; | 570 this.materialToolbar_.strings = strings; |
571 this.zoomToolbar_.strings = strings; | 571 this.zoomToolbar_.strings = strings; |
| 572 document.dir = strings['textdirection']; |
| 573 document.lang = strings['language']; |
572 } else { | 574 } else { |
573 this.passwordScreen_.text = strings.passwordPrompt; | 575 this.passwordScreen_.text = strings.passwordPrompt; |
574 this.progressBar_.text = strings.pageLoading; | 576 this.progressBar_.text = strings.pageLoading; |
575 if (!this.isPrintPreview_) | 577 if (!this.isPrintPreview_) |
576 this.progressBar_.style.visibility = 'visible'; | 578 this.progressBar_.style.visibility = 'visible'; |
577 this.errorScreen_.text = strings.pageLoadFailed; | 579 this.errorScreen_.text = strings.pageLoadFailed; |
578 } | 580 } |
579 }, | 581 }, |
580 | 582 |
581 /** | 583 /** |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 var hasScrollbars = this.viewport_.documentHasScrollbars(); | 742 var hasScrollbars = this.viewport_.documentHasScrollbars(); |
741 var scrollbarWidth = this.viewport_.scrollbarWidth; | 743 var scrollbarWidth = this.viewport_.scrollbarWidth; |
742 var verticalScrollbarWidth = hasScrollbars.vertical ? scrollbarWidth : 0; | 744 var verticalScrollbarWidth = hasScrollbars.vertical ? scrollbarWidth : 0; |
743 var horizontalScrollbarWidth = | 745 var horizontalScrollbarWidth = |
744 hasScrollbars.horizontal ? scrollbarWidth : 0; | 746 hasScrollbars.horizontal ? scrollbarWidth : 0; |
745 if (this.isMaterial_) { | 747 if (this.isMaterial_) { |
746 // Shift the zoom toolbar to the left by half a scrollbar width. This | 748 // Shift the zoom toolbar to the left by half a scrollbar width. This |
747 // gives a compromise: if there is no scrollbar visible then the toolbar | 749 // gives a compromise: if there is no scrollbar visible then the toolbar |
748 // will be half a scrollbar width further left than the spec but if there | 750 // will be half a scrollbar width further left than the spec but if there |
749 // is a scrollbar visible it will be half a scrollbar width further right | 751 // is a scrollbar visible it will be half a scrollbar width further right |
750 // than the spec. | 752 // than the spec. In RTL layout, the zoom toolbar is on the left side, but |
751 this.zoomToolbar_.style.right = -verticalScrollbarWidth + | 753 // the scrollbar is still on the left, so this is not necessary. |
752 (scrollbarWidth / 2) + 'px'; | 754 if (document.dir == 'ltr') { |
| 755 this.zoomToolbar_.style.right = -verticalScrollbarWidth + |
| 756 (scrollbarWidth / 2) + 'px'; |
| 757 } |
753 // Having a horizontal scrollbar is much rarer so we don't offset the | 758 // Having a horizontal scrollbar is much rarer so we don't offset the |
754 // toolbar from the bottom any more than what the spec says. This means | 759 // toolbar from the bottom any more than what the spec says. This means |
755 // that when there is a scrollbar visible, it will be a full scrollbar | 760 // that when there is a scrollbar visible, it will be a full scrollbar |
756 // width closer to the bottom of the screen than usual, but this is ok. | 761 // width closer to the bottom of the screen than usual, but this is ok. |
757 this.zoomToolbar_.style.bottom = -horizontalScrollbarWidth + 'px'; | 762 this.zoomToolbar_.style.bottom = -horizontalScrollbarWidth + 'px'; |
758 } else { | 763 } else { |
759 var toolbarRight = Math.max(PDFViewer.MIN_TOOLBAR_OFFSET, scrollbarWidth); | 764 var toolbarRight = Math.max(PDFViewer.MIN_TOOLBAR_OFFSET, scrollbarWidth); |
760 var toolbarBottom = | 765 var toolbarBottom = |
761 Math.max(PDFViewer.MIN_TOOLBAR_OFFSET, scrollbarWidth); | 766 Math.max(PDFViewer.MIN_TOOLBAR_OFFSET, scrollbarWidth); |
762 toolbarRight -= verticalScrollbarWidth; | 767 toolbarRight -= verticalScrollbarWidth; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 * Each bookmark is an Object containing a: | 926 * Each bookmark is an Object containing a: |
922 * - title | 927 * - title |
923 * - page (optional) | 928 * - page (optional) |
924 * - array of children (themselves bookmarks) | 929 * - array of children (themselves bookmarks) |
925 * @type {Array} the top-level bookmarks of the PDF. | 930 * @type {Array} the top-level bookmarks of the PDF. |
926 */ | 931 */ |
927 get bookmarks() { | 932 get bookmarks() { |
928 return this.bookmarks_; | 933 return this.bookmarks_; |
929 } | 934 } |
930 }; | 935 }; |
OLD | NEW |