diff options
author | Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com> | 2023-01-30 23:38:19 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-02-06 20:42:14 +0100 |
commit | 12eca612bc146e50beb8107e893e05b92a5c1234 (patch) | |
tree | f8aa12c98c2094360a4b33051d0a3f36f77ec439 /Ladybird | |
parent | e249d751c8cdc2f65bed4c998f790d8f4bcbc66a (diff) | |
download | serenity-12eca612bc146e50beb8107e893e05b92a5c1234.zip |
Ladybird: Specify window size in layout dump mode
Diffstat (limited to 'Ladybird')
-rw-r--r-- | Ladybird/WebContentView.cpp | 9 | ||||
-rw-r--r-- | Ladybird/WebContentView.h | 2 | ||||
-rw-r--r-- | Ladybird/main.cpp | 1 |
3 files changed, 10 insertions, 2 deletions
diff --git a/Ladybird/WebContentView.cpp b/Ladybird/WebContentView.cpp index 71666bf510..df7dab4ea3 100644 --- a/Ladybird/WebContentView.cpp +++ b/Ladybird/WebContentView.cpp @@ -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(); } diff --git a/Ladybird/WebContentView.h b/Ladybird/WebContentView.h index 008e51b44a..7b81f64c7e 100644 --- a/Ladybird/WebContentView.h +++ b/Ladybird/WebContentView.h @@ -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; diff --git a/Ladybird/main.cpp b/Ladybird/main.cpp index 1e8c0aa5e6..b6fa18b614 100644 --- a/Ladybird/main.cpp +++ b/Ladybird/main.cpp @@ -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); |