summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-11-02 17:35:53 +0000
committerLinus Groh <mail@linusgroh.de>2022-12-10 12:03:19 +0000
commit3c7bd5a317515ac572610eba2919c82dcd320a1e (patch)
treee716f6049c9bd58ba9f07c8d9fa9aaa42f23a39f /Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
parent045aa8530c56b9a58f5e9150f17cb08e29bf5ab2 (diff)
downloadserenity-3c7bd5a317515ac572610eba2919c82dcd320a1e.zip
LibWeb+WebContent+headless-browser: Use CSSPixels for PageClient events
...and also for hit testing, which is involved in most of them. Much of this is temporary conversions and other awkwardness, which should resolve itself as the rest of LibWeb is converted to these new types. Hopefully. :thousandyakstare:
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp')
-rw-r--r--Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
index 4c34c88913..67e136af2a 100644
--- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
+++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
@@ -375,7 +375,7 @@ void BrowsingContext::set_needs_display(Gfx::IntRect const& rect)
if (is_top_level()) {
if (m_page)
- m_page->client().page_did_invalidate(to_top_level_rect(rect));
+ m_page->client().page_did_invalidate(to_top_level_rect(rect.to_type<CSSPixels>()));
return;
}
@@ -389,7 +389,7 @@ void BrowsingContext::scroll_to(Gfx::IntPoint position)
active_document()->force_layout();
if (m_page)
- m_page->client().page_did_request_scroll_to(position);
+ m_page->client().page_did_request_scroll_to(position.to_type<CSSPixels>());
}
void BrowsingContext::scroll_to_anchor(DeprecatedString const& fragment)
@@ -427,17 +427,17 @@ void BrowsingContext::scroll_to_anchor(DeprecatedString const& fragment)
}
if (m_page)
- m_page->client().page_did_request_scroll_into_view(enclosing_int_rect(float_rect));
+ m_page->client().page_did_request_scroll_into_view(float_rect.to_type<CSSPixels>());
}
-Gfx::IntRect BrowsingContext::to_top_level_rect(Gfx::IntRect const& a_rect)
+CSSPixelRect BrowsingContext::to_top_level_rect(CSSPixelRect const& a_rect)
{
auto rect = a_rect;
rect.set_location(to_top_level_position(a_rect.location()));
return rect;
}
-Gfx::IntPoint BrowsingContext::to_top_level_position(Gfx::IntPoint a_position)
+CSSPixelPoint BrowsingContext::to_top_level_position(CSSPixelPoint a_position)
{
auto position = a_position;
for (auto ancestor = parent(); ancestor; ancestor = ancestor->parent()) {
@@ -447,7 +447,7 @@ Gfx::IntPoint BrowsingContext::to_top_level_position(Gfx::IntPoint a_position)
return {};
if (!ancestor->container()->layout_node())
return {};
- position.translate_by(ancestor->container()->layout_node()->box_type_agnostic_position().to_type<int>());
+ position.translate_by(ancestor->container()->layout_node()->box_type_agnostic_position().to_type<CSSPixels>());
}
return position;
}