mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +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:
parent
38b037990b
commit
e65ca3a7d2
Notes:
github-actions[bot]
2025-01-24 12:56:55 +00:00
Author: https://github.com/AtkinsSJ
Commit: e65ca3a7d2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3348
Reviewed-by: https://github.com/gmta ✅
2 changed files with 7 additions and 1 deletions
|
@ -43,9 +43,14 @@ Length Length::make_auto()
|
|||
return Length(0, Type::Auto);
|
||||
}
|
||||
|
||||
Length Length::make_px(double value)
|
||||
{
|
||||
return Length(value, Type::Px);
|
||||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -87,6 +87,7 @@ public:
|
|||
~Length();
|
||||
|
||||
static Length make_auto();
|
||||
static Length make_px(double value);
|
||||
static Length make_px(CSSPixels value);
|
||||
Length percentage_of(Percentage const&) const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue