mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibWeb/CSS: Add Length::make_px(double) overload
Saves us a round-trip to CSSPixels and back when we already have a double value.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
38b037990b
commit
e65ca3a7d2
@@ -43,9 +43,14 @@ Length Length::make_auto()
|
|||||||
return Length(0, Type::Auto);
|
return Length(0, Type::Auto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Length Length::make_px(double value)
|
||||||
|
{
|
||||||
|
return Length(value, Type::Px);
|
||||||
|
}
|
||||||
|
|
||||||
Length Length::make_px(CSSPixels value)
|
Length Length::make_px(CSSPixels value)
|
||||||
{
|
{
|
||||||
return Length(value.to_double(), Type::Px);
|
return make_px(value.to_double());
|
||||||
}
|
}
|
||||||
|
|
||||||
Length Length::percentage_of(Percentage const& percentage) const
|
Length Length::percentage_of(Percentage const& percentage) const
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ public:
|
|||||||
~Length();
|
~Length();
|
||||||
|
|
||||||
static Length make_auto();
|
static Length make_auto();
|
||||||
|
static Length make_px(double value);
|
||||||
static Length make_px(CSSPixels value);
|
static Length make_px(CSSPixels value);
|
||||||
Length percentage_of(Percentage const&) const;
|
Length percentage_of(Percentage const&) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user