diff --git a/Libraries/LibWeb/Painting/PaintableBox.cpp b/Libraries/LibWeb/Painting/PaintableBox.cpp index 821f3702bcf..0a5f20b19f1 100644 --- a/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -1537,7 +1537,8 @@ void PaintableBox::resolve_paint_properties() // Section 2.11.2: If the computed value of background-image on the root element is none and its background-color is transparent, // user agents must instead propagate the computed values of the background properties from that element’s first HTML BODY child element. - if (document().html_element()->should_use_body_background_properties()) { + auto& html_element = as(*layout_node_with_style_and_box_metrics().dom_node()); + if (html_element.should_use_body_background_properties()) { background_layers = document().background_layers(); background_color = document().background_color(); } diff --git a/Tests/LibWeb/Crash/SVG/foreignObject-with-html-root-element.svg b/Tests/LibWeb/Crash/SVG/foreignObject-with-html-root-element.svg new file mode 100644 index 00000000000..c6d6e02436f --- /dev/null +++ b/Tests/LibWeb/Crash/SVG/foreignObject-with-html-root-element.svg @@ -0,0 +1,6 @@ + + + + + +