Index: chrome/browser/resources/print_preview/preview_area.js |
diff --git a/chrome/browser/resources/print_preview/preview_area.js b/chrome/browser/resources/print_preview/preview_area.js |
index 8a970a2f07dd18c034ac7000cdeb98d964be1121..f844bee52b2f3384f0129cc02d9adca2d1373c26 100644 |
--- a/chrome/browser/resources/print_preview/preview_area.js |
+++ b/chrome/browser/resources/print_preview/preview_area.js |
@@ -24,6 +24,11 @@ cr.define('print_preview', function() { |
// before a new preview is requested so that the scroll amount can be |
// restored later. |
this.pageOffset_ = null; |
+ |
+ // @type {print_preview.Rect} A rectangle describing the postion of the |
+ // most visible page normalized with respect to the total height and width |
+ // of the plugin. |
+ this.pageLocationNormalized = null; |
} |
cr.addSingletonGetter(PreviewArea); |
@@ -77,17 +82,19 @@ cr.define('print_preview', function() { |
}, |
/** |
- * @return {print_preview.Rect} A rectangle describing the postion of the |
- * most visible page normalized with respect to the total height and width |
- * of the plugin. |
+ * Queries the plugin for the location of the most visible page and updates |
+ * |this.pageLocationNormalized|. |
*/ |
- getPageLocationNormalized: function() { |
+ update: function() { |
+ if (!this.pdfLoaded_) |
+ return; |
var pluginLocation = |
this.pdfPlugin_.getPageLocationNormalized().split(';'); |
- return new print_preview.Rect(parseFloat(pluginLocation[0]), |
- parseFloat(pluginLocation[1]), |
- parseFloat(pluginLocation[2]), |
- parseFloat(pluginLocation[3])); |
+ this.pageLocationNormalized = new print_preview.Rect( |
+ parseFloat(pluginLocation[0]), |
+ parseFloat(pluginLocation[1]), |
+ parseFloat(pluginLocation[2]), |
+ parseFloat(pluginLocation[3])); |
}, |
/** |
@@ -127,6 +134,7 @@ cr.define('print_preview', function() { |
} else { |
this.pdfPlugin_.fitToHeight(); |
} |
+ this.update(); |
} |
}; |