mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +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
|
@ -113,14 +113,21 @@ impl FlexContainer {
|
|||
.into_iter()
|
||||
.map(|item| {
|
||||
let box_ = match item.kind {
|
||||
ModernItemKind::InFlow => ArcRefCell::new(FlexLevelBox::FlexItem(
|
||||
FlexItemBox::new(item.formatting_context),
|
||||
)),
|
||||
ModernItemKind::OutOfFlow => {
|
||||
let abs_pos_box =
|
||||
ArcRefCell::new(AbsolutelyPositionedBox::new(item.formatting_context));
|
||||
ModernItemKind::InFlow(independent_formatting_context) => ArcRefCell::new(
|
||||
FlexLevelBox::FlexItem(FlexItemBox::new(independent_formatting_context)),
|
||||
),
|
||||
ModernItemKind::OutOfFlow(independent_formatting_context) => {
|
||||
let abs_pos_box = ArcRefCell::new(AbsolutelyPositionedBox::new(
|
||||
independent_formatting_context,
|
||||
));
|
||||
ArcRefCell::new(FlexLevelBox::OutOfFlowAbsolutelyPositionedBox(abs_pos_box))
|
||||
},
|
||||
ModernItemKind::ReusedBox(layout_box) => match layout_box {
|
||||
LayoutBox::FlexLevel(flex_level_box) => flex_level_box,
|
||||
_ => unreachable!(
|
||||
"Undamaged flex level element should be associated with flex level box"
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
if let Some(box_slot) = item.box_slot {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue