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

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

Issue 1364163002: Material PDF: Support RTL languages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use reflectToAttribute Created 5 years, 2 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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
751 this.zoomToolbar_.style.right = -verticalScrollbarWidth + 753 if (document.dir == 'ltr')
raymes 2015/09/28 03:14:53 nit: add comment about why this is the case add {}
tsergeant 2015/09/28 04:26:33 Done
752 (scrollbarWidth / 2) + 'px'; 754 this.zoomToolbar_.style.right = -verticalScrollbarWidth +
755 (scrollbarWidth / 2) + 'px';
753 // Having a horizontal scrollbar is much rarer so we don't offset the 756 // 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 757 // 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 758 // 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. 759 // width closer to the bottom of the screen than usual, but this is ok.
757 this.zoomToolbar_.style.bottom = -horizontalScrollbarWidth + 'px'; 760 this.zoomToolbar_.style.bottom = -horizontalScrollbarWidth + 'px';
758 } else { 761 } else {
759 var toolbarRight = Math.max(PDFViewer.MIN_TOOLBAR_OFFSET, scrollbarWidth); 762 var toolbarRight = Math.max(PDFViewer.MIN_TOOLBAR_OFFSET, scrollbarWidth);
760 var toolbarBottom = 763 var toolbarBottom =
761 Math.max(PDFViewer.MIN_TOOLBAR_OFFSET, scrollbarWidth); 764 Math.max(PDFViewer.MIN_TOOLBAR_OFFSET, scrollbarWidth);
762 toolbarRight -= verticalScrollbarWidth; 765 toolbarRight -= verticalScrollbarWidth;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 * Each bookmark is an Object containing a: 924 * Each bookmark is an Object containing a:
922 * - title 925 * - title
923 * - page (optional) 926 * - page (optional)
924 * - array of children (themselves bookmarks) 927 * - array of children (themselves bookmarks)
925 * @type {Array} the top-level bookmarks of the PDF. 928 * @type {Array} the top-level bookmarks of the PDF.
926 */ 929 */
927 get bookmarks() { 930 get bookmarks() {
928 return this.bookmarks_; 931 return this.bookmarks_;
929 } 932 }
930 }; 933 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698