Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1408)

Unified Diff: remoting/webapp/me2mom/client_session.js

Issue 7633045: Fix scaling calculation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reset scale to 1.0 instead of bailing out early. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/me2mom/client_session.js
diff --git a/remoting/webapp/me2mom/client_session.js b/remoting/webapp/me2mom/client_session.js
index 021f14fa5a59a0ea0e775cd55204def8f5eee5ba..d697019ea2d8dc175231c517735eb56cbb29106d 100644
--- a/remoting/webapp/me2mom/client_session.js
+++ b/remoting/webapp/me2mom/client_session.js
@@ -367,8 +367,6 @@ remoting.ClientSession.prototype.onDesktopSizeChanged_ = function() {
*/
remoting.ClientSession.prototype.toggleScaleToFit = function(shouldScale) {
if (shouldScale) {
- remoting.debug.log('scale to fit is turned on.');
-
if (this.plugin.desktopWidth == 0 ||
this.plugin.desktopHeight == 0) {
remoting.debug.log('desktop size is not known yet.');
@@ -383,27 +381,24 @@ remoting.ClientSession.prototype.toggleScaleToFit = function(shouldScale) {
if (height % 2 == 1)
--height;
- var scale = 1.0;
- if (width < height)
- scale = 1.0 * height / this.plugin.desktopHeight;
- else
- scale = 1.0 * width / this.plugin.desktopWidth;
-
+ var scaleFitHeight = 1.0 * height / this.plugin.desktopHeight;
+ var scaleFitWidth = 1.0 * width / this.plugin.desktopWidth;
Jamie 2011/08/13 02:24:51 I'd be tempted to guard against either width or he
Lambros 2011/08/15 20:03:45 Already covered by line 370, I think?
+ var scale = Math.min(scaleFitHeight, scaleFitWidth);
if (scale > 1.0) {
remoting.debug.log('scale up is not supported');
- return;
+ scale = 1.0;
}
this.plugin.width = this.plugin.desktopWidth * scale;
this.plugin.height = this.plugin.desktopHeight * scale;
} else {
- remoting.debug.log('scale to fit is turned off.');
this.plugin.width = this.plugin.desktopWidth;
this.plugin.height = this.plugin.desktopHeight;
}
remoting.debug.log('plugin size is now: ' +
this.plugin.width + ' x ' + this.plugin.height + '.');
this.plugin.setScaleToFit(shouldScale);
+ remoting.debug.log('scale to fit is now: ' + shouldScale);
};
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698