зеркало из https://github.com/mozilla/pjs.git
Bug 717085 - Ensure that when Gecko does a session-restore, it knows how big the screen is. r=pcwalton
This commit is contained in:
Родитель
c76f16f480
Коммит
7322cb3f53
|
@ -469,6 +469,10 @@ public class GeckoAppShell
|
|||
if (restoreSession)
|
||||
combinedArgs += " -restoresession";
|
||||
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
GeckoApp.mAppContext.getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
combinedArgs += " -width " + metrics.widthPixels + " -height " + metrics.heightPixels;
|
||||
|
||||
GeckoApp.mAppContext.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
geckoLoaded();
|
||||
|
|
|
@ -265,6 +265,10 @@ var BrowserApp = {
|
|||
url = window.arguments[0];
|
||||
if (window.arguments[1])
|
||||
restoreSession = window.arguments[1];
|
||||
if (window.arguments[2])
|
||||
gScreenWidth = window.arguments[2];
|
||||
if (window.arguments[3])
|
||||
gScreenHeight = window.arguments[3];
|
||||
}
|
||||
|
||||
// XXX maybe we don't do this if the launch was kicked off from external
|
||||
|
|
|
@ -14,15 +14,21 @@ function openWindow(aParent, aURL, aTarget, aFeatures, aArgs) {
|
|||
let argsArray = Cc["@mozilla.org/supports-array;1"].createInstance(Ci.nsISupportsArray);
|
||||
let urlString = null;
|
||||
let restoreSessionBool = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
|
||||
let widthInt = Cc["@mozilla.org/supports-PRInt32;1"].createInstance(Ci.nsISupportsPRInt32);
|
||||
let heightInt = Cc["@mozilla.org/supports-PRInt32;1"].createInstance(Ci.nsISupportsPRInt32);
|
||||
|
||||
if ("url" in aArgs) {
|
||||
urlString = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
|
||||
urlString.data = aArgs.url;
|
||||
}
|
||||
restoreSessionBool.data = "restoreSession" in aArgs ? aArgs.restoreSession : false;
|
||||
widthInt.data = "width" in aArgs ? aArgs.width : 1;
|
||||
heightInt.data = "height" in aArgs ? aArgs.height : 1;
|
||||
|
||||
argsArray.AppendElement(urlString, false);
|
||||
argsArray.AppendElement(restoreSessionBool, false);
|
||||
argsArray.AppendElement(widthInt, false);
|
||||
argsArray.AppendElement(heightInt, false);
|
||||
return Services.ww.openWindow(aParent, aURL, aTarget, aFeatures, argsArray);
|
||||
}
|
||||
|
||||
|
@ -48,12 +54,20 @@ BrowserCLH.prototype = {
|
|||
handle: function fs_handle(aCmdLine) {
|
||||
let urlParam = "about:home";
|
||||
let restoreSession = false;
|
||||
let width = 1;
|
||||
let height = 1;
|
||||
try {
|
||||
urlParam = aCmdLine.handleFlagWithParam("remote", false);
|
||||
} catch (e) { /* Optional */ }
|
||||
try {
|
||||
restoreSession = aCmdLine.handleFlag("restoresession", false);
|
||||
} catch (e) { /* Optional */ }
|
||||
try {
|
||||
width = aCmdLine.handleFlagWithParam("width", false);
|
||||
} catch (e) { /* Optional */ }
|
||||
try {
|
||||
height = aCmdLine.handleFlagWithParam("height", false);
|
||||
} catch (e) { /* Optional */ }
|
||||
|
||||
try {
|
||||
let uri = resolveURIInternal(aCmdLine, urlParam);
|
||||
|
@ -66,7 +80,9 @@ BrowserCLH.prototype = {
|
|||
} else {
|
||||
let args = {
|
||||
url: urlParam,
|
||||
restoreSession: restoreSession
|
||||
restoreSession: restoreSession,
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
browserWin = openWindow(null, "chrome://browser/content/browser.xul", "_blank", "chrome,dialog=no,all", args);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче