Skip to content

declaration: read the whole shape-outside grammar - #299

Open
samoht wants to merge 2 commits into
importance-rebuild-hashfrom
declaration-reader-gaps
Open

declaration: read the whole shape-outside grammar#299
samoht wants to merge 2 commits into
importance-rebuild-hashfrom
declaration-reader-gaps

Conversation

@samoht

@samoht samoht commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Stacked on #298 (chain: #295#297#298#299). Review the last two commits; the rest is the base.

read_shape_outside looked at the first component only and knew three arms of the grammar — none, circle() and a non-empty inset(), plus the CSS-wide keywords. Everything else was rejected and the declaration dropped:

shape-outside: margin-box                 dropped
shape-outside: circle(50%) content-box    dropped
shape-outside: url(shape.png)             dropped
shape-outside: ellipse(closest-side ...)  dropped

CSS Shapes 1 §2 defines it as none | [<basic-shape> || <shape-box>] | <image>. The reader now takes that whole grammar, reusing read_clip_path for the <basic-shape> || <box> pair and read_background_image for <image>, with the two points where Shapes 1 differs from clip-path checked explicitly:

  • the box is a <shape-box> (§2.2), so the three SVG boxes <geometry-box> adds — fill-box, stroke-box, view-box — are not valid here;
  • everything outside <basic-shape> is an alternative to the pair, not a member of it.

The value stays raw text (Shape_outside : string property); typing it would mean a sum of the clip_path shapes plus the whole background_image type, so the reader validates the grammar and hands the source back verbatim. One test_optimize normalization pair moved from shape-outside to clip-path for that reason — a raw-text value is never normalized, so it could not demonstrate what that test asserts.

The vendor-prefixed reader gap filed alongside this one is not included; its pin lives on declaration-vendor-readers and is still failing.

@samoht
samoht force-pushed the declaration-reader-gaps branch from 5124f49 to 5d055ea Compare August 3, 2026 23:32
samoht added 2 commits August 3, 2026 21:26
read_shape_outside inspects only the first component and knows three arms
of the grammar, so most valid values are rejected.
@samoht
samoht force-pushed the declaration-reader-gaps branch from 5d055ea to 7db2f20 Compare August 4, 2026 04:27
@samoht
samoht changed the base branch from main to importance-rebuild-hash August 4, 2026 04:27
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