Add the aspect-ratio property - #205
Merged
Merged
Conversation
aspect-ratio: [ auto || <ratio> ] (CSS Sizing 4 4.1), where <ratio> = <number [0,inf]> [ / <number [0,inf]> ]?, had no support. Add AspectRatioValueConverter, which validates the grammar - auto, a ratio, or both in either order - and preserves the authored text, and an AspectRatioProperty registered in PropertyFactory. Negative numbers, a missing denominator, a bare slash, three terms and non-number terms are all rejected.
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.
Feature
Adds the
aspect-ratioproperty (CSS Sizing 4 §4.1):autoand the ratio may appear in either order, or either alone (the||combinator).Implementation
A dedicated
AspectRatioValueConvertervalidates the grammar and preserves the authored text. A denominator defaults to1when omitted, negative numbers are rejected, andautomay appear before or after the ratio but not twice.Registered as
AspectRatioPropertyinPropertyFactory.Tests
18 cases in
PropertyTests/AspectRatioProperty.cs:auto,16 / 9,16/9, a single<number>,auto 16 / 9,16 / 9 auto, decimalsnone,16 /,/ 9, three terms, negative,auto auto, two bare numbers, a length instead of a numberinherit/initialThe legal and illegal cases fail on
master(the property is unknown). The full suite (1263 existing tests) stays green, and all seven target frameworks build with no new warnings.