Menu popup: visibility, zoom sync, and tab fixes

Track menu popup visibility and propagate zoom level to the popup. Add menu_popup_visible_ flag, SendMenuPopupZoom(), and call it when creating/showing the popup and when adjusting zoom. Make CreateNewTab accept an optional URL and route popup/new-tab flows to it. Prevent per-tab child closes from triggering app shutdown by tracking closing_tab_browsers_ and adding ForgetClosingTabBrowser(). Treat MenuPopup role specially when enabling frame hit-testing.

Platform: remove usage of ApplyRoundedBrowserRegion and switch menu popup sizing to use resized client_size helpers (consolidate calculations across Win/Mac/Linux). UI: update menu-popup CSS/JS (new styling, font, zoom formatting API via NebulaMenuPopup.setZoomLevel), wire settings to use nebulaNative.postMessage for new-tab, and remove the static menu-popup.html. Misc: small chrome CSS/JS tweaks and ensure chrome state includes zoomLevel.
This commit is contained in:
Andrew Zambazos
2026-05-18 18:28:20 +12:00
parent e51594a010
commit c514e4faec
14 changed files with 156 additions and 130 deletions
+5 -1
View File
@@ -41,7 +41,7 @@ public:
bool ShouldBypassInsecureWarning(CefRefPtr<CefBrowser> browser, const std::string& target_url) override;
private:
void CreateNewTab();
void CreateNewTab(std::string url = {});
void ActivateTab(int tab_id);
void CloseTab(int tab_id);
void CreateChromeBrowser();
@@ -50,6 +50,7 @@ private:
void CloseMenuPopup();
void CreateMenuPopupBrowser();
void PositionMenuPopup();
void SendMenuPopupZoom();
void ToggleDevTools();
void AdjustZoom(double delta);
void FreshReload();
@@ -60,12 +61,14 @@ private:
void InjectSettingsHistory(CefRefPtr<CefBrowser> browser);
void PersistSession() const;
void MaybeFinishShutdown();
bool ForgetClosingTabBrowser(CefRefPtr<CefBrowser> browser);
nebula::platform::AppStartup startup_;
std::string initial_url_;
bool closing_ = false;
bool chrome_ready_ = false;
bool content_fullscreen_ = false;
bool menu_popup_visible_ = false;
std::unique_ptr<nebula::window::NebulaWindow> window_;
nebula::browser::TabManager tabs_;
@@ -74,6 +77,7 @@ private:
CefRefPtr<nebula::cef::NebulaBrowserClient> chrome_client_;
CefRefPtr<nebula::cef::NebulaBrowserClient> content_client_;
CefRefPtr<nebula::cef::NebulaBrowserClient> menu_popup_client_;
std::vector<CefRefPtr<CefBrowser>> closing_tab_browsers_;
std::unordered_set<std::string> insecure_warning_bypasses_;
std::vector<std::string> site_history_;
};