1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:47:45 +00:00

WebContent: Store and provide access to web page content size

This commit is contained in:
Timothy Flynn 2022-11-05 12:28:23 -04:00 committed by Linus Groh
parent 2ba2e6ca0a
commit 2f5ceeac62
2 changed files with 6 additions and 4 deletions

View file

@ -141,12 +141,11 @@ void PageHost::page_did_layout()
{ {
auto* layout_root = this->layout_root(); auto* layout_root = this->layout_root();
VERIFY(layout_root); VERIFY(layout_root);
Gfx::IntSize content_size;
if (layout_root->paint_box()->has_overflow()) if (layout_root->paint_box()->has_overflow())
content_size = enclosing_int_rect(layout_root->paint_box()->scrollable_overflow_rect().value()).size(); m_content_size = enclosing_int_rect(layout_root->paint_box()->scrollable_overflow_rect().value()).size();
else else
content_size = enclosing_int_rect(layout_root->paint_box()->absolute_rect()).size(); m_content_size = enclosing_int_rect(layout_root->paint_box()->absolute_rect()).size();
m_client.async_did_layout(content_size); m_client.async_did_layout(m_content_size);
} }
void PageHost::page_did_change_title(String const& title) void PageHost::page_did_change_title(String const& title)

View file

@ -38,6 +38,8 @@ public:
void set_window_position(Gfx::IntPoint const&); void set_window_position(Gfx::IntPoint const&);
void set_window_size(Gfx::IntSize const&); void set_window_size(Gfx::IntSize const&);
Gfx::IntSize const& content_size() const { return m_content_size; }
private: private:
// ^PageClient // ^PageClient
virtual Gfx::Palette palette() const override; virtual Gfx::Palette palette() const override;
@ -81,6 +83,7 @@ private:
NonnullOwnPtr<Web::Page> m_page; NonnullOwnPtr<Web::Page> m_page;
RefPtr<Gfx::PaletteImpl> m_palette_impl; RefPtr<Gfx::PaletteImpl> m_palette_impl;
Gfx::IntRect m_screen_rect; Gfx::IntRect m_screen_rect;
Gfx::IntSize m_content_size;
bool m_should_show_line_box_borders { false }; bool m_should_show_line_box_borders { false };
bool m_has_focus { false }; bool m_has_focus { false };