mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:38:12 +00:00
LibWeb: Some improvements to absolute positioning
Absolutely positioned blocks now register themselves with their containing block (and note that the containing block of an absolutely positioned box is the nearest non-statically positioned block ancestor or the ICB as fallback.) Containing blocks then drive the layout of their tracked absolutely positioned descendants as a separate layout pass. This is very far from perfect but the general direction seems good.
This commit is contained in:
parent
ff2c949d70
commit
260427f0ad
8 changed files with 166 additions and 24 deletions
|
@ -46,4 +46,24 @@ BoxModelMetrics::PixelBox BoxModelMetrics::full_margin(const LayoutNode& layout_
|
|||
};
|
||||
}
|
||||
|
||||
BoxModelMetrics::PixelBox BoxModelMetrics::padding_box(const LayoutNode& layout_node) const
|
||||
{
|
||||
return {
|
||||
m_padding.top.to_px(layout_node),
|
||||
m_padding.right.to_px(layout_node),
|
||||
m_padding.bottom.to_px(layout_node),
|
||||
m_padding.left.to_px(layout_node),
|
||||
};
|
||||
}
|
||||
|
||||
BoxModelMetrics::PixelBox BoxModelMetrics::border_box(const LayoutNode& layout_node) const
|
||||
{
|
||||
return {
|
||||
m_border.top.to_px(layout_node) + m_padding.top.to_px(layout_node),
|
||||
m_border.right.to_px(layout_node) + m_padding.right.to_px(layout_node),
|
||||
m_border.bottom.to_px(layout_node) + m_padding.bottom.to_px(layout_node),
|
||||
m_border.left.to_px(layout_node) + m_padding.left.to_px(layout_node),
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue