1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 08:47:34 +00:00

LibWeb: Allow having auto GridTrackPlacements

For grid-row-start, grid-column-end and similar values it is possible to
have auto values (nothing was specified, for example).
This commit is contained in:
martinfalisse 2022-09-07 15:03:23 +02:00 committed by Andreas Kling
parent 0613972f0c
commit ad221164d5
2 changed files with 14 additions and 2 deletions

View file

@ -21,6 +21,7 @@ GridTrackPlacement::GridTrackPlacement(int position)
} }
GridTrackPlacement::GridTrackPlacement() GridTrackPlacement::GridTrackPlacement()
: m_is_auto(true)
{ {
} }

View file

@ -18,12 +18,22 @@ public:
static GridTrackPlacement make_auto() { return GridTrackPlacement(); }; static GridTrackPlacement make_auto() { return GridTrackPlacement(); };
void set_position(int position) { m_position = position; } void set_position(int position)
{
m_is_auto = false;
m_position = position;
}
int position() const { return m_position; } int position() const { return m_position; }
void set_has_span(bool has_span) { m_has_span = has_span; } void set_has_span(bool has_span)
{
VERIFY(!m_is_auto);
m_has_span = has_span;
}
bool has_span() const { return m_has_span; } bool has_span() const { return m_has_span; }
bool is_auto() const { return m_is_auto; }
String to_string() const; String to_string() const;
bool operator==(GridTrackPlacement const& other) const bool operator==(GridTrackPlacement const& other) const
{ {
@ -31,6 +41,7 @@ public:
} }
private: private:
bool m_is_auto { false };
int m_position { 0 }; int m_position { 0 };
bool m_has_span { false }; bool m_has_span { false };
}; };