зеркало из https://github.com/mozilla/pjs.git
Bug 525088: clean up getZoomForPage and consolidate code, r=blassey
This commit is contained in:
Родитель
f133527c9f
Коммит
962da0c7ca
|
@ -556,22 +556,11 @@ BrowserView.prototype = {
|
||||||
if (!browser)
|
if (!browser)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
let windowUtils = browser.contentWindow
|
if (Util.contentIsHandheld(browser))
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
||||||
.getInterface(Ci.nsIDOMWindowUtils);
|
|
||||||
let handheldFriendly = windowUtils.getDocumentMetadata("HandheldFriendly");
|
|
||||||
let handheldDoctype =
|
|
||||||
(browser.contentDocument.doctype &&
|
|
||||||
(browser.contentDocument.doctype.publicId.search("WAP") != -1 ||
|
|
||||||
browser.contentDocument.doctype.publicId.search("WML") != -1 ||
|
|
||||||
browser.contentDocument.doctype.publicId.search("Mobile") != -1));
|
|
||||||
|
|
||||||
if (handheldFriendly == "true" || handheldDoctype) {
|
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
|
||||||
let [w, h] = BrowserView.Util.getBrowserDimensions(browser);
|
let [w, h] = BrowserView.Util.getBrowserDimensions(browser);
|
||||||
return BrowserView.Util.pageZoomLevel(this.getVisibleRect(), w, h);
|
return BrowserView.Util.pageZoomLevel(this.getVisibleRect(), w, h);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
zoom: function zoom(aDirection) {
|
zoom: function zoom(aDirection) {
|
||||||
|
|
|
@ -107,8 +107,22 @@ let Util = {
|
||||||
return link.href;
|
return link.href;
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
},
|
||||||
|
|
||||||
|
contentIsHandheld: function contentIsHandheld(browser) {
|
||||||
|
let doctype = browser.contentDocument.doctype;
|
||||||
|
if (doctype && /(WAP|WML|Mobile)/.test(doctype.publicId))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
let windowUtils = browser.contentWindow
|
||||||
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
|
.getInterface(Ci.nsIDOMWindowUtils);
|
||||||
|
let handheldFriendly = windowUtils.getDocumentMetadata("HandheldFriendly");
|
||||||
|
if (handheldFriendly == "true")
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2492,17 +2492,7 @@ Tab.prototype = {
|
||||||
endLoading: function() {
|
endLoading: function() {
|
||||||
// Determine at what resolution the browser is rendered based on meta tag
|
// Determine at what resolution the browser is rendered based on meta tag
|
||||||
let browser = this._browser;
|
let browser = this._browser;
|
||||||
let windowUtils = browser.contentWindow
|
if (Util.contentIsHandheld(browser)) {
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
||||||
.getInterface(Ci.nsIDOMWindowUtils);
|
|
||||||
let handheldFriendly = windowUtils.getDocumentMetadata("HandheldFriendly");
|
|
||||||
let handheldDoctype =
|
|
||||||
(browser.contentDocument.doctype &&
|
|
||||||
(browser.contentDocument.doctype.publicId.search("WAP") != -1 ||
|
|
||||||
browser.contentDocument.doctype.publicId.search("WML") != -1 ||
|
|
||||||
browser.contentDocument.doctype.publicId.search("Mobile") != -1));
|
|
||||||
|
|
||||||
if (handheldFriendly == "true" || handheldDoctype) {
|
|
||||||
browser.className = "browser-handheld";
|
browser.className = "browser-handheld";
|
||||||
} else {
|
} else {
|
||||||
browser.className = "browser";
|
browser.className = "browser";
|
||||||
|
@ -2510,7 +2500,7 @@ Tab.prototype = {
|
||||||
|
|
||||||
//if (!this._loading)
|
//if (!this._loading)
|
||||||
// dump("!!! Already finished loading this tab, please file a bug\n");
|
// dump("!!! Already finished loading this tab, please file a bug\n");
|
||||||
this.setIcon(this._browser.mIconURL);
|
this.setIcon(browser.mIconURL);
|
||||||
|
|
||||||
this._loading = false;
|
this._loading = false;
|
||||||
clearTimeout(this._loadingTimeout);
|
clearTimeout(this._loadingTimeout);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче