зеркало из 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)
|
||||
return 0;
|
||||
|
||||
let windowUtils = browser.contentWindow
|
||||
.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) {
|
||||
if (Util.contentIsHandheld(browser))
|
||||
return 1;
|
||||
} else {
|
||||
let [w, h] = BrowserView.Util.getBrowserDimensions(browser);
|
||||
return BrowserView.Util.pageZoomLevel(this.getVisibleRect(), w, h);
|
||||
}
|
||||
|
||||
let [w, h] = BrowserView.Util.getBrowserDimensions(browser);
|
||||
return BrowserView.Util.pageZoomLevel(this.getVisibleRect(), w, h);
|
||||
},
|
||||
|
||||
zoom: function zoom(aDirection) {
|
||||
|
|
|
@ -107,8 +107,22 @@ let Util = {
|
|||
return link.href;
|
||||
else
|
||||
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() {
|
||||
// Determine at what resolution the browser is rendered based on meta tag
|
||||
let browser = this._browser;
|
||||
let windowUtils = browser.contentWindow
|
||||
.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) {
|
||||
if (Util.contentIsHandheld(browser)) {
|
||||
browser.className = "browser-handheld";
|
||||
} else {
|
||||
browser.className = "browser";
|
||||
|
@ -2510,7 +2500,7 @@ Tab.prototype = {
|
|||
|
||||
//if (!this._loading)
|
||||
// dump("!!! Already finished loading this tab, please file a bug\n");
|
||||
this.setIcon(this._browser.mIconURL);
|
||||
this.setIcon(browser.mIconURL);
|
||||
|
||||
this._loading = false;
|
||||
clearTimeout(this._loadingTimeout);
|
||||
|
|
Загрузка…
Ссылка в новой задаче