commit e2e9753dfae27068c73975a4078f71aa2d9e05c1
parent d96e9bd92c21f9576e858ce240757549d2ffb046
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date: Fri, 17 Oct 2025 09:34:47 +0000
Bug 1994893 - Make the assertion stricter. r=tnikkel,layout-reviewers
Will land if try is green.
Differential Revision: https://phabricator.services.mozilla.com/D269011
Diffstat:
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp
@@ -2216,7 +2216,7 @@ void nsDocumentViewer::MakeWindow(const nsSize& aSize, nsView* aContainerView) {
mViewManager = new nsViewManager(mPresContext->DeviceContext());
// The root view is always at 0,0.
- nsRect tbounds(nsPoint(0, 0), aSize);
+ nsRect tbounds(nsPoint(), aSize);
// Create a view
nsView* view = mViewManager->CreateView(tbounds, aContainerView);
MOZ_ASSERT(view);
@@ -2226,10 +2226,13 @@ void nsDocumentViewer::MakeWindow(const nsSize& aSize, nsView* aContainerView) {
// Don't create widgets for ResourceDocs (external resources & svg images),
// because when they're displayed, they're painted into *another* document's
// widget.
- if (!mDocument->IsResourceDoc() && mParentWidget) {
- // Reuse the top level parent widget.
- view->AttachToTopLevelWidget(mParentWidget);
- mAttachedToParent = true;
+ if (!mDocument->IsResourceDoc()) {
+ MOZ_ASSERT_IF(!aContainerView, mParentWidget);
+ if (mParentWidget) {
+ // Reuse the top level parent widget.
+ view->AttachToTopLevelWidget(mParentWidget);
+ mAttachedToParent = true;
+ }
}
// Setup hierarchical relationship in view manager