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

Unified Diff: chrome/browser/resources/pdf/pdf.js

Issue 293613002: Add a minimum offset for the OOP PDF toolbar (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « no previous file | no next file » | 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 1e6938f374b5699ba2ae158649902e5addbe85db..f66a8f2c6659cd9c3720501848939a581d7730ff 100644
--- a/chrome/browser/resources/pdf/pdf.js
+++ b/chrome/browser/resources/pdf/pdf.js
@@ -25,6 +25,12 @@ function getScrollbarWidth() {
}
/**
+ * The minimum number of pixels to offset the toolbar by from the bottom and
+ * right side of the screen.
+ */
+PDFViewer.MIN_TOOLBAR_OFFSET = 15;
+
+/**
* Creates a new PDFViewer. There should only be one of these objects per
* document.
*/
@@ -311,8 +317,12 @@ PDFViewer.prototype = {
var hasScrollbars = this.viewport_.documentHasScrollbars();
var scrollbarWidth = this.viewport_.scrollbarWidth;
// Offset the toolbar position so that it doesn't move if scrollbars appear.
- var toolbarRight = hasScrollbars.vertical ? 0 : scrollbarWidth;
- var toolbarBottom = hasScrollbars.horizontal ? 0 : scrollbarWidth;
+ var toolbarRight = Math.max(PDFViewer.MIN_TOOLBAR_OFFSET, scrollbarWidth);
+ var toolbarBottom = Math.max(PDFViewer.MIN_TOOLBAR_OFFSET, scrollbarWidth);
+ if (hasScrollbars.vertical)
+ toolbarRight -= scrollbarWidth;
+ if (hasScrollbars.horizontal)
+ toolbarBottom -= scrollbarWidth;
this.toolbar_.style.right = toolbarRight + 'px';
this.toolbar_.style.bottom = toolbarBottom + 'px';
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698