Fix panic when html element has display: table.

This commit is contained in:
Glenn Watson 2015-07-31 16:40:06 +10:00
parent e458dca65b
commit 7dbffeed20
5 changed files with 24 additions and 1 deletions

View file

@ -295,7 +295,10 @@ pub trait Flow: fmt::Debug + Sync {
}
/// Marks this flow as the root flow. The default implementation is a no-op.
fn mark_as_root(&mut self) {}
fn mark_as_root(&mut self) {
debug!("called mark_as_root() on a flow of type {:?}", self.class());
panic!("called mark_as_root() on an unhandled flow");
}
// Note that the following functions are mostly called using static method
// dispatch, so it's ok to have them in this trait. Plus, they have

View file

@ -74,6 +74,10 @@ impl Flow for ListItemFlow {
&mut self.block_flow
}
fn as_immutable_block<'a>(&'a self) -> &'a BlockFlow {
&self.block_flow
}
fn bubble_inline_sizes(&mut self) {
// The marker contributes no intrinsic inline-size, so…
self.block_flow.bubble_inline_sizes()

View file

@ -48,6 +48,10 @@ impl Flow for MulticolFlow {
&mut self.block_flow
}
fn as_immutable_block<'a>(&'a self) -> &'a BlockFlow {
&self.block_flow
}
fn bubble_inline_sizes(&mut self) {
// FIXME(SimonSapin) http://dev.w3.org/csswg/css-sizing/#multicol-intrinsic
self.block_flow.bubble_inline_sizes();

View file

@ -210,6 +210,10 @@ impl Flow for TableFlow {
&self.block_flow
}
fn mark_as_root(&mut self) {
self.block_flow.mark_as_root();
}
fn column_intrinsic_inline_sizes<'a>(&'a mut self) -> &'a mut Vec<ColumnIntrinsicInlineSize> {
&mut self.column_intrinsic_inline_sizes
}

View file

@ -273,6 +273,14 @@ impl Flow for TableWrapperFlow {
&mut self.block_flow
}
fn as_immutable_block<'a>(&'a self) -> &'a BlockFlow {
&self.block_flow
}
fn mark_as_root(&mut self) {
self.block_flow.mark_as_root();
}
fn bubble_inline_sizes(&mut self) {
// Get the intrinsic column inline-sizes info from the table flow.
for kid in self.block_flow.base.child_iter() {