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

LibWeb: Change viewport ownership from BrowsingContext to Navigable

This commit is contained in:
Aliaksandr Kalenik 2023-08-22 16:00:42 +02:00 committed by Andreas Kling
parent 4356d37b2c
commit dd7bba66ed
23 changed files with 196 additions and 129 deletions

View file

@ -129,7 +129,7 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet
// Attachment and Origin
switch (layer.attachment) {
case CSS::BackgroundAttachment::Fixed:
background_positioning_area = layout_node.root().browsing_context().viewport_rect();
background_positioning_area = layout_node.root().navigable()->viewport_rect();
break;
case CSS::BackgroundAttachment::Local:
background_positioning_area = get_box(layer.origin).rect;

View file

@ -56,7 +56,7 @@ void NestedBrowsingContextPaintable::paint(PaintContext& context, PaintPhase pha
auto absolute_device_rect = context.enclosing_device_rect(absolute_rect);
context.painter().translate(absolute_device_rect.x().value(), absolute_device_rect.y().value());
context.set_device_viewport_rect({ {}, context.enclosing_device_size(layout_box().dom_node().nested_browsing_context()->size()) });
context.set_device_viewport_rect({ {}, context.enclosing_device_size(layout_box().dom_node().content_navigable()->size()) });
const_cast<ViewportPaintable*>(hosted_paint_tree)->paint_all_phases(context);
context.set_device_viewport_rect(old_viewport_rect);

View file

@ -542,7 +542,7 @@ Optional<HitTestResult> StackingContext::hit_test(CSSPixelPoint position, HitTes
auto transformed_position = affine_transform_matrix().inverse().value_or({}).map(offset_position).to_type<CSSPixels>() + transform_origin;
if (paintable_box().is_fixed_position()) {
auto scroll_offset = paintable_box().document().browsing_context()->viewport_scroll_offset();
auto scroll_offset = paintable_box().document().navigable()->viewport_scroll_offset();
transformed_position.translate_by(-scroll_offset);
}