blob: f771f6c5176bc6a5f3d27e0ef160f3152b493477 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/*
* Copyright (c) 2022, Martin Falisse <mfalisse@outlook.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "GridTrackPlacement.h"
#include <AK/DeprecatedString.h>
namespace Web::CSS {
GridTrackPlacement::GridTrackPlacement(int span_count_or_position, bool has_span)
: m_type(has_span ? Type::Span : Type::Position)
, m_span_count_or_position(span_count_or_position)
{
}
GridTrackPlacement::GridTrackPlacement(DeprecatedString line_name, int span_count_or_position, bool has_span)
: m_type(has_span ? Type::Span : Type::Position)
, m_span_count_or_position(span_count_or_position)
, m_line_name(line_name)
{
}
GridTrackPlacement::GridTrackPlacement(DeprecatedString line_name, bool has_span)
: m_type(has_span ? Type::Span : Type::Position)
, m_line_name(line_name)
{
}
GridTrackPlacement::GridTrackPlacement()
: m_type(Type::Auto)
{
}
DeprecatedString GridTrackPlacement::to_deprecated_string() const
{
StringBuilder builder;
if (is_auto()) {
builder.append("auto"sv);
return builder.to_deprecated_string();
}
if (is_span()) {
builder.append("span"sv);
builder.append(" "sv);
}
if (m_span_count_or_position != 0) {
builder.append(DeprecatedString::number(m_span_count_or_position));
builder.append(" "sv);
}
if (has_line_name()) {
builder.append(m_line_name);
}
return builder.to_deprecated_string();
}
}
|