-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Layout: Continue support incremental box tree reconstruction for flex&taffy level box #37854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Layout: Continue support incremental box tree reconstruction for flex&taffy level box #37854
Conversation
if is_abspos { | ||
return Some(ModernItem { | ||
kind: ModernItemKind::ReusedBox(layout_box), | ||
order: 0, | ||
box_slot: Some(box_slot), | ||
}); | ||
} else { | ||
return Some(ModernItem { | ||
kind: ModernItemKind::ReusedBox(layout_box), | ||
order: info.style.clone_order(), | ||
box_slot: Some(box_slot), | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems simpler to not repeat:
if is_abspos { | |
return Some(ModernItem { | |
kind: ModernItemKind::ReusedBox(layout_box), | |
order: 0, | |
box_slot: Some(box_slot), | |
}); | |
} else { | |
return Some(ModernItem { | |
kind: ModernItemKind::ReusedBox(layout_box), | |
order: info.style.clone_order(), | |
}); | |
} | |
let order = if is_abspos { | |
0 | |
} else { | |
info.style.clone_order() | |
}; | |
return Some(ModernItem { | |
kind: ModernItemKind::ReusedBox(layout_box), | |
order, | |
box_slot: Some(box_slot), | |
}); |
if is_abspos { | ||
Some(ModernItem { | ||
kind: ModernItemKind::OutOfFlow, | ||
kind: ModernItemKind::OutOfFlow(formatting_context), | ||
order: 0, | ||
box_slot: Some(box_slot), | ||
formatting_context, | ||
}) | ||
} else { | ||
Some(ModernItem { | ||
kind: ModernItemKind::InFlow, | ||
kind: ModernItemKind::InFlow(formatting_context), | ||
order: info.style.clone_order(), | ||
box_slot: Some(box_slot), | ||
formatting_context, | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, while you are at it
components/layout/flexbox/mod.rs
Outdated
ArcRefCell::new(FlexLevelBox::OutOfFlowAbsolutelyPositionedBox 8000 span>(abs_pos_box)) | ||
}, | ||
ModernItemKind::ReusedBox(layout_box) => match layout_box { | ||
LayoutBox::FlexLevel(flex_level_box) => flex_level_box.clone(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The clone() seems unnecessary
components/layout/taffy/mod.rs
Outdated
)) | ||
}, | ||
ModernItemKind::ReusedBox(layout_box) => match layout_box { | ||
LayoutBox::TaffyItemBox(taffy_item_box) => taffy_item_box.clone(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The clone() seems unnecessary
.take_layout_box_if_undamaged(info.damage) | ||
.and_then(|layout_box| match &layout_box { | ||
LayoutBox::FlexLevel(_) | LayoutBox::TaffyItemBox(_) => { | ||
return Some(layout_box); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint is complaining
0d8f385
to
134d947
Compare
Lint still failing |
134d947
to
4b663fc
Compare
Still failing 😅 |
…evel box This change reuse the flex/taffy level box from old box slot if the box slot is valid and there is no LayoutDamage to the element. Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
4b663fc
to
edd0d82
Compare
I left too late last night and didn't have a computer on hand, so I had to try to make changes on my phone. As expected, I couldn't make all the changes. |
Layout: Continue support incremental box tree reconstruction for flex&taffy level box
This change reuse the flex/taffy level box from old box slot if the box slot is valid and there is no LayoutDamage to the element.
Testing: This should not change observable behavior and is thus covered by existing WPT tests.