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

LibWeb: Refactor GridTrackPlacement

Refactor this class for quality-of-life reasons as well as to better
prepare for the addition of line names.
This commit is contained in:
martinfalisse 2022-10-30 13:40:57 +01:00 committed by Andreas Kling
parent b2b677e984
commit 1a4f2dca38
2 changed files with 18 additions and 9 deletions

View file

@ -18,7 +18,7 @@ public:
Auto
};
GridTrackPlacement(int, bool = false);
GridTrackPlacement(int span_count_or_position, bool has_span = false);
GridTrackPlacement();
static GridTrackPlacement make_auto() { return GridTrackPlacement(); };
@ -28,18 +28,18 @@ public:
bool is_auto() const { return m_type == Type::Auto; }
bool is_auto_positioned() const { return m_type == Type::Auto || m_type == Type::Span; }
int raw_value() const { return m_value; }
int raw_value() const { return m_span_count_or_position; }
Type type() const { return m_type; }
String to_string() const;
bool operator==(GridTrackPlacement const& other) const
{
return m_type == other.type() && m_value == other.raw_value();
return m_type == other.type() && m_span_count_or_position == other.raw_value();
}
private:
Type m_type;
int m_value { 0 };
int m_span_count_or_position { 0 };
};
}