layout: Rewrite the anonymous table object generation code.

This patch introduces a "legalizer", which encapsulates all the
anonymous flow generation logic in one place. The legalizer knows how
to, for example, place adjacent blocks with `display: table-cell` in the
same table row.

Improves etsy.com.

Closes #13782.
This commit is contained in:
Patrick Walton 2016-10-24 18:07:39 -07:00
parent 3d645a9253
commit bc2f5864bc
2 changed files with 284 additions and 66 deletions

View file

@ -949,6 +949,30 @@ impl Fragment {
}
}
/// Creates an anonymous fragment just like this one but with the given style and fragment
/// type. For the new anonymous fragment, layout-related values (border box, etc.) are reset to
/// initial values.
pub fn create_similar_anonymous_fragment(&self,
style: Arc<ServoComputedValues>,
specific: SpecificFragmentInfo)
-> Fragment {
let writing_mode = style.writing_mode;
Fragment {
node: self.node,
style: style,
selected_style: self.selected_style.clone(),
restyle_damage: self.restyle_damage,
border_box: LogicalRect::zero(writing_mode),
border_padding: LogicalMargin::zero(writing_mode),
margin: LogicalMargin::zero(writing_mode),
specific: specific,
inline_context: None,
pseudo: self.pseudo,
debug_id: DebugId::new(),
stacking_context_id: StackingContextId::new(0),
}
}
/// Transforms this fragment into another fragment of the given type, with the given size,
/// preserving all the other data.
pub fn transform(&self, size: LogicalSize<Au>, info: SpecificFragmentInfo)