From 2dd3f80618b475e1c704760c0eafa43daa3892ed Mon Sep 17 00:00:00 2001 From: nowrep Date: Thu, 6 Dec 2012 22:23:11 +0100 Subject: [PATCH] Little change to fix from previous commit 54e1bfeffa Set QPalette white background color instead of setting CSS stylesheet. --- src/lib/app/mainapplication.cpp | 2 +- src/lib/webview/webview.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index 9a9713924..af6bbbe72 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -855,7 +855,7 @@ QUrl MainApplication::userStyleSheet(const QString &filePath) const // Set default white background for all sites // Fixes issue with dark themes when sites don't set background - QString userStyle = "html{background-color:white;}"; + QString userStyle /*= "body{background-color:white;}"*/; userStyle += AdBlockManager::instance()->elementHidingRules() + "{ display:none !important;}"; QFile file(filePath); diff --git a/src/lib/webview/webview.cpp b/src/lib/webview/webview.cpp index dfa34be93..24e1a2904 100644 --- a/src/lib/webview/webview.cpp +++ b/src/lib/webview/webview.cpp @@ -137,6 +137,16 @@ void WebView::setPage(QWebPage* page) connect(m_page, SIGNAL(privacyChanged(bool)), this, SIGNAL(privacyChanged(bool))); mApp->plugins()->emitWebPageCreated(m_page); + + /* Set white background by default. + Fixes issue with dark themes. + + See #602 + */ + QPalette pal = palette(); + pal.setBrush(QPalette::Base, Qt::white); + page->setPalette(pal); + } void WebView::load(const QUrl &url)