Truly independent web browser
UI/Qt: Make the card that restores tabs a general card over the page
Jelle Raaijmakersb82d15af24d3
diff --git a/UI/Qt/Application.cpp b/UI/Qt/Application.cppindex 5c7c5a90dca..04fc5f30d82 100644--- a/UI/Qt/Application.cpp+++ b/UI/Qt/Application.cpp@@ -58,6 +58,7 @@#include <UI/Qt/ExternalURLHandler.h>#include <UI/Qt/HistoryPage.h>#include <UI/Qt/Menu.h>+#include <UI/Qt/PageCard.h>#include <UI/Qt/PictureInPictureWindow.h>#include <UI/Qt/PlainText.h>#include <UI/Qt/ProcessManagerWindow.h>@@ -1551,6 +1552,7 @@ BrowserWindow* Application::restore_previous_session(WindowConfiguration const&return frontmost_window;}+// After Ladybird quit unexpectedly, a card over the top of the page offers to restore the tabs that were open.void Application::offer_to_restore_unexpectedly_closed_tabs(BrowserWindow& window){auto& store = session_store(WebView::IsPrivate::No);@@ -1568,7 +1570,7 @@ void Application::offer_to_restore_unexpectedly_closed_tabs(BrowserWindow& windoif (unit_ids.is_empty() || !window.current_tab())return;- window.current_tab()->show_restore_session_card(tab_count, [window = QPointer<BrowserWindow>(&window), unit_ids = AK::move(unit_ids)] {+ auto restore_tabs = [window = QPointer<BrowserWindow>(&window), unit_ids = AK::move(unit_ids)] {// A window that still shows only the new tab page it opened with is taken over by the tabs restored first.QPointer<Tab> new_tab_page;if (window && window->tab_count() == 1) {@@ -1585,7 +1587,12 @@ void Application::offer_to_restore_unexpectedly_closed_tabs(BrowserWindow& windoif (new_tab_page && window->tab_count() > 1)window->close_tab_without_keeping_it(window->tab_index(new_tab_page));- });+ };+ auto question = tab_count == 1 ? QStringLiteral("Restore the tab you had open?") : qformatted("Restore the {} tabs you had open?", tab_count);+ Vector<PageCard::Button> buttons;+ buttons.append({ "Not now", PageCard::ButtonRole::Secondary, {} });+ buttons.append({ "Restore tabs", PageCard::ButtonRole::Primary, AK::move(restore_tabs) });+ window.show_page_card(BrowserWindow::PageCardSlot::RestoreSession, "Ladybird quit unexpectedly", question, AK::move(buttons));}void Application::open_startup_tabs(BrowserWindow& window, Vector<URL::URL> const& urls)diff --git a/UI/Qt/BrowserWindow.cpp b/UI/Qt/BrowserWindow.cppindex befc087818a..b259d1e6f18 100644--- a/UI/Qt/BrowserWindow.cpp+++ b/UI/Qt/BrowserWindow.cpp@@ -1151,9 +1151,52 @@ void BrowserWindow::set_current_tab(Tab* tab)session().active_tab_changed(*session_tab_id);}+ reposition_page_cards();Application::the().report_active_view();}+void BrowserWindow::show_page_card(PageCardSlot slot, QString const& title, QString const& text, Vector<PageCard::Button> buttons)+{+ auto& card = m_page_cards[to_underlying(slot)];+ if (card)+ card->deleteLater();+ card = new PageCard(*m_tabs_container, title, text, AK::move(buttons));+ QObject::connect(card, &QObject::destroyed, this, [this] {+ QTimer::singleShot(0, this, [this] { reposition_page_cards(); });+ });+ if (m_page_cards_view)+ m_page_cards_view->add_floating_surface(*card);+ card->show();+ // The shadow of a card follows where the card moves while it is shown, so the card only moves once it is.+ reposition_page_cards();+}++// The cards stack from the top of the page down, in the order of their slots.+void BrowserWindow::reposition_page_cards()+{+ static constexpr int CARD_SPACING = 10;++ // The cards float over the page of the current tab alone.+ auto* view = m_current_tab ? &m_current_tab->view() : nullptr;+ if (m_page_cards_view != view) {+ for (auto& card : m_page_cards) {+ if (card && m_page_cards_view)+ m_page_cards_view->remove_floating_surface(*card);+ if (card && view)+ view->add_floating_surface(*card);+ }+ m_page_cards_view = view;+ }++ int top_offset = 0;+ for (auto& card : m_page_cards) {+ if (!card || !view)+ continue;+ card->reposition(*view, top_offset);+ top_offset += card->height() + CARD_SPACING;+ }+}+void BrowserWindow::activate_tab(int index){m_tabs_container->set_current_index(index);diff --git a/UI/Qt/BrowserWindow.h b/UI/Qt/BrowserWindow.hindex f430bfd0de7..5ec872847c7 100644--- a/UI/Qt/BrowserWindow.h+++ b/UI/Qt/BrowserWindow.h@@ -7,6 +7,7 @@#pragma once+#include <AK/Array.h>#include <AK/Optional.h>#include <AK/kmalloc.h>#include <LibURL/URL.h>@@ -17,6 +18,7 @@#include <LibWebView/Settings.h>#include <UI/Qt/FullscreenDebounce.h>#include <UI/Qt/MacWindow.h>+#include <UI/Qt/PageCard.h>#include <UI/Qt/SessionStore.h>#include <UI/Qt/Tab.h>#include <UI/Qt/TabBar.h>@@ -183,6 +185,13 @@ public:// Opens a window's restored tabs, keeping the session rows the store re-adopted for them.void restore_tabs(Vector<RestoredSessionTab> const&, i64 active_tab_index);Tab* current_tab() const { return m_current_tab; }++ enum class PageCardSlot : u8 {+ RestoreSession,+ };+ void show_page_card(PageCardSlot, QString const& title, QString const& text, Vector<PageCard::Button>);+ void reposition_page_cards();+Tab* activate_tab_with_url(URL::URL const&, URL::ExcludeFragment);// Asks every tab's page if the window may close, without closing it, and reports the answer. Once the pages agree,// a close() goes straight through.@@ -330,6 +339,8 @@ private:TabWidget* m_tabs_container { nullptr };Tab* m_current_tab { nullptr };+ Array<QPointer<PageCard>, 1> m_page_cards;+ QPointer<WebContentView> m_page_cards_view;Vector<QPointer<Tab>> m_background_tabs_from_current_tab;DevToolsBanner* m_devtools_banner { nullptr };diff --git a/UI/Qt/CMakeLists.txt b/UI/Qt/CMakeLists.txtindex 28650a109a8..09c51932b74 100644--- a/UI/Qt/CMakeLists.txt+++ b/UI/Qt/CMakeLists.txt@@ -46,6 +46,7 @@ add_library(ladybird_impl STATICMenu.cppNativeTextEditingLineEdit.cppNativeWindowContainer.cpp+ PageCard.cppPerformanceMonitorWidget.cppPermissionPromptPopover.cppPictureInPictureWindow.cpp@@ -55,7 +56,6 @@ add_library(ladybird_impl STATICRemoteDownloads.cppRemoteView.cppReportReview.cpp- RestoreSessionCard.cppSandboxOffBar.cppScreenshotSelectionOverlay.cppScreenshotViewer.cppdiff --git a/UI/Qt/ChromeStyle.cpp b/UI/Qt/ChromeStyle.cppindex 344060f10bb..f200071c276 100644--- a/UI/Qt/ChromeStyle.cpp+++ b/UI/Qt/ChromeStyle.cpp@@ -2115,33 +2115,33 @@ QPushButton:pressed {{style_sheet_color(primary), style_sheet_color(primary.darker(110)), style_sheet_color(primary.darker(122)));}-QString restore_session_card_style_sheet()+QString page_card_style_sheet(){auto const& panel = Theme::panel();auto primary = Theme::primary();return qformatted(R"(-QFrame#LadybirdRestoreSessionCard {{+QFrame#LadybirdPageCard {{color: {0};background: {1};border: 0;border-radius: 12px;}}-QFrame#LadybirdRestoreSessionCard QLabel {{+QFrame#LadybirdPageCard QLabel {{background: transparent;font-size: 13px;}}-QLabel#LadybirdRestoreSessionTitle {{+QLabel#LadybirdPageCardTitle {{color: {0};font-weight: 600;}}-QLabel#LadybirdRestoreSessionQuestion {{+QLabel#LadybirdPageCardText {{color: {2};}}-QFrame#LadybirdRestoreSessionCard QPushButton {{+QFrame#LadybirdPageCard QPushButton {{border: 0;border-radius: 7px;min-height: 28px;@@ -2149,26 +2149,26 @@ QFrame#LadybirdRestoreSessionCard QPushButton {{font-size: 13px;}}-QPushButton#LadybirdRestoreSessionNotNow {{+QPushButton#LadybirdPageCardSecondaryButton {{color: {0};background: {3};}}-QPushButton#LadybirdRestoreSessionNotNow:pressed {{+QPushButton#LadybirdPageCardSecondaryButton:pressed {{background: {4};}}-QPushButton#LadybirdRestoreSessionRestore {{+QPushButton#LadybirdPageCardPrimaryButton {{color: #ffffff;background: {5};font-weight: 500;}}-QPushButton#LadybirdRestoreSessionRestore:hover {{+QPushButton#LadybirdPageCardPrimaryButton:hover {{background: {6};}}-QPushButton#LadybirdRestoreSessionRestore:pressed {{+QPushButton#LadybirdPageCardPrimaryButton:pressed {{background: {7};}})",diff --git a/UI/Qt/ChromeStyle.h b/UI/Qt/ChromeStyle.hindex fdfdfdd34a7..7a7ae92694f 100644--- a/UI/Qt/ChromeStyle.h+++ b/UI/Qt/ChromeStyle.h@@ -119,7 +119,7 @@ QString primary_button_style_sheet();// Installs the application style, which keeps the platform's look but follows the design's timing.void install_application_style();-QString restore_session_card_style_sheet();+QString page_card_style_sheet();QString screenshot_selection_style_sheet(QPalette const&);QString screenshot_viewer_style_sheet();diff --git a/UI/Qt/PageCard.cpp b/UI/Qt/PageCard.cppnew file mode 100644index 00000000000..6531909c1e8--- /dev/null+++ b/UI/Qt/PageCard.cpp@@ -0,0 +1,108 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#include <UI/Qt/ChromeStyle.h>+#include <UI/Qt/PageCard.h>+#include <UI/Qt/Popover.h>+#include <UI/Qt/Theme.h>++#include <QEvent>+#include <QHBoxLayout>+#include <QLabel>+#include <QPushButton>+#include <QVBoxLayout>++#if defined(AK_OS_MACOS)+# include <UI/Qt/MacWindow.h>+#endif++namespace Ladybird {++// A card over the top of the page tells the user something, with buttons that each close it. The card is a native+// child of the window, so it stacks above the native view of each tab's page once it is raised above it.+static constexpr int CARD_WIDTH = 580;+static constexpr int CARD_CORNER_RADIUS = 12;+static constexpr int PAGE_TOP_INSET = 22;++PageCard::PageCard(QWidget& parent, QString const& title, QString const& text, Vector<Button> buttons)+ : QFrame(&parent)+{+ setObjectName("LadybirdPageCard");+ setAccessibleName(title);+#if defined(AK_OS_MACOS)+ setAttribute(Qt::WA_DontCreateNativeAncestors);+ setAttribute(Qt::WA_NativeWindow);+#endif+ setFixedWidth(CARD_WIDTH);+ cast_floating_shadow(*this, CARD_CORNER_RADIUS);++ auto* layout = new QHBoxLayout(this);+ layout->setContentsMargins(18, 14, 14, 14);+ layout->setSpacing(14);++ auto* texts = new QVBoxLayout;+ texts->setSpacing(3);+ auto* title_label = new QLabel(title, this);+ title_label->setObjectName("LadybirdPageCardTitle");+ texts->addWidget(title_label);+ auto* text_label = new QLabel(text, this);+ text_label->setObjectName("LadybirdPageCardText");+ text_label->setWordWrap(true);+ text_label->setTextInteractionFlags(Qt::TextSelectableByMouse);+ texts->addWidget(text_label);+ layout->addLayout(texts, 1);++ for (auto& button : buttons) {+ auto* push_button = new QPushButton(button.label, this);+ auto is_primary = button.role == ButtonRole::Primary;+ push_button->setObjectName(is_primary ? "LadybirdPageCardPrimaryButton" : "LadybirdPageCardSecondaryButton");+ push_button->setDefault(is_primary);+ QObject::connect(push_button, &QPushButton::clicked, this, [this, on_click = AK::move(button.on_click)] {+ if (on_click)+ on_click();+ deleteLater();+ });+ layout->addWidget(push_button);+ }++ update_chrome_style();+ adjustSize();+}++void PageCard::reposition(QWidget& page, int top_offset)+{+ if (m_page != &page)+ raise();+ m_page = &page;+ auto page_top_left = page.mapTo(parentWidget(), QPoint(0, 0));+ auto position = QPoint(page_top_left.x() + ((page.width() - width()) / 2), page_top_left.y() + PAGE_TOP_INSET + top_offset);+ if (pos() != position)+ move(position);+}++bool PageCard::event(QEvent* event)+{+ if (event->type() == QEvent::PaletteChange)+ update_chrome_style();+ return QFrame::event(event);+}++void PageCard::showEvent(QShowEvent* event)+{+ QFrame::showEvent(event);+#if defined(AK_OS_MACOS)+ round_appkit_view_corners(*this, CARD_CORNER_RADIUS, Theme::panel().edge);+#endif+}++void PageCard::update_chrome_style()+{+ // NB: Setting a style sheet changes the palette, so it is only set when it changed, or it would set itself forever.+ if (auto style_sheet = ChromeStyle::page_card_style_sheet(); styleSheet() != style_sheet)+ setStyleSheet(style_sheet);+}++}diff --git a/UI/Qt/PageCard.h b/UI/Qt/PageCard.hnew file mode 100644index 00000000000..a24645f7244--- /dev/null+++ b/UI/Qt/PageCard.h@@ -0,0 +1,47 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#pragma once++#include <AK/Function.h>+#include <AK/Vector.h>+#include <AK/kmalloc.h>++#include <QFrame>+#include <QPointer>+#include <QString>++namespace Ladybird {++class PageCard final : public QFrame {+public:+ AK_ALLOC_WITH_KMALLOC;++ enum class ButtonRole : u8 {+ Secondary,+ Primary,+ };++ struct Button {+ QString label;+ ButtonRole role { ButtonRole::Secondary };+ Function<void()> on_click;+ };++ PageCard(QWidget& parent, QString const& title, QString const& text, Vector<Button>);++ void reposition(QWidget& page, int top_offset);++private:+ virtual bool event(QEvent*) override;+ virtual void showEvent(QShowEvent*) override;++ void update_chrome_style();++ QPointer<QWidget> m_page;+};++}diff --git a/UI/Qt/RestoreSessionCard.cpp b/UI/Qt/RestoreSessionCard.cppdeleted file mode 100644index dc806885f9c..00000000000--- a/UI/Qt/RestoreSessionCard.cpp+++ /dev/null@@ -1,108 +0,0 @@-/*- * Copyright (c) 2026-present, the Ladybird developers.- *- * SPDX-License-Identifier: BSD-2-Clause- */--#include <UI/Qt/ChromeStyle.h>-#include <UI/Qt/Popover.h>-#include <UI/Qt/RestoreSessionCard.h>-#include <UI/Qt/StringUtils.h>-#include <UI/Qt/Theme.h>--#include <QEvent>-#include <QHBoxLayout>-#include <QLabel>-#include <QPushButton>-#include <QVBoxLayout>--#if defined(AK_OS_MACOS)-# include <UI/Qt/MacWindow.h>-#endif--namespace Ladybird {--// The card is a native child of the tab, so it stacks above the native view the page is presented in.-static constexpr int CARD_WIDTH = 580;-static constexpr int CARD_CORNER_RADIUS = 12;-static constexpr int PAGE_TOP_INSET = 22;--RestoreSessionCard::RestoreSessionCard(QWidget& parent, QWidget& page, size_t tab_count)- : QFrame(&parent)- , m_page(page)-{- setObjectName("LadybirdRestoreSessionCard");- setAccessibleName("Ladybird quit unexpectedly");-#if defined(AK_OS_MACOS)- setAttribute(Qt::WA_DontCreateNativeAncestors);- setAttribute(Qt::WA_NativeWindow);-#endif- setFixedWidth(CARD_WIDTH);- cast_floating_shadow(*this, CARD_CORNER_RADIUS);-- auto* layout = new QHBoxLayout(this);- layout->setContentsMargins(18, 14, 14, 14);- layout->setSpacing(14);-- auto* text = new QVBoxLayout;- text->setSpacing(3);- auto* title = new QLabel("Ladybird quit unexpectedly", this);- title->setObjectName("LadybirdRestoreSessionTitle");- text->addWidget(title);- auto* question = new QLabel(tab_count == 1 ? QStringLiteral("Restore the tab you had open?") : qformatted("Restore the {} tabs you had open?", tab_count), this);- question->setObjectName("LadybirdRestoreSessionQuestion");- text->addWidget(question);- layout->addLayout(text, 1);-- auto* not_now_button = new QPushButton("Not now", this);- not_now_button->setObjectName("LadybirdRestoreSessionNotNow");- QObject::connect(not_now_button, &QPushButton::clicked, this, [this] { deleteLater(); });- layout->addWidget(not_now_button);-- auto* restore_button = new QPushButton("Restore tabs", this);- restore_button->setObjectName("LadybirdRestoreSessionRestore");- restore_button->setDefault(true);- QObject::connect(restore_button, &QPushButton::clicked, this, [this] {- if (on_restore)- on_restore();- deleteLater();- });- layout->addWidget(restore_button);-- update_chrome_style();- adjustSize();-}--void RestoreSessionCard::reposition()-{- auto page_top_left = m_page.mapTo(parentWidget(), QPoint(0, 0));- auto position = QPoint(page_top_left.x() + ((m_page.width() - width()) / 2), page_top_left.y() + PAGE_TOP_INSET);- if (pos() != position)- move(position);-}--bool RestoreSessionCard::event(QEvent* event)-{- if (event->type() == QEvent::PaletteChange)- update_chrome_style();- return QFrame::event(event);-}--void RestoreSessionCard::showEvent(QShowEvent* event)-{- QFrame::showEvent(event);- reposition();- raise();-#if defined(AK_OS_MACOS)- round_appkit_view_corners(*this, CARD_CORNER_RADIUS, Theme::panel().edge);-#endif-}--void RestoreSessionCard::update_chrome_style()-{- // NB: Setting a style sheet changes the palette, so it is only set when it changed, or it would set itself forever.- if (auto style_sheet = ChromeStyle::restore_session_card_style_sheet(); styleSheet() != style_sheet)- setStyleSheet(style_sheet);-}--}diff --git a/UI/Qt/RestoreSessionCard.h b/UI/Qt/RestoreSessionCard.hdeleted file mode 100644index 93e7e75f549..00000000000--- a/UI/Qt/RestoreSessionCard.h+++ /dev/null@@ -1,38 +0,0 @@-/*- * Copyright (c) 2026-present, the Ladybird developers.- *- * SPDX-License-Identifier: BSD-2-Clause- */--#pragma once--#include <AK/Function.h>-#include <AK/kmalloc.h>--#include <QFrame>--class QLabel;--namespace Ladybird {--// After Ladybird quit unexpectedly, a card over the top of the page offers to restore the tabs that were open.-class RestoreSessionCard final : public QFrame {-public:- AK_ALLOC_WITH_KMALLOC;-- RestoreSessionCard(QWidget& parent, QWidget& page, size_t tab_count);-- void reposition();-- Function<void()> on_restore;--private:- virtual bool event(QEvent*) override;- virtual void showEvent(QShowEvent*) override;-- void update_chrome_style();-- QWidget& m_page;-};--}diff --git a/UI/Qt/Tab.cpp b/UI/Qt/Tab.cppindex e0863e483f1..255b539f9ba 100644--- a/UI/Qt/Tab.cpp+++ b/UI/Qt/Tab.cpp@@ -35,7 +35,6 @@#include <UI/Qt/Motion.h>#include <UI/Qt/PermissionPromptPopover.h>#include <UI/Qt/Popover.h>-#include <UI/Qt/RestoreSessionCard.h>#include <UI/Qt/SiteSettingsPopover.h>#include <UI/Qt/StringUtils.h>#include <UI/Qt/SystemAppearance.h>@@ -1411,8 +1410,7 @@ bool Tab::eventFilter(QObject* watched, QEvent* event)if (watched == m_view && (event->type() == QEvent::Resize || event->type() == QEvent::Move)) {if (m_find_in_page->isVisible())m_find_in_page->reposition();- if (m_restore_session_card)- m_restore_session_card->reposition();+ m_window->reposition_page_cards();}if (watched == m_location_edit && event->type() == QEvent::DynamicPropertyChange && static_cast<QDynamicPropertyChangeEvent*>(event)->propertyName() == "autocompleteOpen")m_view->set_suggestions_over_page(m_location_edit->property("autocompleteOpen").toBool());@@ -1640,16 +1638,6 @@ void Tab::position_private_session_popover()move_popover_below(*m_private_session_popover, m_window->ladybird_button(), PopoverAlignment::Leading, m_window->ladybird_button().tile_rect());}-void Tab::show_restore_session_card(size_t tab_count, Function<void()> on_restore)-{- if (m_restore_session_card)- m_restore_session_card->deleteLater();- m_restore_session_card = new RestoreSessionCard(*this, *m_view, tab_count);- m_view->add_floating_surface(*m_restore_session_card);- m_restore_session_card->on_restore = AK::move(on_restore);- m_restore_session_card->show();-}-void Tab::show_find_in_page(){m_find_in_page->setVisible(true);diff --git a/UI/Qt/Tab.h b/UI/Qt/Tab.hindex 68d2e6c19da..5184decb636 100644--- a/UI/Qt/Tab.h+++ b/UI/Qt/Tab.h@@ -46,7 +46,6 @@ namespace Ladybird {class BookmarkPopover;class BrowserWindow;enum class ChromeIcon;-class RestoreSessionCard;class JavaScriptDialog;class MessagePopover;@@ -115,7 +114,6 @@ public:void open_file();void show_find_in_page();- void show_restore_session_card(size_t tab_count, Function<void()> on_restore);void find_previous();void find_next();@@ -226,7 +224,6 @@ private:QPointer<LocationEdit> m_location_edit;WebContentView* m_view { nullptr };FindInPageWidget* m_find_in_page { nullptr };- QPointer<RestoreSessionCard> m_restore_session_card;Optional<WakeLock::DisplaySleepInhibitor> m_screen_display_sleep_inhibitor;BrowserWindow* m_window { nullptr };QString m_title;diff --git a/UI/Qt/WebContentView.cpp b/UI/Qt/WebContentView.cppindex d8374e9ab92..1f1e64cccb1 100644--- a/UI/Qt/WebContentView.cpp+++ b/UI/Qt/WebContentView.cpp@@ -1812,8 +1812,29 @@ private:void WebContentView::add_floating_surface(QWidget& surface){- m_floating_surfaces.append(&surface);- new FloatingSurfaceWatcher(surface, [this] { schedule_repaint(); });+ if (any_of(m_floating_surfaces, [&](auto const& floating) { return floating.surface == &surface; }))+ return;+ auto* watcher = new FloatingSurfaceWatcher(surface, [view = QPointer { this }] {+ if (view)+ view->schedule_repaint();+ });+ m_floating_surfaces.append({ .surface = &surface, .watcher = watcher });++ // A surface that already shows gets no event of being shown over this view.+ if (surface.isVisible())+ schedule_repaint();+}++void WebContentView::remove_floating_surface(QWidget& surface)+{+ auto removed = m_floating_surfaces.remove_all_matching([&](auto const& floating) {+ if (floating.surface != &surface)+ return false;+ delete floating.watcher.data();+ return true;+ });+ if (removed)+ schedule_repaint();}void WebContentView::set_suggestions_over_page(bool suggestions_over_page)@@ -1826,7 +1847,7 @@ void WebContentView::set_suggestions_over_page(bool suggestions_over_page)bool WebContentView::has_floating_surface_over_page() const{- return m_suggestions_over_page || any_of(m_floating_surfaces, [](auto const& surface) { return surface && surface->isVisible(); });+ return m_suggestions_over_page || any_of(m_floating_surfaces, [](auto const& floating) { return floating.surface && floating.surface->isVisible(); });}// Overlays are painted by Qt, underneath whatever presents the page on some platforms, which has to step aside for them.diff --git a/UI/Qt/WebContentView.h b/UI/Qt/WebContentView.hindex 971db8a0c1d..5eb4f846287 100644--- a/UI/Qt/WebContentView.h+++ b/UI/Qt/WebContentView.h@@ -178,6 +178,7 @@ public:// A card that floats over the page, such as the find bar. Qt paints it above the page, so whatever presents the// page above Qt's painting steps aside while it shows.void add_floating_surface(QWidget&);+ void remove_floating_surface(QWidget&);// The address field's suggestions float over the page as such a card does, but outlive the view, as they belong to// the window.void set_suggestions_over_page(bool);@@ -354,7 +355,11 @@ private:bool m_tab_preview_is_stale { true };bool m_tab_preview_request_in_flight { false };QPointer<ScreenshotViewer> m_screenshot_viewer;- Vector<QPointer<QWidget>> m_floating_surfaces;+ struct FloatingSurface {+ QPointer<QWidget> surface;+ QPointer<QObject> watcher;+ };+ Vector<FloatingSurface> m_floating_surfaces;bool m_suggestions_over_page { false };PageOverlay* m_web_compat_report_overlay { nullptr };