mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:17:42 +00:00
LibWeb: Add to_px() helpers to CSS::Size and CSS::PercentageOr<T>
Old pattern: foo.resolved(node, reference_value).to_px(node) New pattern: foo.to_px(node, reference_value) Also, the reference value for to_px() is a CSSPixels, which means we don't have to synthesize a CSS::Length just for this call.
This commit is contained in:
parent
3e62ab996d
commit
cdf0d3e905
3 changed files with 12 additions and 0 deletions
|
@ -14,6 +14,11 @@ Size::Size(Type type, LengthPercentage length_percentage)
|
|||
{
|
||||
}
|
||||
|
||||
CSSPixels Size::to_px(Layout::Node const& node, CSSPixels reference_value) const
|
||||
{
|
||||
return m_length_percentage.resolved(node, CSS::Length::make_px(reference_value)).to_px(node);
|
||||
}
|
||||
|
||||
CSS::Length Size::resolved(Layout::Node const& node, Length const& reference_value) const
|
||||
{
|
||||
return m_length_percentage.resolved(node, reference_value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue