From b6703d1189de13eb0f55333ef42cb769d121fd2b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 14 Jun 2018 00:16:09 +0200 Subject: [PATCH] Avoid unnecessary CSS updates --- qutebrowser/javascript/stylesheet.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/qutebrowser/javascript/stylesheet.js b/qutebrowser/javascript/stylesheet.js index b1cdeb26e..daa51ca12 100644 --- a/qutebrowser/javascript/stylesheet.js +++ b/qutebrowser/javascript/stylesheet.js @@ -113,14 +113,19 @@ window._qutebrowser.stylesheet = (function() { if (!initialized) { init(); } + + if (css_content === css) { + return; + } + + css_content = css; + if (style_elem) { style_elem.textContent = css; // The browser seems to rewrite the document in same-origin frames // without notifying the mutation observer. Ensure that the // stylesheet is in the current document. watch_root(); - } else { - css_content = css; } // Propagate the new CSS to all child frames. // FIXME:qtwebengine This does not work for cross-origin frames.