Commit 681b00eb authored by raymes@google.com's avatar raymes@google.com

Cause the viewport to fit to the PDF document width on load

When the document dimensions are initially set, the zoom should be initially
set to fit the document width. If the zoom is greater than 100%, it should be
set to 100% as per the current PDF plugin behavior.

BUG=303491
R=arv@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266709 0039d316-1c4b-4281-b951-d872f2087c98
parent 5741bfcd
......@@ -421,8 +421,15 @@ Viewport.prototype = {
* @param {Object} documentDimensions the dimensions of the document
*/
setDocumentDimensions: function(documentDimensions) {
var initialDimensions = !this.documentDimensions_;
this.documentDimensions_ = documentDimensions;
this.pageDimensions_ = this.documentDimensions_.pageDimensions;
if (initialDimensions) {
this.setZoom_(this.computeFittingZoom_(this.documentDimensions_, true));
if (this.zoom_ > 1)
this.setZoom_(1);
this.window_.scrollTo(0, 0);
}
this.contentSizeChanged_();
this.resize_();
},
......
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