Bug 1501665 Part 3: Add a new function to determine if a document can use resolution zooming. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D19238

--HG--
extra : source : 731d7ee06d86794fb9ec58b32f1495ad11205a1c
This commit is contained in:
Brad Werth 2019-03-18 14:56:32 +00:00
Родитель 64131401a1
Коммит 83ef115c9e
2 изменённых файлов: 18 добавлений и 2 удалений

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

@ -667,6 +667,16 @@ bool nsLayoutUtils::AsyncPanZoomEnabled(nsIFrame* aFrame) {
return widget->AsyncPanZoomEnabled();
}
bool nsLayoutUtils::AllowZoomingForDocument(
const mozilla::dom::Document* aDocument) {
// True if we allow zooming for all documents on this platform, or if we are
// in RDM and handling meta viewports, which force zoom under some
// circumstances.
return gfxPrefs::APZAllowZooming() ||
(aDocument && aDocument->InRDMPane() &&
nsLayoutUtils::ShouldHandleMetaViewport(aDocument));
}
float nsLayoutUtils::GetCurrentAPZResolutionScale(nsIPresShell* aShell) {
return aShell ? aShell->GetCumulativeNonRootScaleResolution() : 1.0;
}
@ -9783,7 +9793,7 @@ void nsLayoutUtils::ComputeSystemFont(nsFont* aSystemFont,
}
/* static */
bool nsLayoutUtils::ShouldHandleMetaViewport(Document* aDocument) {
bool nsLayoutUtils::ShouldHandleMetaViewport(const Document* aDocument) {
auto metaViewportOverride = nsIDocShell::META_VIEWPORT_OVERRIDE_NONE;
if (aDocument) {
if (nsIDocShell* docShell = aDocument->GetDocShell()) {

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

@ -2703,6 +2703,12 @@ class nsLayoutUtils {
*/
static float GetCurrentAPZResolutionScale(nsIPresShell* aShell);
/**
* Returns true if aDocument should be allowed to use resolution
* zooming.
*/
static bool AllowZoomingForDocument(const mozilla::dom::Document* aDocument);
/**
* Returns true if we need to disable async scrolling for this particular
* element. Note that this does a partial disabling - the displayport still
@ -2995,7 +3001,7 @@ class nsLayoutUtils {
* Returns true if there are any preferences or overrides that indicate a
* need to create a MobileViewportManager.
*/
static bool ShouldHandleMetaViewport(mozilla::dom::Document*);
static bool ShouldHandleMetaViewport(const mozilla::dom::Document*);
/**
* Resolve a CSS <length-percentage> value to a definite size.