1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:57:35 +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

@ -36,7 +36,8 @@ void NestedBrowsingContextPaintable::paint(PaintContext& context, PaintPhase pha
PaintableBox::paint(context, phase);
if (phase == PaintPhase::Foreground) {
auto clip_rect = context.rounded_device_rect(absolute_rect().to_type<CSSPixels>());
auto absolute_rect = this->absolute_rect();
auto clip_rect = context.rounded_device_rect(absolute_rect);
ScopedCornerRadiusClip corner_clip { context, context.painter(), clip_rect, normalized_border_radii_data(ShrinkRadiiForBorders::Yes) };
auto* hosted_document = layout_box().dom_node().content_document_without_origin_check();
@ -50,7 +51,7 @@ void NestedBrowsingContextPaintable::paint(PaintContext& context, PaintPhase pha
auto old_viewport_rect = context.device_viewport_rect();
context.painter().add_clip_rect(clip_rect.to_type<int>());
context.painter().translate(absolute_x(), absolute_y());
context.painter().translate(absolute_rect.x().value(), absolute_rect.y().value());
context.set_device_viewport_rect({ {}, layout_box().dom_node().nested_browsing_context()->size() });
const_cast<Layout::InitialContainingBlock*>(hosted_layout_tree)->paint_all_phases(context);
@ -60,7 +61,7 @@ void NestedBrowsingContextPaintable::paint(PaintContext& context, PaintPhase pha
if constexpr (HIGHLIGHT_FOCUSED_FRAME_DEBUG) {
if (layout_box().dom_node().nested_browsing_context()->is_focused_context()) {
context.painter().draw_rect(absolute_rect().to_type<int>(), Color::Cyan);
context.painter().draw_rect(clip_rect.to_type<int>(), Color::Cyan);
}
}
}