| 115 | } |
| 116 | |
| 117 | void insertStyleSheet(QWebEngineProfile *profile, const QString &name, const QString &source) |
| 118 | { |
| 119 | QWebEngineScript script; |
| 120 | QString s = QString::fromLatin1("(function() {"\ |
| 121 | " css = document.createElement('style');"\ |
| 122 | " css.type = 'text/css';"\ |
| 123 | " css.id = '%1';"\ |
| 124 | " document.head.appendChild(css);"\ |
| 125 | " css.innerText = '%2';"\ |
| 126 | "})()").arg(name).arg(source.simplified()); |
| 127 | |
| 128 | script.setName(name); |
| 129 | script.setSourceCode(s); |
| 130 | script.setInjectionPoint(QWebEngineScript::DocumentReady); |
| 131 | script.setRunsOnSubFrames(true); |
| 132 | script.setWorldId(QWebEngineScript::ApplicationWorld); |
| 133 | profile->scripts()->insert(script); |
| 134 | } |
| 135 | |
| 136 | void insertScrollbarStyleSheet(QWebEngineProfile *profile) |
| 137 | { |
no test coverage detected