1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:47:35 +00:00

LibWeb: Convert FormattingContext to new pixel units

Just FormattingContext and AvailableSpace, and the minor adjustments to
make everything else work.
This commit is contained in:
Sam Atkins 2022-11-23 17:46:10 +00:00 committed by Linus Groh
parent 4754204f01
commit f5f25562d1
16 changed files with 174 additions and 175 deletions

View file

@ -9,6 +9,7 @@
#include <AK/DeprecatedString.h>
#include <AK/Format.h>
#include <LibWeb/Forward.h>
#include <LibWeb/PixelUnits.h>
namespace Web::Layout {
@ -21,7 +22,7 @@ public:
MaxContent,
};
static AvailableSize make_definite(float);
static AvailableSize make_definite(CSSPixels);
static AvailableSize make_indefinite();
static AvailableSize make_min_content();
static AvailableSize make_max_content();
@ -32,12 +33,12 @@ public:
bool is_max_content() const { return m_type == Type::MaxContent; }
bool is_intrinsic_sizing_constraint() const { return is_min_content() || is_max_content(); }
float to_px() const
CSSPixels to_px() const
{
return m_value;
}
float to_px_or_zero() const
CSSPixels to_px_or_zero() const
{
if (!is_definite())
return 0.0f;
@ -47,10 +48,10 @@ public:
DeprecatedString to_deprecated_string() const;
private:
AvailableSize(Type type, float);
AvailableSize(Type type, CSSPixels);
Type m_type {};
float m_value {};
CSSPixels m_value {};
};
class AvailableSpace {