mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:27:35 +00:00
LibWeb: Parse grid-area
CSS property
This commit is contained in:
parent
a6548c4d80
commit
9bc001f410
10 changed files with 220 additions and 0 deletions
|
@ -140,6 +140,12 @@ GridTrackPlacementShorthandStyleValue const& StyleValue::as_grid_track_placement
|
|||
return static_cast<GridTrackPlacementShorthandStyleValue const&>(*this);
|
||||
}
|
||||
|
||||
GridAreaShorthandStyleValue const& StyleValue::as_grid_area_shorthand() const
|
||||
{
|
||||
VERIFY(is_grid_area_shorthand());
|
||||
return static_cast<GridAreaShorthandStyleValue const&>(*this);
|
||||
}
|
||||
|
||||
GridTemplateAreaStyleValue const& StyleValue::as_grid_template_area() const
|
||||
{
|
||||
VERIFY(is_grid_template_area());
|
||||
|
@ -1427,6 +1433,31 @@ bool GridTrackPlacementShorthandStyleValue::equals(StyleValue const& other) cons
|
|||
&& m_end->equals(typed_other.m_end);
|
||||
}
|
||||
|
||||
ErrorOr<String> GridAreaShorthandStyleValue::to_string() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
if (!m_row_start->as_grid_track_placement().grid_track_placement().is_auto())
|
||||
builder.appendff("{}", m_row_start->as_grid_track_placement().grid_track_placement().to_string().value());
|
||||
if (!m_column_start->as_grid_track_placement().grid_track_placement().is_auto())
|
||||
builder.appendff(" / {}", m_column_start->as_grid_track_placement().grid_track_placement().to_string().value());
|
||||
if (!m_row_end->as_grid_track_placement().grid_track_placement().is_auto())
|
||||
builder.appendff(" / {}", m_row_end->as_grid_track_placement().grid_track_placement().to_string().value());
|
||||
if (!m_column_end->as_grid_track_placement().grid_track_placement().is_auto())
|
||||
builder.appendff(" / {}", m_column_end->as_grid_track_placement().grid_track_placement().to_string().value());
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
bool GridAreaShorthandStyleValue::equals(StyleValue const& other) const
|
||||
{
|
||||
if (type() != other.type())
|
||||
return false;
|
||||
auto const& typed_other = other.as_grid_area_shorthand();
|
||||
return m_row_start->equals(typed_other.m_row_start)
|
||||
&& m_column_start->equals(typed_other.m_column_start)
|
||||
&& m_row_end->equals(typed_other.m_row_end)
|
||||
&& m_column_end->equals(typed_other.m_column_end);
|
||||
}
|
||||
|
||||
ErrorOr<String> GridTrackPlacementStyleValue::to_string() const
|
||||
{
|
||||
return m_grid_track_placement.to_string();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue