소스 검색

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.
Andreas Kling 3 년 전
부모
커밋
c772134e25
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      Userland/Libraries/LibWeb/DOM/Document.cpp

+ 2 - 0
Userland/Libraries/LibWeb/DOM/Document.cpp

@@ -445,6 +445,8 @@ static void update_style_recursively(DOM::Node& node)
 
 
 void Document::update_style()
 void Document::update_style()
 {
 {
+    if (!browsing_context())
+        return;
     update_style_recursively(*this);
     update_style_recursively(*this);
     update_layout();
     update_layout();
 }
 }