mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:37:36 +00:00
LibWeb: Remove Length::Type::Undefined! :^)
This commit is contained in:
parent
b715943035
commit
356d8bcfe8
8 changed files with 13 additions and 20 deletions
|
@ -18,7 +18,6 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
Length::Length() = default;
|
||||
Length::Length(int value, Type type)
|
||||
: m_type(type)
|
||||
, m_value(value)
|
||||
|
@ -49,8 +48,8 @@ Length Length::make_calculated(NonnullRefPtr<CalculatedStyleValue> calculated_st
|
|||
|
||||
Length Length::percentage_of(Percentage const& percentage) const
|
||||
{
|
||||
if (is_undefined_or_auto()) {
|
||||
dbgln("Attempting to get percentage of an undefined or auto length, this seems wrong? But for now we just return the original length.");
|
||||
if (is_auto()) {
|
||||
dbgln("Attempting to get percentage of an auto length, this seems wrong? But for now we just return the original length.");
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -132,8 +131,6 @@ const char* Length::unit_name() const
|
|||
return "rem";
|
||||
case Type::Auto:
|
||||
return "auto";
|
||||
case Type::Undefined:
|
||||
return "undefined";
|
||||
case Type::Vh:
|
||||
return "vh";
|
||||
case Type::Vw:
|
||||
|
|
|
@ -15,7 +15,6 @@ namespace Web::CSS {
|
|||
class Length {
|
||||
public:
|
||||
enum class Type {
|
||||
Undefined,
|
||||
Calculated,
|
||||
Auto,
|
||||
Cm,
|
||||
|
@ -37,7 +36,6 @@ public:
|
|||
|
||||
// We have a RefPtr<CalculatedStyleValue> member, but can't include the header StyleValue.h as it includes
|
||||
// this file already. To break the cyclic dependency, we must move all method definitions out.
|
||||
Length();
|
||||
Length(int value, Type type);
|
||||
Length(float value, Type type);
|
||||
|
||||
|
@ -48,8 +46,6 @@ public:
|
|||
|
||||
Length resolved(Layout::Node const& layout_node) const;
|
||||
|
||||
bool is_undefined_or_auto() const { return m_type == Type::Undefined || m_type == Type::Auto; }
|
||||
bool is_undefined() const { return m_type == Type::Undefined; }
|
||||
bool is_auto() const { return m_type == Type::Auto; }
|
||||
bool is_calculated() const { return m_type == Type::Calculated; }
|
||||
|
||||
|
@ -137,7 +133,7 @@ public:
|
|||
private:
|
||||
const char* unit_name() const;
|
||||
|
||||
Type m_type { Type::Undefined };
|
||||
Type m_type;
|
||||
float m_value { 0 };
|
||||
|
||||
RefPtr<CalculatedStyleValue> m_calculated_style;
|
||||
|
|
|
@ -131,7 +131,7 @@ float StyleProperties::line_height(Layout::Node const& layout_node) const
|
|||
|
||||
if (line_height->is_length()) {
|
||||
auto line_height_length = line_height->to_length();
|
||||
if (!line_height_length.is_undefined_or_auto())
|
||||
if (!line_height_length.is_auto())
|
||||
return line_height_length.to_px(layout_node);
|
||||
}
|
||||
|
||||
|
|
|
@ -500,7 +500,6 @@ Optional<Length> CalculatedStyleValue::resolve_length(Layout::Node const& layout
|
|||
|
||||
Optional<LengthPercentage> CalculatedStyleValue::resolve_length_percentage(Layout::Node const& layout_node, Length const& percentage_basis) const
|
||||
{
|
||||
VERIFY(!percentage_basis.is_undefined());
|
||||
auto result = m_expression->resolve(&layout_node, percentage_basis);
|
||||
|
||||
return result.value().visit(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue