mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +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:
committed by
Andreas Kling
parent
b2b677e984
commit
1a4f2dca38
@@ -9,9 +9,9 @@
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
GridTrackPlacement::GridTrackPlacement(int span_or_position, bool has_span)
|
||||
GridTrackPlacement::GridTrackPlacement(int span_count_or_position, bool has_span)
|
||||
: m_type(has_span ? Type::Span : Type::Position)
|
||||
, m_value(span_or_position)
|
||||
, m_span_count_or_position(span_count_or_position)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -23,9 +23,18 @@ GridTrackPlacement::GridTrackPlacement()
|
||||
String GridTrackPlacement::to_string() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
if (is_span())
|
||||
builder.append("span "sv);
|
||||
builder.append(String::number(m_value));
|
||||
if (is_auto()) {
|
||||
builder.append("auto"sv);
|
||||
return builder.to_string();
|
||||
}
|
||||
if (is_span()) {
|
||||
builder.append("span"sv);
|
||||
builder.append(" "sv);
|
||||
}
|
||||
if (m_span_count_or_position != 0) {
|
||||
builder.append(String::number(m_span_count_or_position));
|
||||
builder.append(" "sv);
|
||||
}
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user