Bug 870105 - In BackgroundPageThumbs.jsm, size the browser once using browser.style rather than after each page load using nsIDOMWindowUtils.setCSSViewport. r=ttaubert

This commit is contained in:
Drew Willcoxon 2013-06-04 14:37:02 -07:00
parent 76072f4667
commit 300957cc47
2 changed files with 5 additions and 15 deletions

View File

@ -129,6 +129,11 @@ const BackgroundPageThumbs = {
browser.setAttribute("type", "content");
browser.setAttribute("remote", "true");
browser.setAttribute("privatebrowsing", "true");
let [width, height] = PageThumbs._getThumbnailSize();
browser.style.width = width + "px";
browser.style.height = height + "px";
this._parentWin.document.documentElement.appendChild(browser);
browser.messageManager.loadFrameScript(FRAME_SCRIPT_URL, false);

View File

@ -34,8 +34,6 @@ const backgroundPageThumbsContent = {
removeEventListener("load", this._onLoad, true);
delete this._onLoad;
// The viewport is always reset to a small size after load, so resize it.
this._sizeViewport();
let canvas = PageThumbs._createCanvas(content);
PageThumbs._captureToCanvas(content, canvas);
@ -56,19 +54,6 @@ const backgroundPageThumbsContent = {
this._webNav.loadURI(msg.json.url, Ci.nsIWebNavigation.LOAD_FLAGS_NONE,
null, null, null);
},
_sizeViewport: function () {
let width = {};
let height = {};
Cc["@mozilla.org/gfx/screenmanager;1"].
getService(Ci.nsIScreenManager).
primaryScreen.
GetRect({}, {}, width, height);
content.
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils).
setCSSViewport(width.value, height.value);
},
};
backgroundPageThumbsContent.init();