From c772134e25c3364ff034544884039926ff47c581 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 26 Sep 2021 00:48:30 +0200 Subject: [PATCH] LibWeb: Make update_style() a no-op if there's no browsing context Style is needed to lay out and paint a document, but we can't do either those when the document isn't attached to a browsing context. --- Userland/Libraries/LibWeb/DOM/Document.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 09fcff2c88..451165ff42 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -445,6 +445,8 @@ static void update_style_recursively(DOM::Node& node) void Document::update_style() { + if (!browsing_context()) + return; update_style_recursively(*this); update_layout(); }