Bug 1648500 - Don't check for the VV size in TryLayout. r=tnikkel

The TryLayout code uses the composition size to figure out if the
scrollbar is needed or not. It computes something similar to the visual
viewport size (but assuming no scrollbars are taking up space) to do this.
There's no reason this code should be depending on whether or not the
visual viewport size is set in the presShell, so we can just remove the
condition. That way even on the very first reflow, when the visual viewport
will definitely not be set, we can correctly determine if the scrollbars
need to be laid out or not.

Differential Revision: https://phabricator.services.mozilla.com/D81276
This commit is contained in:
Kartikaya Gupta 2020-06-29 03:33:59 +00:00
Родитель 7649856b1f
Коммит 9768f4f2ba
1 изменённых файлов: 7 добавлений и 1 удалений

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

@ -476,7 +476,13 @@ bool nsHTMLScrollFrame::TryLayout(ScrollReflowInput* aState,
ROOT_SCROLLBAR_LOG("TryLayout with VV %s\n",
Stringify(visualViewportSize).c_str());
mozilla::PresShell* presShell = PresShell();
if (mHelper.mIsRoot && presShell->IsVisualViewportSizeSet()) {
// Note: we check for a non-null MobileViepwortManager here, but ideally we
// should be able to drop that clause as well. It's just that in some cases
// with extension popups the composition size comes back as stale, because
// the content viewer is only resized after the popup contents are reflowed.
// That case also happens to have no APZ and no MVM, so we use that as a
// way to detect the scenario. Bug 1648669 tracks removing this clause.
if (mHelper.mIsRoot && presShell->GetMobileViewportManager()) {
visualViewportSize = nsLayoutUtils::CalculateCompositionSizeForFrame(
this, false, &layoutSize);