summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-11-05 12:28:23 -0400
committerLinus Groh <mail@linusgroh.de>2022-11-05 17:21:30 +0000
commit2f5ceeac624155f5cffdb429caedf365353ad054 (patch)
tree3ad55c95235ee145fe90c86b240ad0525793cbf9
parent2ba2e6ca0a162d4e959cbfa9477cc9acb76c270f (diff)
downloadserenity-2f5ceeac624155f5cffdb429caedf365353ad054.zip
WebContent: Store and provide access to web page content size
-rw-r--r--Userland/Services/WebContent/PageHost.cpp7
-rw-r--r--Userland/Services/WebContent/PageHost.h3
2 files changed, 6 insertions, 4 deletions
diff --git a/Userland/Services/WebContent/PageHost.cpp b/Userland/Services/WebContent/PageHost.cpp
index c1b819035d..e979432f08 100644
--- a/Userland/Services/WebContent/PageHost.cpp
+++ b/Userland/Services/WebContent/PageHost.cpp
@@ -141,12 +141,11 @@ void PageHost::page_did_layout()
{
auto* layout_root = this->layout_root();
VERIFY(layout_root);
- Gfx::IntSize content_size;
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
- content_size = enclosing_int_rect(layout_root->paint_box()->absolute_rect()).size();
- m_client.async_did_layout(content_size);
+ m_content_size = enclosing_int_rect(layout_root->paint_box()->absolute_rect()).size();
+ m_client.async_did_layout(m_content_size);
}
void PageHost::page_did_change_title(String const& title)
diff --git a/Userland/Services/WebContent/PageHost.h b/Userland/Services/WebContent/PageHost.h
index c70efb4942..455d47fb26 100644
--- a/Userland/Services/WebContent/PageHost.h
+++ b/Userland/Services/WebContent/PageHost.h
@@ -38,6 +38,8 @@ public:
void set_window_position(Gfx::IntPoint const&);
void set_window_size(Gfx::IntSize const&);
+ Gfx::IntSize const& content_size() const { return m_content_size; }
+
private:
// ^PageClient
virtual Gfx::Palette palette() const override;
@@ -81,6 +83,7 @@ private:
NonnullOwnPtr<Web::Page> m_page;
RefPtr<Gfx::PaletteImpl> m_palette_impl;
Gfx::IntRect m_screen_rect;
+ Gfx::IntSize m_content_size;
bool m_should_show_line_box_borders { false };
bool m_has_focus { false };