mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-12 09:20:36 +00:00
Ladybird: Specify window size in layout dump mode
This commit is contained in:
parent
e249d751c8
commit
12eca612bc
Notes:
sideshowbarker
2024-07-17 03:27:40 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/12eca612bc Pull-request: https://github.com/SerenityOS/serenity/pull/17255
4 changed files with 14 additions and 6 deletions
|
@ -448,14 +448,19 @@ void WebContentView::handle_resize()
|
|||
request_repaint();
|
||||
}
|
||||
|
||||
void WebContentView::set_viewport_rect(Gfx::IntRect rect)
|
||||
{
|
||||
m_viewport_rect = rect;
|
||||
client().async_set_viewport_rect(rect);
|
||||
}
|
||||
|
||||
void WebContentView::update_viewport_rect()
|
||||
{
|
||||
auto scaled_width = int(viewport()->width() / m_inverse_pixel_scaling_ratio);
|
||||
auto scaled_height = int(viewport()->height() / m_inverse_pixel_scaling_ratio);
|
||||
Gfx::IntRect rect(horizontalScrollBar()->value(), verticalScrollBar()->value(), scaled_width, scaled_height);
|
||||
|
||||
m_viewport_rect = rect;
|
||||
client().async_set_viewport_rect(rect);
|
||||
set_viewport_rect(rect);
|
||||
|
||||
request_repaint();
|
||||
}
|
||||
|
|
|
@ -96,6 +96,8 @@ public:
|
|||
|
||||
ErrorOr<String> dump_layout_tree();
|
||||
|
||||
void set_viewport_rect(Gfx::IntRect);
|
||||
|
||||
Gfx::IntPoint to_content(Gfx::IntPoint) const;
|
||||
Gfx::IntPoint to_widget(Gfx::IntPoint) const;
|
||||
|
||||
|
|
|
@ -88,6 +88,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
if (dump_layout_tree) {
|
||||
WebContentView view({});
|
||||
view.set_viewport_rect(Gfx::IntRect({}, { 800, 600 }));
|
||||
view.on_load_finish = [&](auto&) {
|
||||
auto dump = view.dump_layout_tree().release_value_but_fixme_should_propagate_errors();
|
||||
outln("{}", dump);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
InitialContainingBlock <#document> at (0,0) content-size 0x0 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 0x16 children: not-inline
|
||||
BlockContainer <(anonymous)> at (0,0) content-size 0x0 children: inline
|
||||
InitialContainingBlock <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x16 children: not-inline
|
||||
BlockContainer <(anonymous)> at (0,0) content-size 800x0 children: inline
|
||||
TextNode <#text>
|
||||
BlockContainer <body> at (8,8) content-size 0x0 children: inline
|
||||
BlockContainer <body> at (8,8) content-size 784x0 children: inline
|
||||
TextNode <#text>
|
||||
|
|
Loading…
Reference in a new issue