Skip to content

fix(css): preserve geometry-box values in mask shorthand parsing#27680

Open
anthonybaldwin wants to merge 1 commit intooven-sh:mainfrom
anthonybaldwin:main
Open

fix(css): preserve geometry-box values in mask shorthand parsing#27680
anthonybaldwin wants to merge 1 commit intooven-sh:mainfrom
anthonybaldwin:main

Conversation

@anthonybaldwin
Copy link

What does this PR do?

Wrap parse calls in Mask.parse() with input.tryParse() to restore parser state on failure, matching the pattern used in background.zig (#L55-L105). Without this, failed parsers consume tokens before returning errors, causing geometry-box values (padding-box, content-box) to be silently dropped and rules with different geometry boxes to be incorrectly merged.

How did you verify your code works?

Ran test/bundler/css/mask-geometry-box.test.ts against the fixed build and against v1.3.10 + v1.3.11-canary.60:

  • Fixed build: 2 pass, 0 fail
    • All existing CSS bundler tests pass (166 tests across 8 files)
  • v1.3.10 / v1.3.11-canary.60: 0 pass, 2 fail
    • confirms geometry-box values (padding-box, content-box) are stripped and rules are incorrectly merged
Wrap parse calls in `Mask.parse()` with `input.tryParse()` to restore
parser state on failure, matching the pattern used in `background.zig`.
Without this, failed parsers consume tokens before returning errors,
causing `geometry-box` values (`padding-box`, `content-box`) to be
silently dropped and rules with different geometry boxes to be
incorrectly merged.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2cae6c3 and 39ae88a.

📒 Files selected for processing (2)
  • src/css/properties/masking.zig
  • test/bundler/css/mask-geometry-box.test.ts

Walkthrough

Modified mask property parsing in Zig to use tryParse instead of synchronous parse calls for image, position, repeat, origin, clip, composite, and mode fields. Added new test file with CSS bundling tests for mask-geometry-box and webkit-mask properties.

Changes

Cohort / File(s) Summary
Mask property parsing refactoring
src/css/properties/masking.zig
Replaced synchronous parse calls with tryParse for mask parsing fields (image, position, repeat, origin, clip, composite, mode). Control flow remains unchanged. Lines changed: +7/-7.
CSS mask-geometry-box tests
test/bundler/css/mask-geometry-box.test.ts
Added new test module with two bundling tests: one for mask with padding-box and content-box keywords to verify selectors are not merged, and another for -webkit-mask with padding-box. Lines changed: +44/-0.
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: wrapping parse calls with tryParse to preserve geometry-box values in mask shorthand parsing.
Description check ✅ Passed The description includes both required sections with clear explanations of what the PR does and how it was verified with specific test results.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant