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

LibWeb: Convert Paintable coordinates to new pixel units

This fixes a few sizing issues too. The page size is now correct in most
cases! \o/

We get to remove some of the `to_type<>()` shenanigans, though it
reappears in some other places.
This commit is contained in:
Sam Atkins 2022-10-31 19:46:55 +00:00 committed by Linus Groh
parent 57a69f15ff
commit ab49dbf137
39 changed files with 200 additions and 179 deletions

View file

@ -355,8 +355,8 @@ Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect
MUST(serializer.add("border_bottom"sv, box_model.border.bottom));
MUST(serializer.add("border_left"sv, box_model.border.left));
if (auto* paint_box = box->paint_box()) {
MUST(serializer.add("content_width"sv, paint_box->content_width()));
MUST(serializer.add("content_height"sv, paint_box->content_height()));
MUST(serializer.add("content_width"sv, paint_box->content_width().value()));
MUST(serializer.add("content_height"sv, paint_box->content_height().value()));
} else {
MUST(serializer.add("content_width"sv, 0));
MUST(serializer.add("content_height"sv, 0));

View file

@ -152,9 +152,9 @@ void PageHost::page_did_layout()
auto* layout_root = this->layout_root();
VERIFY(layout_root);
if (layout_root->paint_box()->has_overflow())
m_content_size = page().enclosing_device_rect(layout_root->paint_box()->scrollable_overflow_rect().value().to_type<Web::CSSPixels>()).size();
m_content_size = page().enclosing_device_rect(layout_root->paint_box()->scrollable_overflow_rect().value()).size();
else
m_content_size = page().enclosing_device_rect(layout_root->paint_box()->absolute_rect().to_type<Web::CSSPixels>()).size();
m_content_size = page().enclosing_device_rect(layout_root->paint_box()->absolute_rect()).size();
m_client.async_did_layout(m_content_size.to_type<int>());
}