Merge pull request #3420 from glennw/table-debug

Adds support for table layout trace and updates viewer for tables.
This commit is contained in:
Patrick Walton 2014-09-19 19:50:47 -07:00
commit ccda8f204a
9 changed files with 118 additions and 10 deletions

View file

@ -13,6 +13,7 @@ use context::LayoutContext;
use floats::FloatKind;
use flow::{TableWrapperFlowClass, FlowClass, Flow, ImmutableFlowUtils};
use fragment::Fragment;
use layout_debug;
use model::{Specified, Auto, specified};
use wrapper::ThreadSafeLayoutNode;
@ -21,12 +22,14 @@ use std::cmp::max;
use std::fmt;
use style::computed_values::table_layout;
#[deriving(Encodable)]
pub enum TableLayout {
FixedLayout,
AutoLayout
}
/// A table wrapper flow based on a block formatting context.
#[deriving(Encodable)]
pub struct TableWrapperFlow {
pub block_flow: BlockFlow,
@ -119,6 +122,10 @@ impl Flow for TableWrapperFlow {
self
}
fn as_immutable_table_wrapper<'a>(&'a self) -> &'a TableWrapperFlow {
self
}
fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow {
&mut self.block_flow
}
@ -130,6 +137,9 @@ impl Flow for TableWrapperFlow {
any fragments it is responsible for flowing. */
fn bubble_inline_sizes(&mut self, ctx: &LayoutContext) {
let _scope = layout_debug_scope!("table_wrapper::bubble_inline_sizes {:s}",
self.block_flow.base.debug_id());
// get column inline-sizes info from table flow
for kid in self.block_flow.base.child_iter() {
assert!(kid.is_table_caption() || kid.is_table());
@ -148,6 +158,8 @@ impl Flow for TableWrapperFlow {
/// Dual fragments consume some inline-size first, and the remainder is assigned to all child (block)
/// contexts.
fn assign_inline_sizes(&mut self, ctx: &LayoutContext) {
let _scope = layout_debug_scope!("table_wrapper::assign_inline_sizes {:s}",
self.block_flow.base.debug_id());
debug!("assign_inline_sizes({}): assigning inline_size for flow",
if self.is_float() {
"floated table_wrapper"