Bug 436083: Viewport meta tag [r=mark.finkle r=gavin.sharp]

This commit is contained in:
Brad Lassey 2009-11-03 16:20:03 -05:00
Родитель 7ad93c7e5e
Коммит 58259a4197
1 изменённых файлов: 14 добавлений и 3 удалений

Просмотреть файл

@ -112,16 +112,27 @@ let Util = {
contentIsHandheld: function contentIsHandheld(browser) {
let doctype = browser.contentDocument.doctype;
if (doctype && /(WAP|WML|Mobile)/.test(doctype.publicId))
return true;
return {reason: "doctype", result: true};
let windowUtils = browser.contentWindow
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let handheldFriendly = windowUtils.getDocumentMetadata("HandheldFriendly");
if (handheldFriendly == "true")
return true;
return {reason: "handheld", result: true};
return false;
let viewportScale = parseFloat(windowUtils.getDocumentMetadata("viewport-initial-scale"));
if (viewportScale > 0) {
return {
reason: "viewport",
result: true,
scale: viewportScale,
width: parseInt(windowUtils.getDocumentMetadata("viewport-width")),
height: parseInt(windowUtils.getDocumentMetadata("viewport-height"))
}
}
return {reason: "", result: false};
}
};