mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +00:00
LibWeb: Add and use convinient from_raw
helper in PixelUnits
This commit is contained in:
parent
127b966219
commit
618f889486
Notes:
sideshowbarker
2024-07-17 08:36:27 +09:00
Author: https://github.com/Hendiadyoin1
Commit: 618f889486
Pull-request: https://github.com/SerenityOS/serenity/pull/20210
Reviewed-by: https://github.com/kalenikaliaksandr ✅
2 changed files with 10 additions and 9 deletions
|
@ -83,16 +83,12 @@ int CSSPixels::operator<=>(CSSPixels const& other) const
|
|||
|
||||
CSSPixels CSSPixels::operator+() const
|
||||
{
|
||||
CSSPixels result;
|
||||
result.set_raw_value(+raw_value());
|
||||
return result;
|
||||
return from_raw(+raw_value());
|
||||
}
|
||||
|
||||
CSSPixels CSSPixels::operator-() const
|
||||
{
|
||||
CSSPixels result;
|
||||
result.set_raw_value(-raw_value());
|
||||
return result;
|
||||
return from_raw(-raw_value());
|
||||
}
|
||||
|
||||
static inline int saturated_addition(int a, int b)
|
||||
|
@ -156,9 +152,7 @@ CSSPixels& CSSPixels::operator/=(CSSPixels const& other)
|
|||
|
||||
CSSPixels CSSPixels::abs() const
|
||||
{
|
||||
CSSPixels result;
|
||||
result.set_raw_value(::abs(m_value));
|
||||
return result;
|
||||
return from_raw(::abs(m_value));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue