| Index: chrome/browser/resources/pdf/pdf.js
|
| diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js
|
| index 60384e5db6e1fe6a49a7d6fd4bac41e6c537691f..976c2f649a1ac27aa6c8a79627bae3683ccdc57e 100644
|
| --- a/chrome/browser/resources/pdf/pdf.js
|
| +++ b/chrome/browser/resources/pdf/pdf.js
|
| @@ -52,7 +52,9 @@ function PDFViewer() {
|
| // Create the viewport.
|
| this.viewport_ = new Viewport(window,
|
| this.sizer_,
|
| - this.viewportChangedCallback_.bind(this),
|
| + this.viewportChanged_.bind(this),
|
| + this.beforeZoom_.bind(this),
|
| + this.afterZoom_.bind(this),
|
| getScrollbarWidth());
|
|
|
| // Create the plugin object dynamically so we can set its src. The plugin
|
| @@ -353,9 +355,36 @@ PDFViewer.prototype = {
|
|
|
| /**
|
| * @private
|
| - * A callback that's called when the viewport changes.
|
| + * A callback that's called before the zoom changes. Notify the plugin to stop
|
| + * reacting to scroll events while zoom is taking place to avoid flickering.
|
| */
|
| - viewportChangedCallback_: function() {
|
| + beforeZoom_: function() {
|
| + this.plugin_.postMessage({
|
| + type: 'stopScrolling'
|
| + });
|
| + },
|
| +
|
| + /**
|
| + * @private
|
| + * A callback that's called after the zoom changes. Notify the plugin of the
|
| + * zoom change and to continue reacting to scroll events.
|
| + */
|
| + afterZoom_: function() {
|
| + var position = this.viewport_.position;
|
| + var zoom = this.viewport_.zoom;
|
| + this.plugin_.postMessage({
|
| + type: 'viewport',
|
| + zoom: zoom,
|
| + xOffset: position.x,
|
| + yOffset: position.y
|
| + });
|
| + },
|
| +
|
| + /**
|
| + * @private
|
| + * A callback that's called after the viewport changes.
|
| + */
|
| + viewportChanged_: function() {
|
| if (!this.documentDimensions_)
|
| return;
|
|
|
| @@ -391,16 +420,6 @@ PDFViewer.prototype = {
|
| this.pageIndicator_.style.visibility = 'hidden';
|
| }
|
|
|
| - var position = this.viewport_.position;
|
| - var zoom = this.viewport_.zoom;
|
| - // Notify the plugin of the viewport change.
|
| - this.plugin_.postMessage({
|
| - type: 'viewport',
|
| - zoom: zoom,
|
| - xOffset: position.x,
|
| - yOffset: position.y
|
| - });
|
| -
|
| var visiblePageDimensions = this.viewport_.getPageScreenRect(visiblePage);
|
| var size = this.viewport_.size;
|
| this.sendScriptingMessage_({
|
|
|