Skip to content

Commit 183d5e7

Browse files
committed
GUI - fix scrollbar errors
1 parent 3f28ec1 commit 183d5e7

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

gui/widgets/sandboxedwebview.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,22 @@ void SandboxedWebView::insertStyleSheet(const QString &name, const QString &sour
9999
{
100100
QWebEngineScript script;
101101
QString s = QString::fromLatin1("(function() {"
102-
" css = document.createElement('style');"
103-
" css.type = 'text/css';"
104-
" css.id = '%1';"
105-
" document.head.appendChild(css);"
106-
" css.innerText = '%2';"
102+
" var existingStyle = document.getElementById('%1');"
103+
" if (existingStyle) {"
104+
" existingStyle.innerText = '%2';"
105+
" } else {"
106+
" var css = document.createElement('style');"
107+
" css.type = 'text/css';"
108+
" css.id = '%1';"
109+
" css.innerText = '%2';"
110+
" document.head.appendChild(css);"
111+
" }"
107112
"})()")
108113
.arg(name)
109114
.arg(source.simplified());
110-
115+
111116
this->page()->runJavaScript(s, QWebEngineScript::ApplicationWorld);
112-
117+
113118
script.setName(name);
114119
script.setSourceCode(s);
115120
script.setInjectionPoint(QWebEngineScript::DocumentReady);

0 commit comments

Comments
 (0)