compositing: Implement display ports and avoid creating display lists

for items outside it.

This improves Servo's performance on large pages.
This commit is contained in:
Patrick Walton 2015-05-13 17:13:59 -07:00
parent acb9824229
commit 6a197719b3
26 changed files with 340 additions and 66 deletions

View file

@ -271,7 +271,7 @@ pub trait Flow: fmt::Debug + Sync {
}
/// Phase 4 of reflow: computes absolute positions.
fn compute_absolute_position(&mut self) {
fn compute_absolute_position(&mut self, _: &LayoutContext) {
// The default implementation is a no-op.
}
@ -859,6 +859,12 @@ pub struct BaseFlow {
/// The clipping region for this flow and its descendants, in layer coordinates.
pub clip: ClippingRegion,
/// The stacking-relative position of the display port.
///
/// FIXME(pcwalton): This might be faster as an Arc, since this varies only
/// per-stacking-context.
pub stacking_relative_position_of_display_port: Rect<Au>,
/// The results of display list building for this flow.
pub display_list_building_result: DisplayListBuildingResult,
@ -909,10 +915,18 @@ impl Encodable for BaseFlow {
FlowClass::Block => c.as_immutable_block().encode(e),
FlowClass::Inline => c.as_immutable_inline().encode(e),
FlowClass::Table => c.as_immutable_table().encode(e),
FlowClass::TableWrapper => c.as_immutable_table_wrapper().encode(e),
FlowClass::TableRowGroup => c.as_immutable_table_rowgroup().encode(e),
FlowClass::TableRow => c.as_immutable_table_row().encode(e),
FlowClass::TableCell => c.as_immutable_table_cell().encode(e),
FlowClass::TableWrapper => {
c.as_immutable_table_wrapper().encode(e)
}
FlowClass::TableRowGroup => {
c.as_immutable_table_rowgroup().encode(e)
}
FlowClass::TableRow => {
c.as_immutable_table_row().encode(e)
}
FlowClass::TableCell => {
c.as_immutable_table_cell().encode(e)
}
_ => { Ok(()) } // TODO: Support captions
}
})
@ -1024,6 +1038,7 @@ impl BaseFlow {
display_list_building_result: DisplayListBuildingResult::None,
absolute_position_info: AbsolutePositionInfo::new(writing_mode),
clip: ClippingRegion::max(),
stacking_relative_position_of_display_port: Rect::zero(),
flags: flags,
writing_mode: writing_mode,
thread_id: 0,