mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 00:57:43 +00:00
LibWeb: Add GridTrackSizeStyleValue
Add GridTrackSizeStyleValue for the use of CSS properties grid-template-columns, grid-template-rows.
This commit is contained in:
parent
ca286fc220
commit
0148260b5f
3 changed files with 55 additions and 0 deletions
|
@ -150,6 +150,12 @@ LengthStyleValue const& StyleValue::as_length() const
|
|||
return static_cast<LengthStyleValue const&>(*this);
|
||||
}
|
||||
|
||||
GridTrackSizeStyleValue const& StyleValue::as_grid_track_size() const
|
||||
{
|
||||
VERIFY(is_grid_track_size());
|
||||
return static_cast<GridTrackSizeStyleValue const&>(*this);
|
||||
}
|
||||
|
||||
LinearGradientStyleValue const& StyleValue::as_linear_gradient() const
|
||||
{
|
||||
VERIFY(is_linear_gradient());
|
||||
|
@ -1198,6 +1204,25 @@ bool FrequencyStyleValue::equals(StyleValue const& other) const
|
|||
return m_frequency == other.as_frequency().m_frequency;
|
||||
}
|
||||
|
||||
String GridTrackSizeStyleValue::to_string() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
for (size_t i = 0; i < m_grid_track.size(); i++) {
|
||||
builder.append(m_grid_track[i].to_string());
|
||||
if (i != m_grid_track.size() - 1)
|
||||
builder.append(" "sv);
|
||||
}
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
bool GridTrackSizeStyleValue::equals(StyleValue const& other) const
|
||||
{
|
||||
if (type() != other.type())
|
||||
return false;
|
||||
auto const& typed_other = other.as_grid_track_size();
|
||||
return m_grid_track == typed_other.grid_track_size();
|
||||
}
|
||||
|
||||
String IdentifierStyleValue::to_string() const
|
||||
{
|
||||
return CSS::string_from_value_id(m_id);
|
||||
|
@ -1906,6 +1931,11 @@ NonnullRefPtr<ColorStyleValue> ColorStyleValue::create(Color color)
|
|||
return adopt_ref(*new ColorStyleValue(color));
|
||||
}
|
||||
|
||||
NonnullRefPtr<GridTrackSizeStyleValue> GridTrackSizeStyleValue::create(Vector<CSS::GridTrackSize> grid_track_size)
|
||||
{
|
||||
return adopt_ref(*new GridTrackSizeStyleValue(grid_track_size));
|
||||
}
|
||||
|
||||
NonnullRefPtr<RectStyleValue> RectStyleValue::create(EdgeRect rect)
|
||||
{
|
||||
return adopt_ref(*new RectStyleValue(rect));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue