Commit 45ac8c90 authored by raymes@chromium.org's avatar raymes@chromium.org

Add a minimum offset for the OOP PDF toolbar

On platforms which have an overlay scrollbar (namely Mac) the toolbar in OOP PDF appears to be too low to the bottom and right of the screen. This adds a minimum offset for the toolbar.

BUG=303491

Review URL: https://codereview.chromium.org/293613002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272367 0039d316-1c4b-4281-b951-d872f2087c98
parent ae209392
...@@ -24,6 +24,12 @@ function getScrollbarWidth() { ...@@ -24,6 +24,12 @@ function getScrollbarWidth() {
return result; return result;
} }
/**
* 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 * Creates a new PDFViewer. There should only be one of these objects per
* document. * document.
...@@ -325,8 +331,12 @@ PDFViewer.prototype = { ...@@ -325,8 +331,12 @@ PDFViewer.prototype = {
var hasScrollbars = this.viewport_.documentHasScrollbars(); var hasScrollbars = this.viewport_.documentHasScrollbars();
var scrollbarWidth = this.viewport_.scrollbarWidth; var scrollbarWidth = this.viewport_.scrollbarWidth;
// Offset the toolbar position so that it doesn't move if scrollbars appear. // Offset the toolbar position so that it doesn't move if scrollbars appear.
var toolbarRight = hasScrollbars.vertical ? 0 : scrollbarWidth; var toolbarRight = Math.max(PDFViewer.MIN_TOOLBAR_OFFSET, scrollbarWidth);
var toolbarBottom = hasScrollbars.horizontal ? 0 : 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.right = toolbarRight + 'px';
this.toolbar_.style.bottom = toolbarBottom + 'px'; this.toolbar_.style.bottom = toolbarBottom + 'px';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment