mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 17:25:36 +00:00
Bug 436083: Viewport meta tag [r=mark.finkle r=gavin.sharp]
This commit is contained in:
parent
7ad93c7e5e
commit
58259a4197
@ -112,16 +112,27 @@ let Util = {
|
|||||||
contentIsHandheld: function contentIsHandheld(browser) {
|
contentIsHandheld: function contentIsHandheld(browser) {
|
||||||
let doctype = browser.contentDocument.doctype;
|
let doctype = browser.contentDocument.doctype;
|
||||||
if (doctype && /(WAP|WML|Mobile)/.test(doctype.publicId))
|
if (doctype && /(WAP|WML|Mobile)/.test(doctype.publicId))
|
||||||
return true;
|
return {reason: "doctype", result: true};
|
||||||
|
|
||||||
let windowUtils = browser.contentWindow
|
let windowUtils = browser.contentWindow
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIDOMWindowUtils);
|
.getInterface(Ci.nsIDOMWindowUtils);
|
||||||
let handheldFriendly = windowUtils.getDocumentMetadata("HandheldFriendly");
|
let handheldFriendly = windowUtils.getDocumentMetadata("HandheldFriendly");
|
||||||
if (handheldFriendly == "true")
|
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};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user