Skip to content

Truly independent web browser

UI/Qt: Avoid reapplying unchanged stylesheets

Callum Lawf426ce36e5b6
diff --git a/UI/Qt/JavaScriptDialog.cpp b/UI/Qt/JavaScriptDialog.cpp
index 19e4f8c7f7f..805ef7f8b4b 100644
--- a/UI/Qt/JavaScriptDialog.cpp
+++ b/UI/Qt/JavaScriptDialog.cpp
@@ -505,7 +505,9 @@ void JavaScriptDialog::update_chrome_style()
return;
m_is_updating_chrome_style = true;
- setStyleSheet(ChromeStyle::javascript_dialog_style_sheet(palette()));
+ auto style_sheet = ChromeStyle::javascript_dialog_style_sheet(palette());
+ if (styleSheet() != style_sheet)
+ setStyleSheet(style_sheet);
#if !defined(AK_OS_MACOS)
if (m_panel_shadow)
m_panel_shadow->setColor(QColor(0, 0, 0, Theme::is_dark() ? 140 : 56));
diff --git a/UI/Qt/LocationEdit.cpp b/UI/Qt/LocationEdit.cpp
index 2b45094eb21..64f8f2e673f 100644
--- a/UI/Qt/LocationEdit.cpp
+++ b/UI/Qt/LocationEdit.cpp
@@ -1250,7 +1250,9 @@ void LocationEdit::update_chrome_style()
m_is_updating_chrome_style = true;
// Match the popup's palette without feeding our styled background into the next style update.
- setStyleSheet(ChromeStyle::location_edit_style_sheet(Theme::chrome_palette(*this)));
+ auto style_sheet = ChromeStyle::location_edit_style_sheet(Theme::chrome_palette(*this));
+ if (styleSheet() != style_sheet)
+ setStyleSheet(style_sheet);
m_is_updating_chrome_style = false;
update_zoom_indicator();
update_in_use_chip_icons();