st-theme-node: Allow unitless integers for background-blur property#13827
Open
vinayakrastogi wants to merge 2 commits into
Open
st-theme-node: Allow unitless integers for background-blur property#13827vinayakrastogi wants to merge 2 commits into
vinayakrastogi wants to merge 2 commits into
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Previously, theme developers might encounter parsing issues or strict requirements if they attempted to define blur radii without explicit length units (like px). By supporting NUM_GENERIC types for the -blur property, this change improves developer ergonomics and makes the theme parser more forgiving and robust. It aligns the parser more closely with expected CSS/SASS behaviors where unitless integers are frequently used for scaling or rendering properties.
How was this implemented?
Added a new property check for -blur inside _st_theme_node_ensure_background.
The parser now explicitly checks if the CSS declaration value (decl->value) is a raw number (TERM_NUMBER & NUM_GENERIC).
If it is a unitless integer, it safely casts and assigns it directly to node->background_blur.
If it is not a generic number (e.g., it has a px or em unit), it smoothly falls back to the existing get_length_from_term_int helper function to resolve the value.