Bug 784612 - Remove old XUL content autoScale hack from meta viewport code [r=mfinkle,jwir3]

--HG--
extra : rebase_source : 005f0489eb035c3acc43d7fa2e689d5ff27ffa45
This commit is contained in:
Matt Brubeck 2012-08-22 09:42:24 -07:00
Родитель 289788f079
Коммит 5bb22b9da7
3 изменённых файлов: 12 добавлений и 32 удалений

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

@ -174,14 +174,6 @@ struct ViewportInfo
// Whether or not the user can zoom in and out on the page. Default is true.
bool allowZoom;
// This is a holdover from e10s fennec, and might be removed in the future.
// It's a hack to work around bugs that didn't allow zooming of documents
// from within the parent process. It is still used in native Fennec for XUL
// documents, but it should probably be removed.
// Currently, from, within GetViewportInfo(), This is only set to false
// if the document is a XUL document.
bool autoScale;
};
struct EventNameMapping

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

@ -5055,7 +5055,6 @@ nsContentUtils::GetViewportInfo(nsIDocument *aDocument)
ret.defaultZoom = 1.0;
ret.autoSize = true;
ret.allowZoom = true;
ret.autoScale = true;
// If the docType specifies that we are on a site optimized for mobile,
// then we want to return specially crafted defaults for the viewport info.
@ -5077,11 +5076,6 @@ nsContentUtils::GetViewportInfo(nsIDocument *aDocument)
}
}
if (aDocument->IsXUL()) {
ret.autoScale = false;
return ret;
}
nsAutoString handheldFriendly;
aDocument->GetHeaderData(nsGkAtoms::handheldFriendly, handheldFriendly);

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

@ -3079,16 +3079,16 @@ Tab.prototype = {
aMetadata.allowZoom = true;
aMetadata.minZoom = aMetadata.maxZoom = NaN;
}
if (aMetadata && aMetadata.autoScale) {
let scaleRatio = aMetadata.scaleRatio = ViewportHandler.getScaleRatio();
if ("defaultZoom" in aMetadata && aMetadata.defaultZoom > 0)
aMetadata.defaultZoom *= scaleRatio;
if ("minZoom" in aMetadata && aMetadata.minZoom > 0)
aMetadata.minZoom *= scaleRatio;
if ("maxZoom" in aMetadata && aMetadata.maxZoom > 0)
aMetadata.maxZoom *= scaleRatio;
}
let scaleRatio = aMetadata.scaleRatio = ViewportHandler.getScaleRatio();
if ("defaultZoom" in aMetadata && aMetadata.defaultZoom > 0)
aMetadata.defaultZoom *= scaleRatio;
if ("minZoom" in aMetadata && aMetadata.minZoom > 0)
aMetadata.minZoom *= scaleRatio;
if ("maxZoom" in aMetadata && aMetadata.maxZoom > 0)
aMetadata.maxZoom *= scaleRatio;
ViewportHandler.setMetadataForDocument(this.browser.contentDocument, aMetadata);
this.updateViewportSize(gScreenWidth);
this.sendViewportMetadata();
@ -4547,12 +4547,8 @@ var ViewportHandler = {
* height (optional int): The CSS viewport height in px.
* autoSize (boolean): Resize the CSS viewport when the window resizes.
* allowZoom (boolean): Let the user zoom in or out.
* autoScale (boolean): Adjust the viewport properties to account for display density.
*/
getViewportMetadata: function getViewportMetadata(aWindow) {
if (aWindow.document instanceof XULDocument)
return { defaultZoom: 1, autoSize: true, allowZoom: false, autoScale: false };
let windowUtils = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
// viewport details found here
@ -4577,11 +4573,11 @@ var ViewportHandler = {
// Only check for HandheldFriendly if we don't have a viewport meta tag
let handheldFriendly = windowUtils.getDocumentMetadata("HandheldFriendly");
if (handheldFriendly == "true")
return { defaultZoom: 1, autoSize: true, allowZoom: true, autoScale: true };
return { defaultZoom: 1, autoSize: true, allowZoom: true };
let doctype = aWindow.document.doctype;
if (doctype && /(WAP|WML|Mobile)/.test(doctype.publicId))
return { defaultZoom: 1, autoSize: true, allowZoom: true, autoScale: true };
return { defaultZoom: 1, autoSize: true, allowZoom: true };
}
scale = this.clamp(scale, kViewportMinScale, kViewportMaxScale);
@ -4599,8 +4595,7 @@ var ViewportHandler = {
width: width,
height: height,
autoSize: autoSize,
allowZoom: allowZoom,
autoScale: true
allowZoom: allowZoom
};
},
@ -4653,7 +4648,6 @@ var ViewportHandler = {
return {
autoSize: false,
allowZoom: true,
autoScale: true,
scaleRatio: ViewportHandler.getScaleRatio()
};
}