mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:08:10 +00:00
LibWeb: Stop allowing position:relative to affect layout
Relatively positioned boxes should not affect the *layout* of their siblings. So instead of applying relative inset as a layout-time translation on the box, we now perform the adjustment at the paintable level instead. This makes position:relative actually work as expected, and exposes some new bugs we need to take care of for Acid2. :^)
This commit is contained in:
parent
153370e7f4
commit
c49c036c84
2 changed files with 12 additions and 6 deletions
|
@ -59,11 +59,18 @@ void PaintableBox::set_content_size(Gfx::FloatSize const& size)
|
|||
|
||||
Gfx::FloatPoint PaintableBox::effective_offset() const
|
||||
{
|
||||
Gfx::FloatPoint offset;
|
||||
if (m_containing_line_box_fragment.has_value()) {
|
||||
auto const& fragment = containing_block()->paint_box()->line_boxes()[m_containing_line_box_fragment->line_box_index].fragments()[m_containing_line_box_fragment->fragment_index];
|
||||
return fragment.offset();
|
||||
offset = fragment.offset();
|
||||
} else {
|
||||
offset = m_offset;
|
||||
}
|
||||
return m_offset;
|
||||
if (layout_box().computed_values().position() == CSS::Position::Relative) {
|
||||
auto const& inset = layout_box().box_model().inset;
|
||||
offset.translate_by(inset.left, inset.top);
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
Gfx::FloatRect PaintableBox::compute_absolute_rect() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue