mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-02 22:55:23 +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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user