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

Unified Diff: remoting/webapp/base/js/base.js

Issue 1130013003: Replace moveTo and resizeTo with outerBounds= (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplified. Created 5 years, 7 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
Index: remoting/webapp/base/js/base.js
diff --git a/remoting/webapp/base/js/base.js b/remoting/webapp/base/js/base.js
index 48e2a84461a14c1b58e7bf7f3a84de1b23bdb41a..c10c8cf57101a96e00f71dfecabca15b92bbb186 100644
--- a/remoting/webapp/base/js/base.js
+++ b/remoting/webapp/base/js/base.js
@@ -789,21 +789,16 @@ base.timestamp = function() {
*/
base.resizeWindowToContent = function(opt_centerWindow) {
var appWindow = chrome.app.window.current();
- var outerBounds = appWindow.outerBounds;
- var borderX = outerBounds.width - appWindow.innerBounds.width;
- var borderY = outerBounds.height - appWindow.innerBounds.height;
- var newWidth = document.documentElement.scrollWidth + borderX;
- var newHeight = document.documentElement.scrollHeight + borderY;
- appWindow.resizeTo(newWidth, newHeight);
- var left = outerBounds.left;
- var top = outerBounds.top;
+ var borderX = appWindow.outerBounds.width - appWindow.innerBounds.width;
+ var borderY = appWindow.outerBounds.height - appWindow.innerBounds.height;
+ var width = Math.ceil(document.documentElement.scrollWidth + borderX);
+ var height = Math.ceil(document.documentElement.scrollHeight + borderY);
+ appWindow.outerBounds.width = width;
+ appWindow.outerBounds.height = height;
if (opt_centerWindow) {
var screenWidth = screen.availWidth;
var screenHeight = screen.availHeight;
- left = (screenWidth - newWidth) / 2;
- top = (screenHeight - newHeight) / 2;
+ appWindow.outerBounds.left = Math.round((screenWidth - width) / 2);
+ appWindow.outerBounds.top = Math.round((screenHeight - height) / 2);
}
- // Sometimes, resizing the window causes its position to be reset to (0, 0),
- // so restore it explicitly, even if it doesn't need to be centered.
- appWindow.moveTo(left, top);
};

Powered by Google App Engine
This is Rietveld 408576698