OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * Provides view port management utilities below for a desktop remoting session. | 7 * Provides view port management utilities below for a desktop remoting session. |
8 * - Enabling bump scrolling | 8 * - Enabling bump scrolling |
9 * - Resizing the viewport to fit the host desktop | 9 * - Resizing the viewport to fit the host desktop |
10 * - Resizing the host desktop to fit the client viewport. | 10 * - Resizing the host desktop to fit the client viewport. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 * @return {boolean} True if resize-to-client is enabled; false otherwise. | 85 * @return {boolean} True if resize-to-client is enabled; false otherwise. |
86 */ | 86 */ |
87 remoting.DesktopViewport.prototype.getResizeToClient = function() { | 87 remoting.DesktopViewport.prototype.getResizeToClient = function() { |
88 return this.hostOptions_.resizeToClient; | 88 return this.hostOptions_.resizeToClient; |
89 }; | 89 }; |
90 | 90 |
91 /** | 91 /** |
92 * @return {{top:number, left:number}} The top-left corner of the plugin. | 92 * @return {{top:number, left:number}} The top-left corner of the plugin. |
93 */ | 93 */ |
94 remoting.DesktopViewport.prototype.getPluginPositionForTesting = function() { | 94 remoting.DesktopViewport.prototype.getPluginPositionForTesting = function() { |
95 var style = this.pluginContainer_.style; | 95 /** |
| 96 * @param {number|string} value |
| 97 * @return {number} |
| 98 */ |
| 99 function toFloat(value) { |
| 100 var number = parseFloat(value); |
| 101 return isNaN(number) ? 0 : number; |
| 102 } |
96 return { | 103 return { |
97 top: parseFloat(style.marginTop), | 104 top: toFloat(this.pluginContainer_.style.marginTop), |
98 left: parseFloat(style.marginLeft) | 105 left: toFloat(this.pluginContainer_.style.marginLeft) |
99 }; | 106 }; |
100 }; | 107 }; |
101 | 108 |
102 /** | 109 /** |
103 * @param {number} width | 110 * @param {number} width |
104 * @param {number} height | 111 * @param {number} height |
105 */ | 112 */ |
106 remoting.DesktopViewport.prototype.setPluginSizeForBumpScrollTesting = | 113 remoting.DesktopViewport.prototype.setPluginSizeForBumpScrollTesting = |
107 function(width, height) { | 114 function(width, height) { |
108 this.pluginWidthForBumpScrollTesting_ = width; | 115 this.pluginWidthForBumpScrollTesting_ = width; |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 return { width: pluginWidth, height: pluginHeight }; | 483 return { width: pluginWidth, height: pluginHeight }; |
477 }; | 484 }; |
478 | 485 |
479 /** @private */ | 486 /** @private */ |
480 remoting.DesktopViewport.prototype.resetScroll_ = function() { | 487 remoting.DesktopViewport.prototype.resetScroll_ = function() { |
481 this.pluginContainer_.style.marginTop = '0px'; | 488 this.pluginContainer_.style.marginTop = '0px'; |
482 this.pluginContainer_.style.marginLeft = '0px'; | 489 this.pluginContainer_.style.marginLeft = '0px'; |
483 }; | 490 }; |
484 | 491 |
485 }()); | 492 }()); |
OLD | NEW |