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

Unified 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: Rebase Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/pdf/index-material.html ('k') | chrome/browser/resources/pdf/toolbar_manager.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/pdf/pdf.js
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js
index e3cd1f346c96643af0e7550fb2da638d896e0f41..f426068f2b07ac167a57d1e288191b44ec29c27d 100644
--- a/chrome/browser/resources/pdf/pdf.js
+++ b/chrome/browser/resources/pdf/pdf.js
@@ -569,6 +569,8 @@ PDFViewer.prototype = {
if (this.materialToolbar_)
this.materialToolbar_.strings = strings;
this.zoomToolbar_.strings = strings;
+ document.dir = strings['textdirection'];
+ document.lang = strings['language'];
} else {
this.passwordScreen_.text = strings.passwordPrompt;
this.progressBar_.text = strings.pageLoading;
@@ -747,9 +749,12 @@ PDFViewer.prototype = {
// gives a compromise: if there is no scrollbar visible then the toolbar
// will be half a scrollbar width further left than the spec but if there
// is a scrollbar visible it will be half a scrollbar width further right
- // than the spec.
- this.zoomToolbar_.style.right = -verticalScrollbarWidth +
- (scrollbarWidth / 2) + 'px';
+ // than the spec. In RTL layout, the zoom toolbar is on the left side, but
+ // the scrollbar is still on the left, so this is not necessary.
+ if (document.dir == 'ltr') {
+ this.zoomToolbar_.style.right = -verticalScrollbarWidth +
+ (scrollbarWidth / 2) + 'px';
+ }
// Having a horizontal scrollbar is much rarer so we don't offset the
// toolbar from the bottom any more than what the spec says. This means
// that when there is a scrollbar visible, it will be a full scrollbar
« no previous file with comments | « chrome/browser/resources/pdf/index-material.html ('k') | chrome/browser/resources/pdf/toolbar_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698