mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
LibWeb: Only dump layout and text tree for the desired URL
Before this change, the rebaseline script would generate reference based on 'about:blank' (at least running it on my macOS system). This commit allows 'about:blank' through the assertion and only dumps the layout tree when theloaded URL matches the one we are interested in.
This commit is contained in:
parent
17b22250b6
commit
08c02ad888
Notes:
sideshowbarker
2024-07-16 22:22:13 +09:00
Author: https://github.com/pixelspark Commit: https://github.com/SerenityOS/serenity/commit/08c02ad888 Pull-request: https://github.com/SerenityOS/serenity/pull/23156
@ -282,18 +282,22 @@ static ErrorOr<TestResult> run_dump_test(HeadlessWebContentView& view, StringVie
|
||||
|
||||
if (mode == TestMode::Layout) {
|
||||
view.on_load_finish = [&](auto const& loaded_url) {
|
||||
VERIFY(url.equals(loaded_url, URL::ExcludeFragment::Yes));
|
||||
// This callback will be called for 'about:blank' first, then for the URL we actually want to dump
|
||||
VERIFY(url.equals(loaded_url, URL::ExcludeFragment::Yes) || url.equals(URL("about:blank")));
|
||||
|
||||
// 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();
|
||||
if (url.equals(loaded_url, URL::ExcludeFragment::Yes)) {
|
||||
// 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();
|
||||
|
||||
StringBuilder builder;
|
||||
builder.append(view.dump_layout_tree().release_value_but_fixme_should_propagate_errors());
|
||||
builder.append("\n"sv);
|
||||
builder.append(view.dump_paint_tree().release_value_but_fixme_should_propagate_errors());
|
||||
result = builder.to_string().release_value_but_fixme_should_propagate_errors();
|
||||
loop.quit(0);
|
||||
StringBuilder builder;
|
||||
builder.append(view.dump_layout_tree().release_value_but_fixme_should_propagate_errors());
|
||||
builder.append("\n"sv);
|
||||
builder.append(view.dump_paint_tree().release_value_but_fixme_should_propagate_errors());
|
||||
result = builder.to_string().release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
loop.quit(0);
|
||||
}
|
||||
};
|
||||
view.on_text_test_finish = {};
|
||||
} else if (mode == TestMode::Text) {
|
||||
|
Loading…
Reference in New Issue
Block a user