mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-24 11:11:51 +00:00
LibWeb: Turn BoxModelMetrics into a simple struct
Using getters for this thing was just cumbersome and didn't achieve anything of value so just turn it into a plain struct.
This commit is contained in:
parent
5744dd43c5
commit
f742b245b7
Notes:
sideshowbarker
2024-07-19 05:24:49 +09:00
Author: https://github.com/awesomekling
Commit: f742b245b7
5 changed files with 115 additions and 136 deletions
|
@ -28,41 +28,33 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
BoxModelMetrics::BoxModelMetrics()
|
||||
{
|
||||
}
|
||||
|
||||
BoxModelMetrics::~BoxModelMetrics()
|
||||
{
|
||||
}
|
||||
|
||||
BoxModelMetrics::PixelBox BoxModelMetrics::margin_box(const LayoutNode& layout_node) const
|
||||
PixelBox BoxModelMetrics::margin_box(const LayoutNode& layout_node) const
|
||||
{
|
||||
return {
|
||||
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),
|
||||
margin.top.to_px(layout_node) + border.top.to_px(layout_node) + padding.top.to_px(layout_node),
|
||||
margin.right.to_px(layout_node) + border.right.to_px(layout_node) + padding.right.to_px(layout_node),
|
||||
margin.bottom.to_px(layout_node) + border.bottom.to_px(layout_node) + padding.bottom.to_px(layout_node),
|
||||
margin.left.to_px(layout_node) + border.left.to_px(layout_node) + padding.left.to_px(layout_node),
|
||||
};
|
||||
}
|
||||
|
||||
BoxModelMetrics::PixelBox BoxModelMetrics::padding_box(const LayoutNode& layout_node) const
|
||||
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),
|
||||
padding.top.to_px(layout_node),
|
||||
padding.right.to_px(layout_node),
|
||||
padding.bottom.to_px(layout_node),
|
||||
padding.left.to_px(layout_node),
|
||||
};
|
||||
}
|
||||
|
||||
BoxModelMetrics::PixelBox BoxModelMetrics::border_box(const LayoutNode& layout_node) const
|
||||
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),
|
||||
border.top.to_px(layout_node) + padding.top.to_px(layout_node),
|
||||
border.right.to_px(layout_node) + padding.right.to_px(layout_node),
|
||||
border.bottom.to_px(layout_node) + padding.bottom.to_px(layout_node),
|
||||
border.left.to_px(layout_node) + padding.left.to_px(layout_node),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue