Bug 1661544 - Ensure initial viewport is computed before reporting innerWidth. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D88947
This commit is contained in:
Botond Ballo
2020-09-09 21:14:31 +00:00
parent 6f140f0ffc
commit 8c28bf105c
5 changed files with 37 additions and 11 deletions

View File

@@ -161,6 +161,7 @@
#include "nsBlockFrame.h"
#include "DOMMatrix.h"
#include "MobileViewportManager.h"
#ifdef ACCESSIBILITY
# include "nsAccessibilityService.h"
@@ -845,13 +846,17 @@ nsRect Element::GetClientAreaRect() {
// We will always have a pres shell if we have a pres context, and we will
// only get here if we have a pres context from the root content document
// check
PresShell* presShell = doc->GetPresShell();
RefPtr<PresShell> presShell = doc->GetPresShell();
// Ensure up to date dimensions, but don't reflow
RefPtr<nsViewManager> viewManager = presShell->GetViewManager();
if (viewManager) {
viewManager->FlushDelayedResize(false);
}
if (RefPtr<MobileViewportManager> mvm =
presShell->GetMobileViewportManager()) {
mvm->EnsureInitialViewportSet();
}
return nsRect(nsPoint(), presContext->GetVisibleArea().Size());
}