mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:57:36 +00:00
Ladybird: Specify window size in layout dump mode
This commit is contained in:
parent
e249d751c8
commit
12eca612bc
4 changed files with 14 additions and 6 deletions
|
@ -448,14 +448,19 @@ void WebContentView::handle_resize()
|
||||||
request_repaint();
|
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()
|
void WebContentView::update_viewport_rect()
|
||||||
{
|
{
|
||||||
auto scaled_width = int(viewport()->width() / m_inverse_pixel_scaling_ratio);
|
auto scaled_width = int(viewport()->width() / m_inverse_pixel_scaling_ratio);
|
||||||
auto scaled_height = int(viewport()->height() / 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);
|
Gfx::IntRect rect(horizontalScrollBar()->value(), verticalScrollBar()->value(), scaled_width, scaled_height);
|
||||||
|
|
||||||
m_viewport_rect = rect;
|
set_viewport_rect(rect);
|
||||||
client().async_set_viewport_rect(rect);
|
|
||||||
|
|
||||||
request_repaint();
|
request_repaint();
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,8 @@ public:
|
||||||
|
|
||||||
ErrorOr<String> dump_layout_tree();
|
ErrorOr<String> dump_layout_tree();
|
||||||
|
|
||||||
|
void set_viewport_rect(Gfx::IntRect);
|
||||||
|
|
||||||
Gfx::IntPoint to_content(Gfx::IntPoint) const;
|
Gfx::IntPoint to_content(Gfx::IntPoint) const;
|
||||||
Gfx::IntPoint to_widget(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) {
|
if (dump_layout_tree) {
|
||||||
WebContentView view({});
|
WebContentView view({});
|
||||||
|
view.set_viewport_rect(Gfx::IntRect({}, { 800, 600 }));
|
||||||
view.on_load_finish = [&](auto&) {
|
view.on_load_finish = [&](auto&) {
|
||||||
auto dump = view.dump_layout_tree().release_value_but_fixme_should_propagate_errors();
|
auto dump = view.dump_layout_tree().release_value_but_fixme_should_propagate_errors();
|
||||||
outln("{}", dump);
|
outln("{}", dump);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
InitialContainingBlock <#document> at (0,0) content-size 0x0 children: not-inline
|
InitialContainingBlock <#document> at (0,0) content-size 800x600 children: not-inline
|
||||||
BlockContainer <html> at (0,0) content-size 0x16 children: not-inline
|
BlockContainer <html> at (0,0) content-size 800x16 children: not-inline
|
||||||
BlockContainer <(anonymous)> at (0,0) content-size 0x0 children: inline
|
BlockContainer <(anonymous)> at (0,0) content-size 800x0 children: inline
|
||||||
TextNode <#text>
|
TextNode <#text>
|
||||||
BlockContainer <body> at (8,8) content-size 0x0 children: inline
|
BlockContainer <body> at (8,8) content-size 784x0 children: inline
|
||||||
TextNode <#text>
|
TextNode <#text>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue