Implement flex-wrap: balance and flex-line-count (CSS Flexbox Level 2) - #12
Open
nicoburns wants to merge 2 commits into
Open
Implement flex-wrap: balance and flex-line-count (CSS Flexbox Level 2)#12nicoburns wants to merge 2 commits into
flex-wrap: balance and flex-line-count (CSS Flexbox Level 2)#12nicoburns wants to merge 2 commits into
Conversation
…el 2 Adds the full Level 2 flex-wrap grammar (nowrap | [ wrap | wrap-reverse ] || balance) with Balance and WrapReverseBalance computed values, and a new flex-line-count longhand (positive integer, initial 1). Both are Servo-only, gated behind the new layout.flexbox.balance pref, and disabled for Gecko.
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
Implements the CSS Flexbox Level 2 balancing features, Servo-only and gated behind a new
layout.flexbox.balancepref (default off):flex-wrapnow parses the full Level 2 grammarnowrap | [ wrap | wrap-reverse ] || balance. The property switches from a generated keyword property to a customspecified::FlexWraptype (which is also the computed value) with two new variants:wrap balance,balance wrap, and barebalanceall compute toBalance;wrap-reverse balancecomputes toWrapReverseBalance;nowrap balanceis rejected. Serialization round-trips to the canonical formsbalance/wrap-reverse balance. Thebalancekeyword only parses whenlayout.flexbox.balanceis enabled (always false on Gecko builds).flex-line-countlonghand (positive<integer>, initial1, animatable by computed value),engine = "servo"withservo_pref = "layout.flexbox.balance", per https://drafts.csswg.org/css-flexbox-2/#flex-line-count-property.Gecko compatibility: since
flex-wrapis no longer a keyword property,gecko.mako.rsgains manualset/copy/reset/clone_flex_wrapimpls mapping toStyleFlexWrap(the balance variants, unreachable on Gecko, fall back toWrap/WrapReverse).flex-line-countis skipped entirely for Gecko.Verified with
cargo build --features servo; consumed by DioxusLabs/blitz to plumb both properties through to Taffy's balancing implementation (DioxusLabs/taffy#1105).Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/b7bd5b365d054b87a6053872323832b2
Requested by: @nicoburns