mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 21:48:11 +00:00
LibWeb: Start fleshing out support for relative CSS units
This patch introduces support for more than just "absolute px" units in our Length class. It now also supports "em" and "rem", which are units relative to the font-size of the current layout node and the <html> element's layout node respectively.
This commit is contained in:
parent
d93bf78346
commit
731685468a
16 changed files with 163 additions and 92 deletions
|
@ -36,13 +36,13 @@ BoxModelMetrics::~BoxModelMetrics()
|
|||
{
|
||||
}
|
||||
|
||||
BoxModelMetrics::PixelBox BoxModelMetrics::full_margin() const
|
||||
BoxModelMetrics::PixelBox BoxModelMetrics::full_margin(const LayoutNode& layout_node) const
|
||||
{
|
||||
return {
|
||||
m_margin.top.to_px() + m_border.top.to_px() + m_padding.top.to_px(),
|
||||
m_margin.right.to_px() + m_border.right.to_px() + m_padding.right.to_px(),
|
||||
m_margin.bottom.to_px() + m_border.bottom.to_px() + m_padding.bottom.to_px(),
|
||||
m_margin.left.to_px() + m_border.left.to_px() + m_padding.left.to_px(),
|
||||
m_margin.top.to_px(layout_node) + m_border.top.to_px(layout_node) + m_padding.top.to_px(layout_node),
|
||||
m_margin.right.to_px(layout_node) + m_border.right.to_px(layout_node) + m_padding.right.to_px(layout_node),
|
||||
m_margin.bottom.to_px(layout_node) + m_border.bottom.to_px(layout_node) + m_padding.bottom.to_px(layout_node),
|
||||
m_margin.left.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