Bug 1893918 - A not-yet-loaded browser window shouldn't stop being an early blank window. r=win-reviewers,rkraesig

Otherwise we start painting the window too early, which after
bug 1891063 causes the non-client area to be filled, but we don't paint
anything on top.

Differential Revision: https://phabricator.services.mozilla.com/D208898
This commit is contained in:
Emilio Cobos Álvarez 2024-04-30 08:39:59 +00:00
parent 7f1b3a12f3
commit 687211c219
4 changed files with 12 additions and 10 deletions

View file

@ -1397,6 +1397,8 @@ class nsIWidget : public nsISupports {
const nsAString& xulWinClass, const nsAString& xulWinClass,
const nsAString& xulWinName) = 0; const nsAString& xulWinName) = 0;
virtual void SetIsEarlyBlankWindow(bool) {}
/** /**
* Enables/Disables system capture of any and all events that would cause a * Enables/Disables system capture of any and all events that would cause a
* popup to be rolled up. aListener should be set to a non-null value for * popup to be rolled up. aListener should be set to a non-null value for

View file

@ -3951,10 +3951,8 @@ uint32_t nsWindow::GetMaxTouchPoints() const {
return WinUtils::GetMaxTouchPoints(); return WinUtils::GetMaxTouchPoints();
} }
void nsWindow::SetWindowClass(const nsAString& xulWinType, void nsWindow::SetIsEarlyBlankWindow(bool aIsEarlyBlankWindow) {
const nsAString& xulWinClass, mIsEarlyBlankWindow = aIsEarlyBlankWindow;
const nsAString& xulWinName) {
mIsEarlyBlankWindow = xulWinType.EqualsLiteral("navigator:blank");
} }
/************************************************************** /**************************************************************

View file

@ -261,8 +261,7 @@ class nsWindow final : public nsBaseWidget {
const LayoutDeviceIntRegion& aRegion) override; const LayoutDeviceIntRegion& aRegion) override;
uint32_t GetMaxTouchPoints() const override; uint32_t GetMaxTouchPoints() const override;
void SetWindowClass(const nsAString& xulWinType, const nsAString& xulWinClass, void SetIsEarlyBlankWindow(bool) override;
const nsAString& xulWinName) override;
/** /**
* Event helpers * Event helpers

View file

@ -1631,30 +1631,33 @@ void AppWindow::SyncAttributesToWidget() {
NS_ENSURE_TRUE_VOID(mWindow); NS_ENSURE_TRUE_VOID(mWindow);
// Only change blank window status once we're loaded, so that a
// partially-loaded browser window doesn't start painting early.
if (mChromeLoaded) {
mWindow->SetIsEarlyBlankWindow(attr.EqualsLiteral("navigator:blank"));
NS_ENSURE_TRUE_VOID(mWindow);
}
// "icon" attribute // "icon" attribute
windowElement->GetAttribute(u"icon"_ns, attr); windowElement->GetAttribute(u"icon"_ns, attr);
if (!attr.IsEmpty()) { if (!attr.IsEmpty()) {
mWindow->SetIcon(attr); mWindow->SetIcon(attr);
NS_ENSURE_TRUE_VOID(mWindow); NS_ENSURE_TRUE_VOID(mWindow);
} }
// "drawtitle" attribute // "drawtitle" attribute
windowElement->GetAttribute(u"drawtitle"_ns, attr); windowElement->GetAttribute(u"drawtitle"_ns, attr);
mWindow->SetDrawsTitle(attr.LowerCaseEqualsLiteral("true")); mWindow->SetDrawsTitle(attr.LowerCaseEqualsLiteral("true"));
NS_ENSURE_TRUE_VOID(mWindow); NS_ENSURE_TRUE_VOID(mWindow);
// "toggletoolbar" attribute // "toggletoolbar" attribute
windowElement->GetAttribute(u"toggletoolbar"_ns, attr); windowElement->GetAttribute(u"toggletoolbar"_ns, attr);
mWindow->SetShowsToolbarButton(attr.LowerCaseEqualsLiteral("true")); mWindow->SetShowsToolbarButton(attr.LowerCaseEqualsLiteral("true"));
NS_ENSURE_TRUE_VOID(mWindow); NS_ENSURE_TRUE_VOID(mWindow);
// "macnativefullscreen" attribute // "macnativefullscreen" attribute
windowElement->GetAttribute(u"macnativefullscreen"_ns, attr); windowElement->GetAttribute(u"macnativefullscreen"_ns, attr);
mWindow->SetSupportsNativeFullscreen(attr.LowerCaseEqualsLiteral("true")); mWindow->SetSupportsNativeFullscreen(attr.LowerCaseEqualsLiteral("true"));
NS_ENSURE_TRUE_VOID(mWindow); NS_ENSURE_TRUE_VOID(mWindow);
// "macanimationtype" attribute // "macanimationtype" attribute