LibWeb: Take margin into account when positioning absolute descendants

This commit is contained in:
Andreas Kling 2020-06-23 19:20:06 +02:00
parent aeeaf33638
commit 7c848645c3
Notes: sideshowbarker 2024-07-19 05:25:22 +09:00

View File

@ -103,9 +103,9 @@ void LayoutBlock::layout_absolutely_positioned_descendant(LayoutBox& box)
- box_model.offset().bottom.to_px(box) - box_model.offset().bottom.to_px(box)
- box_model.border_box(box).bottom; - box_model.border_box(box).bottom;
if (!box_model.offset().left.is_auto()) { if (!box_model.offset().left.is_auto() || !box_model.margin().left.is_auto()) {
used_offset.set_x(x_offset + box_model.margin().left.to_px(box)); used_offset.set_x(x_offset + box_model.margin().left.to_px(box));
} else if (!box_model.offset().right.is_auto()) { } else if (!box_model.offset().right.is_auto() || !box_model.margin().right.is_auto()) {
used_offset.set_x(width() + x_offset - box.width() - box_model.margin().right.to_px(box)); used_offset.set_x(width() + x_offset - box.width() - box_model.margin().right.to_px(box));
} }