diff --git a/Tests/LibWeb/Layout/expected/svg/svg-as-image.txt b/Tests/LibWeb/Layout/expected/svg/svg-as-image.txt index e4f6f5a22f..d81b3ad3e1 100644 --- a/Tests/LibWeb/Layout/expected/svg/svg-as-image.txt +++ b/Tests/LibWeb/Layout/expected/svg/svg-as-image.txt @@ -3,8 +3,8 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (8,8) content-size 784x1568 children: not-inline ImageBox at (8,8) content-size 784x1568 children: not-inline (SVG-as-image isolated context) - Viewport <#document> at (0,0) content-size 0x0 children: inline - SVGSVGBox at (0,0) content-size 0x0 [SVG] children: inline + Viewport <#document> at (0,0) content-size 784x1568 children: inline + SVGSVGBox at (0,0) content-size 784x1568 [SVG] children: inline TextNode <#text> - SVGGeometryBox at (0,0) content-size 0x0 children: not-inline + SVGGeometryBox at (-0.000007,-0.000015) content-size 784x1568 children: not-inline TextNode <#text> diff --git a/Userland/Utilities/headless-browser.cpp b/Userland/Utilities/headless-browser.cpp index e1ebbb48ba..5e92f3c64b 100644 --- a/Userland/Utilities/headless-browser.cpp +++ b/Userland/Utilities/headless-browser.cpp @@ -198,6 +198,10 @@ static ErrorOr run_one_test(HeadlessWebContentView& view, StringView inp if (mode == TestMode::Layout) { view.on_load_finish = [&](auto const&) { + // NOTE: We take a screenshot here to force the lazy layout of SVG-as-image documents to happen. + // It also causes a lot more code to run, which is good for finding bugs. :^) + (void)view.take_screenshot(); + result = view.dump_layout_tree().release_value_but_fixme_should_propagate_errors(); loop.quit(0); }; @@ -440,6 +444,7 @@ ErrorOr serenity_main(Main::Arguments arguments) if (dump_layout_tree) { view->on_load_finish = [&](auto const&) { + (void)view->take_screenshot(); auto layout_tree = view->dump_layout_tree().release_value_but_fixme_should_propagate_errors(); out("{}", layout_tree);