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
Commit 6aa3991
Browse filesBrowse the repository at this point in the historyBrowse files
Add the order property for flex items (#2109) (#60423)
Summary:
* Add the `order` property for flex items
A flex container now lays out its items in order-modified document
order (css-display-4 §3): by ascending `order`, and items with equal
`order` in tree order. The order decides which line an item wraps to,
where it sits on the main axis, and which item a container takes its
baseline from (css-flexbox-1 §8.5). The tree itself does not change.
`order` is an int32_t in `Style`, exposed as `YGNodeStyleSetOrder` and
`YGNodeStyleGetOrder`, `YogaNode.order` in Java and `setOrder` and
`getOrder` in JavaScript, and understood by gentest.
`OrderedChildren` is the list the flex algorithm walks where the order
of items matters: collecting flex lines, aligning multiple lines, and
finding a container's baseline. It is a view of the node's child vector
unless `display: contents` children have to be flattened into it or a
child sets `order`: both copy the children, and the second sorts the
copy. The `order` of an absolutely positioned or `display: none` child
changes nothing, and neither does the `order` of a `display: contents`
node, whose children are ordered among the container's other items.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* Document how to set order and what it leaves alone
The order page gains the setters in C, Java and JavaScript and a list of
limitations: drawing, accessibility and the tree keep tree order, order
applies only to nodes a flex container lays out, and it is an integer.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* Avoid sorting already-ordered children, add capture/benchmark support, and expand order fixtures
- Use std::ranges::is_sorted in OrderedChildren so single-child and already-ordered containers skip copying and sorting.
- Serialize/deserialize order in capture/NodeToString.cpp and benchmark/Benchmark.cpp.
- Add Chrome-generated fixtures for already-sorted items, empty display: contents, and column container baseline.
---------
Changelog:
[General][Added] - Add support for the `order` property on Yoga flex items
Differential Revision: D135257691
Pull Request resolved: #60423
0 commit comments