mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Keep flex items in order
-modified document order in the box tree
This commit is contained in:
parent
67d8aa84d2
commit
29005e1626
2 changed files with 13 additions and 1 deletions
|
@ -185,6 +185,17 @@ where
|
|||
|
||||
fn finish(mut self) -> FlexContainer {
|
||||
self.wrap_any_text_in_anonymous_block_container();
|
||||
|
||||
// https://drafts.csswg.org/css-flexbox/#order-modified-document-order
|
||||
self.children.sort_by_key(|child| match &*child.borrow() {
|
||||
FlexLevelBox::FlexItem(item) => item.style.clone_order(),
|
||||
|
||||
// “Absolutely-positioned children of a flex container are treated
|
||||
// as having order: 0 for the purpose of determining their painting order
|
||||
// relative to flex items.”
|
||||
FlexLevelBox::OutOfFlowAbsolutelyPositionedBox(_) => 0,
|
||||
});
|
||||
|
||||
FlexContainer {
|
||||
children: self.children,
|
||||
}
|
||||
|
|
|
@ -266,7 +266,8 @@ ${helpers.predefined_type(
|
|||
"order",
|
||||
"Integer",
|
||||
"0",
|
||||
engines="gecko servo-2013",
|
||||
engines="gecko servo-2013 servo-2020",
|
||||
servo_2020_pref="layout.flexbox.enabled",
|
||||
extra_prefixes="webkit",
|
||||
animation_value_type="ComputedValue",
|
||||
spec="https://drafts.csswg.org/css-flexbox/#order-property",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue