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

LibWeb: Parse line names in grid track position properties

Parse line names when passed to the grid-column/row-start/end CSS
properties.
This commit is contained in:
martinfalisse 2022-10-30 13:46:50 +01:00 committed by Andreas Kling
parent 78a573d678
commit 829f56572d
3 changed files with 42 additions and 1 deletions

View file

@ -18,7 +18,9 @@ public:
Auto
};
GridTrackPlacement(String line_name, int span_count_or_position, bool has_span = false);
GridTrackPlacement(int span_count_or_position, bool has_span = false);
GridTrackPlacement(String line_name, bool has_span = false);
GridTrackPlacement();
static GridTrackPlacement make_auto() { return GridTrackPlacement(); };
@ -26,10 +28,13 @@ public:
bool is_span() const { return m_type == Type::Span; }
bool is_position() const { return m_type == Type::Position; }
bool is_auto() const { return m_type == Type::Auto; }
bool is_auto_positioned() const { return m_type == Type::Auto || m_type == Type::Span; }
bool is_auto_positioned() const { return m_type == Type::Auto || (m_type == Type::Span && !has_line_name()); }
bool has_line_name() const { return !m_line_name.is_empty(); }
int raw_value() const { return m_span_count_or_position; }
Type type() const { return m_type; }
String line_name() const { return m_line_name; }
String to_string() const;
bool operator==(GridTrackPlacement const& other) const
@ -40,6 +45,7 @@ public:
private:
Type m_type;
int m_span_count_or_position { 0 };
String m_line_name;
};
}