Skip to content

parse: add the gap shorthand - #43

Open
metan-ucw wants to merge 1 commit into
netsurf-browser:masterfrom
metan-ucw:add-gap-shorthand
Open

parse: add the gap shorthand#43
metan-ucw wants to merge 1 commit into
netsurf-browser:masterfrom
metan-ucw:add-gap-shorthand

Conversation

@metan-ucw

Copy link
Copy Markdown
Contributor

gap: <row-gap> <column-gap>? was not a property at all: the parser only knew the column-gap longhand (from multicol), so every gap declaration was thrown away. Flex and grid layouts written the modern way — one gap on the container — got no spacing between their items.

LibCSS has no row-gap property, so only the column component can reach the cascade; the row component is still parsed and consumed, or the declaration would be rejected as invalid and the column gap lost with it. A single value serves both axes, so it becomes the column gap too.

The tests go beside column-gap's own in multicol.dat and pin that pair of rules — one value reaches the object model, and with two it is the second that survives. The values the shorthand takes are the longhand's: UNIT_MASK_COLUMN_GAP is UNIT_LENGTH, so gap: 10% is rejected exactly as column-gap: 10% is, and a negative length is out of range. A third component is rejected outright.

`gap: <row-gap> <column-gap>?` was not a property at all: the parser only
knew the `column-gap` longhand (from multicol), so every `gap` declaration
was thrown away.  Flex and grid layouts written the modern way — one
`gap` on the container — got no spacing between their items.

LibCSS has no row-gap property, so only the column component can reach
the cascade; the row component is still parsed and consumed, or the
declaration would be rejected as invalid and the column gap lost with it.
A single value serves both axes, so it becomes the column gap too.

The tests go beside column-gap's own in multicol.dat and pin that pair of
rules — one value reaches the object model, and with two it is the second
that survives.  The values the shorthand takes are the longhand's:
UNIT_MASK_COLUMN_GAP is UNIT_LENGTH, so `gap: 10%` is rejected exactly as
`column-gap: 10%` is, and a negative length is out of range.  A third
component is rejected outright.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Cyril Hrubis <metan@ucw.cz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant