mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Layout: Continue support incremental box tree reconstruction for flex&taffy level box (#37854)
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. Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
This commit is contained in:
parent
934b3341d7
commit
068406ee6e
3 changed files with 59 additions and 32 deletions
|
@ -46,16 +46,23 @@ impl TaffyContainer {
|
|||
.into_iter()
|
||||
.map(|item| {
|
||||
let box_ = match item.kind {
|
||||
ModernItemKind::InFlow => ArcRefCell::new(TaffyItemBox::new(
|
||||
TaffyItemBoxInner::InFlowBox(item.formatting_context),
|
||||
)),
|
||||
ModernItemKind::OutOfFlow => {
|
||||
let abs_pos_box =
|
||||
ArcRefCell::new(AbsolutelyPositionedBox::new(item.formatting_context));
|
||||
ModernItemKind::InFlow(independent_formatting_context) => {
|
||||
ArcRefCell::new(TaffyItemBox::new(TaffyItemBoxInner::InFlowBox(
|
||||
independent_formatting_context,
|
||||
)))
|
||||
},
|
||||
ModernItemKind::OutOfFlow(independent_formatting_context) => {
|
||||
let abs_pos_box = ArcRefCell::new(AbsolutelyPositionedBox::new(
|
||||
independent_formatting_context,
|
||||
));
|
||||
ArcRefCell::new(TaffyItemBox::new(
|
||||
TaffyItemBoxInner::OutOfFlowAbsolutelyPositionedBox(abs_pos_box),
|
||||
))
|
||||
},
|
||||
ModernItemKind::ReusedBox(layout_box) => match layout_box {
|
||||
LayoutBox::TaffyItemBox(taffy_item_box) => taffy_item_box,
|
||||
_ => unreachable!("Undamaged taffy level element should be associated with taffy level box"),
|
||||
},
|
||||
};
|
||||
|
||||
if let Some(box_slot) = item.box_slot {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue