You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
svg: use shared floating-point colour compatibility parser - #3798
Replace the local SVG colour parser/table with craft_svg::color::parse_rgba_compat, retaining EffectCraft's f64 channels and alpha. Existing colour/non-finite tests remain on the production re-export; add exact precision/clamping coverage.
Depends on storytold/craft-libs#1971 at c4e930536c8cf30928024902199b07f721642914. Merge the prerequisite, repin to merged shared main, and rerun hosted gates before merging this consumer.
This is colour parsing only, not full SVG completion. Path geometry, CSS stylesheet integration (#3797), document mapping and rendering remain separate. When reconciling #3797, retain both cutovers and pin a shared main containing both prerequisites.
Compatibility and attribution
Keep transparent, f64 channel/alpha precision, finite-channel clamping, loose legacy grammar and invalid hex handling. Strict quantized shared colour APIs are intentionally not substituted.
Safety change: standalone colour input above 64 MiB now returns None rather than allocating without a cap. Existing invalid-colour caller behavior handles this refusal. Shared storage also caps four arguments/eight hex digits.
Shared primary-author commits preserve Brandon Thomas's original parser and NetterSilver's finite-value guards. The app deletes the duplicate implementation and keeps its regression tests.
Only the craft-svg manifest revision changes. Lock removals reflect craft-svg's already-merged optional raster-codec dependency split, not unrelated dependency upgrades.
No full local Cargo build, Clippy, WASM or app tests run. Independent review and successful relevant hosted checks required. No CI bypass or workflow changes.
Summary by CodeRabbit
Bug Fixes
SVG color values retain fractional channel precision, clamp RGB components outside the supported range, and accept percentage-based components.
Hexadecimal color values with whitespace immediately after # are rejected.
Color parsing is more consistent across the app, including how supported color values are interpreted. These changes help ensure SVG colors are handled predictably across common input formats.
Merged shared integration
Shared #1971 merged as 54715d0b92ca22c031245136da6292f6a101978b. Consumer 99a9af8 merges current app main and repins craft-svg/XML to that merged commit; locked metadata, package formatting and whitespace checks pass. Fresh hosted integration gates required.
Reviewing files that changed from the base of the PR and between 76d98ec and 69b4115.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The SVG color module now re-exports craft-svg’s compatibility parser instead of implementing color parsing locally. The workspace pins a new craft-svg revision. Tests cover selected parser behaviors.
Changes: SVG color parsing
Layer / File(s)
Summary
Use and validate the shared parser Cargo.toml, crates/svg/src/color.rs
The craft-svg dependency revision changes. parse_color now re-exports parse_rgba_compat. Tests cover percentage and fractional RGB values, clamping, and rejection of whitespace after #.
This change moves SVG colour parsing to a shared parser and updates a dependency pin. No concrete defect was found. Hosted build and test checks should still pass before merging.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "svg: use shared floating-point colour compatibility parser" matches the main change. The crates/svg/src/color.rs parse_color function is replaced by a re-export of craft_svg::color::parse_r…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "svg: use shared floating-point colour compatibility parser" matches the main change. The crates/svg/src/color.rs parse_color function is replaced by a re-export of craft_svg::color::parse_rgba_compat, and the local named-color table and parsing helpers are removed. The title is specific, concise, and uses the crate prefix convention. The Cargo.toml revision bump and the lock file changes are supporting changes and need not appear in the title.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Reviewing files that changed from the base of the PR and between d0cbc53 and 76d98ec.
Files ignored due to path filters: 1
Cargo.lock is excluded by !**/*.lock
Files selected for processing: 1
Cargo.toml
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scope
Replace the local SVG colour parser/table with
craft_svg::color::parse_rgba_compat, retaining EffectCraft's f64 channels and alpha. Existing colour/non-finite tests remain on the production re-export; add exact precision/clamping coverage.Depends on storytold/craft-libs#1971 at
c4e930536c8cf30928024902199b07f721642914. Merge the prerequisite, repin to merged shared main, and rerun hosted gates before merging this consumer.This is colour parsing only, not full SVG completion. Path geometry, CSS stylesheet integration (#3797), document mapping and rendering remain separate. When reconciling #3797, retain both cutovers and pin a shared main containing both prerequisites.
Compatibility and attribution
Nonerather than allocating without a cap. Existing invalid-colour caller behavior handles this refusal. Shared storage also caps four arguments/eight hex digits.Validation
Summary by CodeRabbit
#are rejected.Merged shared integration
Shared #1971 merged as 54715d0b92ca22c031245136da6292f6a101978b. Consumer 99a9af8 merges current app main and repins craft-svg/XML to that merged commit; locked metadata, package formatting and whitespace checks pass. Fresh hosted integration gates required.