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

Side by Side Diff: remoting/webapp/client_plugin_async.js

Issue 66673007: Ensure that dimensions and DPI are integers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 * Class that wraps low-level details of interacting with the client plugin. 7 * Class that wraps low-level details of interacting with the client plugin.
8 * 8 *
9 * This abstracts a <embed> element and controls the plugin which does 9 * This abstracts a <embed> element and controls the plugin which does
10 * the actual remoting work. It also handles differences between 10 * the actual remoting work. It also handles differences between
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 /** 517 /**
518 * Notifies the host that the client has the specified size and pixel density. 518 * Notifies the host that the client has the specified size and pixel density.
519 * 519 *
520 * @param {number} width The available client width in DIPs. 520 * @param {number} width The available client width in DIPs.
521 * @param {number} height The available client height in DIPs. 521 * @param {number} height The available client height in DIPs.
522 * @param {number} device_scale The number of device pixels per DIP. 522 * @param {number} device_scale The number of device pixels per DIP.
523 */ 523 */
524 remoting.ClientPluginAsync.prototype.notifyClientResolution = 524 remoting.ClientPluginAsync.prototype.notifyClientResolution =
525 function(width, height, device_scale) { 525 function(width, height, device_scale) {
526 if (this.hasFeature(remoting.ClientPlugin.Feature.NOTIFY_CLIENT_RESOLUTION)) { 526 if (this.hasFeature(remoting.ClientPlugin.Feature.NOTIFY_CLIENT_RESOLUTION)) {
527 var dpi = device_scale * 96; 527 var dpi = Math.floor(device_scale * 96);
528 this.plugin.postMessage(JSON.stringify( 528 this.plugin.postMessage(JSON.stringify(
529 { method: 'notifyClientResolution', 529 { method: 'notifyClientResolution',
530 data: { width: width * device_scale, 530 data: { width: Math.floor(width * device_scale),
531 height: height * device_scale, 531 height: Math.floor(height * device_scale),
Lambros 2013/11/08 22:26:33 Math.round might be slightly better?
Jamie 2013/11/08 22:29:15 I think we want floor. A 1px border is better than
532 x_dpi: dpi, y_dpi: dpi }})); 532 x_dpi: dpi, y_dpi: dpi }}));
533 } 533 }
534 }; 534 };
535 535
536 /** 536 /**
537 * Requests that the host pause or resume sending video updates. 537 * Requests that the host pause or resume sending video updates.
538 * 538 *
539 * @param {boolean} pause True to suspend video updates, false otherwise. 539 * @param {boolean} pause True to suspend video updates, false otherwise.
540 */ 540 */
541 remoting.ClientPluginAsync.prototype.pauseVideo = 541 remoting.ClientPluginAsync.prototype.pauseVideo =
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 this.plugin.width = width; 645 this.plugin.width = width;
646 this.plugin.height = height; 646 this.plugin.height = height;
647 // Center the plugin just underneath the "Connnecting..." dialog. 647 // Center the plugin just underneath the "Connnecting..." dialog.
648 var parentNode = this.plugin.parentNode; 648 var parentNode = this.plugin.parentNode;
649 var dialog = document.getElementById('client-dialog'); 649 var dialog = document.getElementById('client-dialog');
650 var dialogRect = dialog.getBoundingClientRect(); 650 var dialogRect = dialog.getBoundingClientRect();
651 parentNode.style.top = (dialogRect.bottom + 16) + 'px'; 651 parentNode.style.top = (dialogRect.bottom + 16) + 'px';
652 parentNode.style.left = (window.innerWidth - width) / 2 + 'px'; 652 parentNode.style.left = (window.innerWidth - width) / 2 + 'px';
653 } 653 }
654 }; 654 };
OLDNEW
« 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