Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 377995c

Browse files
committed
Bug 1725569. Send visualViewport resize events for iframes. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D127941
1 parent 825170c commit 377995c

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

layout/base/PresShell.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2967,6 +2967,7 @@ class PresShell final : public nsStubDocumentObserver,
29672967
// needed for the synthetic mouse events.
29682968
layers::ScrollableLayerGuid mMouseEventTargetGuid;
29692969

2970+
// Only populated on root content documents.
29702971
nsSize mVisualViewportSize;
29712972

29722973
// The focus information needed for async keyboard scrolling

layout/generic/nsGfxScrollFrame.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,17 @@ void nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
13711371
// visual viewport is updated to account for that before we read the
13721372
// visual viewport size.
13731373
manager->UpdateVisualViewportSizeForPotentialScrollbarChange();
1374+
} else if ((oldScrollAreaBounds.Size() != newScrollAreaBounds.Size()) &&
1375+
!HasAnyStateBits(NS_FRAME_FIRST_REFLOW)) {
1376+
// We want to make sure to send a visual viewport resize event if the
1377+
// scrollport changed sizes for root scroll frames. The
1378+
// MobileViewportManager will do that, but if we don't have one (ie we
1379+
// aren't a root content document for example) we have to send one
1380+
// ourselves.
1381+
if (auto* window = nsGlobalWindowInner::Cast(
1382+
aPresContext->Document()->GetInnerWindow())) {
1383+
window->VisualViewport()->PostResizeEvent();
1384+
}
13741385
}
13751386
}
13761387

testing/web-platform/meta/visual-viewport/viewport-resize-event-on-iframe-size-change.html.ini

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)