mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:07:34 +00:00
LibWeb+Base: Re-implement grid track span
Implement span correctly when indicated in the grid-column-start, grid-row-start, etc. CSS properties. Previously it had been implemented as if span was something that went alongside the position property, but actually it seems like if you do 'span 3' in the grid-column-start property, for example, this means it literally spans 3 blocks, and the 3 has nothing to do with position.
This commit is contained in:
parent
86ce1b64f0
commit
236795e931
5 changed files with 224 additions and 117 deletions
|
@ -9,28 +9,23 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
GridTrackPlacement::GridTrackPlacement(int position, bool has_span)
|
||||
: m_position(position)
|
||||
, m_has_span(has_span)
|
||||
{
|
||||
}
|
||||
|
||||
GridTrackPlacement::GridTrackPlacement(int position)
|
||||
: m_position(position)
|
||||
GridTrackPlacement::GridTrackPlacement(int span_or_position, bool has_span)
|
||||
: m_type(has_span ? Type::Span : Type::Position)
|
||||
, m_value(span_or_position)
|
||||
{
|
||||
}
|
||||
|
||||
GridTrackPlacement::GridTrackPlacement()
|
||||
: m_is_auto(true)
|
||||
: m_type(Type::Auto)
|
||||
{
|
||||
}
|
||||
|
||||
String GridTrackPlacement::to_string() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
if (m_has_span)
|
||||
if (is_span())
|
||||
builder.append("span "sv);
|
||||
builder.append(String::number(m_position));
|
||||
builder.append(String::number(m_value));
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue