Chromium Code Reviews| Index: remoting/webapp/client_session.js |
| diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js |
| index f1bd19bc730570069e0ded7a92a50f491c2c4bd8..32c2808853667d51668047dc3782ef5ce0aa67b8 100644 |
| --- a/remoting/webapp/client_session.js |
| +++ b/remoting/webapp/client_session.js |
| @@ -435,12 +435,20 @@ remoting.ClientSession.prototype.updateDimensions = function() { |
| var windowWidth = window.innerWidth; |
| var windowHeight = window.innerHeight; |
| - var scale = 1.0; |
| + |
| + // Estimate browser scale factor in order to be able to translate logical |
| + // pixels on the page into physical pixels on the screen. Scale factor can |
| + // be roughly estimated as a ratio between outerWidht and innerWidth of |
| + // the document view. The result is not precise because outerWidth can |
| + // include pixels allocated for toolbars, window borders and such. |
| + var viewInnerWidth = document.defaultView.innerWidth; |
| + var viewOuterWidth = document.defaultView.outerWidth; |
| + var scale = Math.round(100.0 * viewInnerWidth / viewOuterWidth) / 100.0; |
|
Wez
2012/02/07 01:56:31
This looks like a change from a different CL, so I
|
| if (this.getScaleToFit()) { |
| - var scaleFitHeight = 1.0 * windowHeight / this.plugin.desktopHeight; |
| - var scaleFitWidth = 1.0 * windowWidth / this.plugin.desktopWidth; |
| - scale = Math.min(1.0, scaleFitHeight, scaleFitWidth); |
| + var scaledHeight = 1.0 * windowHeight / (scale * this.plugin.desktopHeight); |
| + var scaledWidth = 1.0 * windowWidth / (scale * this.plugin.desktopWidth); |
| + scale = Math.min(1.0, scaledHeight, scaledWidth, scale); |
| } |
| // Resize the plugin if necessary. |