mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
parent
3d0951cf25
commit
6aaada64dc
15 changed files with 128 additions and 138 deletions
|
@ -451,7 +451,7 @@ impl<'a> PreorderFlowTraversal for AbsoluteAssignBSizesTraversal<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
let block = flow.as_block();
|
||||
let block = flow.as_mut_block();
|
||||
debug_assert!(block.base.flags.contains(IS_ABSOLUTELY_POSITIONED));
|
||||
if !block.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) {
|
||||
return
|
||||
|
@ -845,7 +845,7 @@ impl BlockFlow {
|
|||
if flow::base(kid).flags.is_float() {
|
||||
flow::mut_base(kid).position.start.b = cur_b;
|
||||
{
|
||||
let kid_block = kid.as_block();
|
||||
let kid_block = kid.as_mut_block();
|
||||
kid_block.float.as_mut().unwrap().float_ceiling =
|
||||
margin_collapse_info.current_float_ceiling();
|
||||
}
|
||||
|
@ -1384,7 +1384,7 @@ impl BlockFlow {
|
|||
}
|
||||
|
||||
if kid.is_block_flow() {
|
||||
let kid_block = kid.as_block();
|
||||
let kid_block = kid.as_mut_block();
|
||||
kid_block.inline_size_of_preceding_left_floats =
|
||||
inline_size_of_preceding_left_floats;
|
||||
kid_block.inline_size_of_preceding_right_floats =
|
||||
|
@ -1409,7 +1409,7 @@ impl BlockFlow {
|
|||
// necessary because any percentages are relative to the containing block, which only
|
||||
// we know.
|
||||
if kid.is_inline_flow() {
|
||||
kid.as_inline().first_line_indentation =
|
||||
kid.as_mut_inline().first_line_indentation =
|
||||
specified(self.fragment.style().get_inheritedtext().text_indent,
|
||||
containing_block_size);
|
||||
}
|
||||
|
@ -1501,11 +1501,11 @@ impl Flow for BlockFlow {
|
|||
FlowClass::Block
|
||||
}
|
||||
|
||||
fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
self
|
||||
}
|
||||
|
||||
fn as_immutable_block<'a>(&'a self) -> &'a BlockFlow {
|
||||
fn as_block<'a>(&'a self) -> &'a BlockFlow {
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -2839,4 +2839,3 @@ impl ISizeAndMarginsComputer for FloatReplaced {
|
|||
MaybeAuto::Specified(fragment.content_inline_size())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -480,7 +480,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
absolute_descendants.push_descendants(fragments.absolute_descendants);
|
||||
|
||||
{
|
||||
let inline_flow = inline_flow_ref.as_inline();
|
||||
let inline_flow = inline_flow_ref.as_mut_inline();
|
||||
|
||||
|
||||
let (ascent, descent) =
|
||||
|
@ -802,7 +802,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
}
|
||||
match kid.swap_out_construction_result() {
|
||||
ConstructionResult::None => {}
|
||||
ConstructionResult::Flow(mut flow, kid_abs_descendants) => {
|
||||
ConstructionResult::Flow(flow, kid_abs_descendants) => {
|
||||
if !flow::base(&*flow).flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
// {ib} split. Flush the accumulator to our new split and make a new
|
||||
// accumulator to hold any subsequent fragments we come across.
|
||||
|
@ -1015,7 +1015,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
// Only flows that are table captions are matched here.
|
||||
for kid in node.children() {
|
||||
match kid.swap_out_construction_result() {
|
||||
ConstructionResult::Flow(mut kid_flow, _) => {
|
||||
ConstructionResult::Flow(kid_flow, _) => {
|
||||
if kid_flow.is_table_caption() &&
|
||||
kid_flow.as_block()
|
||||
.fragment
|
||||
|
|
|
@ -76,95 +76,97 @@ pub trait Flow: fmt::Debug + Sync {
|
|||
/// Returns the class of flow that this is.
|
||||
fn class(&self) -> FlowClass;
|
||||
|
||||
/// If this is a block flow, returns the underlying object, borrowed immutably. Fails
|
||||
/// otherwise.
|
||||
fn as_immutable_block<'a>(&'a self) -> &'a BlockFlow {
|
||||
panic!("called as_immutable_block() on a non-block flow")
|
||||
}
|
||||
|
||||
/// If this is a block flow, returns the underlying object. Fails otherwise.
|
||||
fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
debug!("called as_block() on a flow of type {:?}", self.class());
|
||||
fn as_block<'a>(&'a self) -> &'a BlockFlow {
|
||||
panic!("called as_block() on a non-block flow")
|
||||
}
|
||||
|
||||
/// If this is an inline flow, returns the underlying object, borrowed immutably. Fails
|
||||
/// otherwise.
|
||||
fn as_immutable_inline<'a>(&'a self) -> &'a InlineFlow {
|
||||
panic!("called as_immutable_inline() on a non-inline flow")
|
||||
/// If this is a block flow, returns the underlying object, borrowed mutably. Fails otherwise.
|
||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
debug!("called as_mut_block() on a flow of type {:?}", self.class());
|
||||
panic!("called as_mut_block() on a non-block flow")
|
||||
}
|
||||
|
||||
/// If this is an inline flow, returns the underlying object. Fails otherwise.
|
||||
fn as_inline<'a>(&'a mut self) -> &'a mut InlineFlow {
|
||||
fn as_inline<'a>(&'a self) -> &'a InlineFlow {
|
||||
panic!("called as_inline() on a non-inline flow")
|
||||
}
|
||||
|
||||
/// If this is an inline flow, returns the underlying object, borrowed mutably. Fails
|
||||
/// otherwise.
|
||||
fn as_mut_inline<'a>(&'a mut self) -> &'a mut InlineFlow {
|
||||
panic!("called as_mut_inline() on a non-inline flow")
|
||||
}
|
||||
|
||||
/// If this is a table wrapper flow, returns the underlying object, borrowed mutably. Fails
|
||||
/// otherwise.
|
||||
fn as_mut_table_wrapper<'a>(&'a mut self) -> &'a mut TableWrapperFlow {
|
||||
panic!("called as_mut_table_wrapper() on a non-tablewrapper flow")
|
||||
}
|
||||
|
||||
/// If this is a table wrapper flow, returns the underlying object. Fails otherwise.
|
||||
fn as_table_wrapper<'a>(&'a mut self) -> &'a mut TableWrapperFlow {
|
||||
fn as_table_wrapper<'a>(&'a self) -> &'a TableWrapperFlow {
|
||||
panic!("called as_table_wrapper() on a non-tablewrapper flow")
|
||||
}
|
||||
|
||||
/// If this is a table wrapper flow, returns the underlying object, borrowed immutably. Fails
|
||||
/// otherwise.
|
||||
fn as_immutable_table_wrapper<'a>(&'a self) -> &'a TableWrapperFlow {
|
||||
panic!("called as_immutable_table_wrapper() on a non-tablewrapper flow")
|
||||
/// If this is a table flow, returns the underlying object, borrowed mutably. Fails otherwise.
|
||||
fn as_mut_table<'a>(&'a mut self) -> &'a mut TableFlow {
|
||||
panic!("called as_mut_table() on a non-table flow")
|
||||
}
|
||||
|
||||
/// If this is a table flow, returns the underlying object. Fails otherwise.
|
||||
fn as_table<'a>(&'a mut self) -> &'a mut TableFlow {
|
||||
fn as_table<'a>(&'a self) -> &'a TableFlow {
|
||||
panic!("called as_table() on a non-table flow")
|
||||
}
|
||||
|
||||
/// If this is a table flow, returns the underlying object, borrowed immutably. Fails otherwise.
|
||||
fn as_immutable_table<'a>(&'a self) -> &'a TableFlow {
|
||||
panic!("called as_table() on a non-table flow")
|
||||
/// If this is a table colgroup flow, returns the underlying object, borrowed mutably. Fails
|
||||
/// otherwise.
|
||||
fn as_mut_table_colgroup<'a>(&'a mut self) -> &'a mut TableColGroupFlow {
|
||||
panic!("called as_mut_table_colgroup() on a non-tablecolgroup flow")
|
||||
}
|
||||
|
||||
/// If this is a table colgroup flow, returns the underlying object. Fails otherwise.
|
||||
fn as_table_colgroup<'a>(&'a mut self) -> &'a mut TableColGroupFlow {
|
||||
panic!("called as_table_colgroup() on a non-tablecolgroup flow")
|
||||
/// If this is a table rowgroup flow, returns the underlying object, borrowed mutably. Fails
|
||||
/// otherwise.
|
||||
fn as_mut_table_rowgroup<'a>(&'a mut self) -> &'a mut TableRowGroupFlow {
|
||||
panic!("called as_mut_table_rowgroup() on a non-tablerowgroup flow")
|
||||
}
|
||||
|
||||
/// If this is a table rowgroup flow, returns the underlying object. Fails otherwise.
|
||||
fn as_table_rowgroup<'a>(&'a mut self) -> &'a mut TableRowGroupFlow {
|
||||
fn as_table_rowgroup<'a>(&'a self) -> &'a TableRowGroupFlow {
|
||||
panic!("called as_table_rowgroup() on a non-tablerowgroup flow")
|
||||
}
|
||||
|
||||
/// If this is a table rowgroup flow, returns the underlying object, borrowed immutably. Fails
|
||||
/// If this is a table row flow, returns the underlying object, borrowed mutably. Fails
|
||||
/// otherwise.
|
||||
fn as_immutable_table_rowgroup<'a>(&'a self) -> &'a TableRowGroupFlow {
|
||||
panic!("called as_table_rowgroup() on a non-tablerowgroup flow")
|
||||
fn as_mut_table_row<'a>(&'a mut self) -> &'a mut TableRowFlow {
|
||||
panic!("called as_mut_table_row() on a non-tablerow flow")
|
||||
}
|
||||
|
||||
/// If this is a table row flow, returns the underlying object. Fails otherwise.
|
||||
fn as_table_row<'a>(&'a mut self) -> &'a mut TableRowFlow {
|
||||
fn as_table_row<'a>(&'a self) -> &'a TableRowFlow {
|
||||
panic!("called as_table_row() on a non-tablerow flow")
|
||||
}
|
||||
|
||||
/// If this is a table row flow, returns the underlying object, borrowed immutably. Fails
|
||||
/// If this is a table cell flow, returns the underlying object, borrowed mutably. Fails
|
||||
/// otherwise.
|
||||
fn as_immutable_table_row<'a>(&'a self) -> &'a TableRowFlow {
|
||||
panic!("called as_table_row() on a non-tablerow flow")
|
||||
fn as_mut_table_caption<'a>(&'a mut self) -> &'a mut TableCaptionFlow {
|
||||
panic!("called as_mut_table_caption() on a non-tablecaption flow")
|
||||
}
|
||||
|
||||
/// If this is a table cell flow, returns the underlying object, borrowed mutably. Fails
|
||||
/// otherwise.
|
||||
fn as_mut_table_cell<'a>(&'a mut self) -> &'a mut TableCellFlow {
|
||||
panic!("called as_mut_table_cell() on a non-tablecell flow")
|
||||
}
|
||||
|
||||
/// If this is a multicol flow, returns the underlying object, borrowed mutably. Fails
|
||||
/// otherwise.
|
||||
fn as_mut_multicol<'a>(&'a mut self) -> &'a mut MulticolFlow {
|
||||
panic!("called as_mut_multicol() on a non-multicol flow")
|
||||
}
|
||||
|
||||
/// If this is a table cell flow, returns the underlying object. Fails otherwise.
|
||||
fn as_table_caption<'a>(&'a mut self) -> &'a mut TableCaptionFlow {
|
||||
panic!("called as_table_caption() on a non-tablecaption flow")
|
||||
}
|
||||
|
||||
/// If this is a table cell flow, returns the underlying object. Fails otherwise.
|
||||
fn as_table_cell<'a>(&'a mut self) -> &'a mut TableCellFlow {
|
||||
panic!("called as_table_cell() on a non-tablecell flow")
|
||||
}
|
||||
|
||||
/// If this is a multicol flow, returns the underlying object. Fails otherwise.
|
||||
fn as_multicol<'a>(&'a mut self) -> &'a mut MulticolFlow {
|
||||
panic!("called as_multicol() on a non-multicol flow")
|
||||
}
|
||||
|
||||
/// If this is a table cell flow, returns the underlying object, borrowed immutably. Fails
|
||||
/// otherwise.
|
||||
fn as_immutable_table_cell<'a>(&'a self) -> &'a TableCellFlow {
|
||||
fn as_table_cell<'a>(&'a self) -> &'a TableCellFlow {
|
||||
panic!("called as_table_cell() on a non-tablecell flow")
|
||||
}
|
||||
|
||||
|
@ -938,21 +940,13 @@ impl Encodable for BaseFlow {
|
|||
try!(e.emit_struct_field("class", 0, |e| c.class().encode(e)));
|
||||
e.emit_struct_field("data", 1, |e| {
|
||||
match c.class() {
|
||||
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::Block => c.as_block().encode(e),
|
||||
FlowClass::Inline => c.as_inline().encode(e),
|
||||
FlowClass::Table => c.as_table().encode(e),
|
||||
FlowClass::TableWrapper => c.as_table_wrapper().encode(e),
|
||||
FlowClass::TableRowGroup => c.as_table_rowgroup().encode(e),
|
||||
FlowClass::TableRow => c.as_table_row().encode(e),
|
||||
FlowClass::TableCell => c.as_table_cell().encode(e),
|
||||
_ => { Ok(()) } // TODO: Support captions
|
||||
}
|
||||
})
|
||||
|
@ -1452,9 +1446,9 @@ impl ContainingBlockLink {
|
|||
Some(ref link) => {
|
||||
let flow = link.upgrade().unwrap();
|
||||
if flow.is_block_like() {
|
||||
flow.as_immutable_block().explicit_block_containing_size(layout_context)
|
||||
flow.as_block().explicit_block_containing_size(layout_context)
|
||||
} else if flow.is_inline_flow() {
|
||||
Some(flow.as_immutable_inline().minimum_block_size_above_baseline)
|
||||
Some(flow.as_inline().minimum_block_size_above_baseline)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -1637,7 +1637,7 @@ impl Fragment {
|
|||
|
||||
match self.specific {
|
||||
SpecificFragmentInfo::InlineAbsoluteHypothetical(ref mut info) => {
|
||||
let block_flow = info.flow_ref.as_block();
|
||||
let block_flow = info.flow_ref.as_mut_block();
|
||||
block_flow.base.position.size.inline =
|
||||
block_flow.base.intrinsic_inline_sizes.preferred_inline_size;
|
||||
|
||||
|
@ -1645,7 +1645,7 @@ impl Fragment {
|
|||
self.border_box.size.inline = Au(0);
|
||||
}
|
||||
SpecificFragmentInfo::InlineBlock(ref mut info) => {
|
||||
let block_flow = info.flow_ref.as_block();
|
||||
let block_flow = info.flow_ref.as_mut_block();
|
||||
self.border_box.size.inline =
|
||||
max(block_flow.base.intrinsic_inline_sizes.minimum_inline_size,
|
||||
block_flow.base.intrinsic_inline_sizes.preferred_inline_size);
|
||||
|
@ -1653,7 +1653,7 @@ impl Fragment {
|
|||
block_flow.base.block_container_writing_mode = self.style.writing_mode;
|
||||
}
|
||||
SpecificFragmentInfo::InlineAbsolute(ref mut info) => {
|
||||
let block_flow = info.flow_ref.as_block();
|
||||
let block_flow = info.flow_ref.as_mut_block();
|
||||
self.border_box.size.inline =
|
||||
max(block_flow.base.intrinsic_inline_sizes.minimum_inline_size,
|
||||
block_flow.base.intrinsic_inline_sizes.preferred_inline_size);
|
||||
|
@ -1810,7 +1810,7 @@ impl Fragment {
|
|||
}
|
||||
SpecificFragmentInfo::InlineBlock(ref info) => {
|
||||
// See CSS 2.1 § 10.8.1.
|
||||
let block_flow = info.flow_ref.as_immutable_block();
|
||||
let block_flow = info.flow_ref.as_block();
|
||||
let font_style = self.style.get_font_arc();
|
||||
let font_metrics = text::font_metrics_for_style(&mut layout_context.font_context(),
|
||||
font_style);
|
||||
|
|
|
@ -1298,11 +1298,11 @@ impl Flow for InlineFlow {
|
|||
FlowClass::Inline
|
||||
}
|
||||
|
||||
fn as_immutable_inline<'a>(&'a self) -> &'a InlineFlow {
|
||||
fn as_inline<'a>(&'a self) -> &'a InlineFlow {
|
||||
self
|
||||
}
|
||||
|
||||
fn as_inline<'a>(&'a mut self) -> &'a mut InlineFlow {
|
||||
fn as_mut_inline<'a>(&'a mut self) -> &'a mut InlineFlow {
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -1658,7 +1658,7 @@ impl Flow for InlineFlow {
|
|||
SpecificFragmentInfo::InlineBlock(ref mut info) => {
|
||||
flow::mut_base(&mut *info.flow_ref).clip = clip;
|
||||
|
||||
let block_flow = info.flow_ref.as_block();
|
||||
let block_flow = info.flow_ref.as_mut_block();
|
||||
block_flow.base.absolute_position_info = self.base.absolute_position_info;
|
||||
|
||||
let stacking_relative_position = self.base.stacking_relative_position;
|
||||
|
@ -1678,7 +1678,7 @@ impl Flow for InlineFlow {
|
|||
SpecificFragmentInfo::InlineAbsoluteHypothetical(ref mut info) => {
|
||||
flow::mut_base(&mut *info.flow_ref).clip = clip;
|
||||
|
||||
let block_flow = info.flow_ref.as_block();
|
||||
let block_flow = info.flow_ref.as_mut_block();
|
||||
block_flow.base.absolute_position_info = self.base.absolute_position_info;
|
||||
|
||||
block_flow.base.stacking_relative_position =
|
||||
|
@ -1689,7 +1689,7 @@ impl Flow for InlineFlow {
|
|||
SpecificFragmentInfo::InlineAbsolute(ref mut info) => {
|
||||
flow::mut_base(&mut *info.flow_ref).clip = clip;
|
||||
|
||||
let block_flow = info.flow_ref.as_block();
|
||||
let block_flow = info.flow_ref.as_mut_block();
|
||||
block_flow.base.absolute_position_info = self.base.absolute_position_info;
|
||||
|
||||
let stacking_relative_position = self.base.stacking_relative_position;
|
||||
|
|
|
@ -1541,7 +1541,7 @@ fn get_root_flow_background_color(flow: &mut Flow) -> AzColor {
|
|||
return color::transparent()
|
||||
}
|
||||
|
||||
let block_flow = flow.as_block();
|
||||
let block_flow = flow.as_mut_block();
|
||||
let kid = match block_flow.base.children.iter_mut().next() {
|
||||
None => return color::transparent(),
|
||||
Some(kid) => kid,
|
||||
|
|
|
@ -68,11 +68,11 @@ impl Flow for ListItemFlow {
|
|||
FlowClass::ListItem
|
||||
}
|
||||
|
||||
fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
&mut self.block_flow
|
||||
}
|
||||
|
||||
fn as_immutable_block<'a>(&'a self) -> &'a BlockFlow {
|
||||
fn as_block<'a>(&'a self) -> &'a BlockFlow {
|
||||
&self.block_flow
|
||||
}
|
||||
|
||||
|
@ -228,4 +228,3 @@ impl ListStyleTypeContent {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,15 +36,15 @@ impl Flow for MulticolFlow {
|
|||
FlowClass::Multicol
|
||||
}
|
||||
|
||||
fn as_multicol<'a>(&'a mut self) -> &'a mut MulticolFlow {
|
||||
fn as_mut_multicol<'a>(&'a mut self) -> &'a mut MulticolFlow {
|
||||
self
|
||||
}
|
||||
|
||||
fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
&mut self.block_flow
|
||||
}
|
||||
|
||||
fn as_immutable_block<'a>(&'a self) -> &'a BlockFlow {
|
||||
fn as_block<'a>(&'a self) -> &'a BlockFlow {
|
||||
&self.block_flow
|
||||
}
|
||||
|
||||
|
|
|
@ -191,19 +191,19 @@ impl Flow for TableFlow {
|
|||
FlowClass::Table
|
||||
}
|
||||
|
||||
fn as_table<'a>(&'a mut self) -> &'a mut TableFlow {
|
||||
fn as_mut_table<'a>(&'a mut self) -> &'a mut TableFlow {
|
||||
self
|
||||
}
|
||||
|
||||
fn as_immutable_table<'a>(&'a self) -> &'a TableFlow {
|
||||
fn as_table<'a>(&'a self) -> &'a TableFlow {
|
||||
self
|
||||
}
|
||||
|
||||
fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
&mut self.block_flow
|
||||
}
|
||||
|
||||
fn as_immutable_block(&self) -> &BlockFlow {
|
||||
fn as_block(&self) -> &BlockFlow {
|
||||
&self.block_flow
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ impl Flow for TableFlow {
|
|||
let mut iterator = self.block_flow.base.child_iter().peekable();
|
||||
while let Some(kid) = iterator.next() {
|
||||
if kid.is_table_colgroup() {
|
||||
for specified_inline_size in &kid.as_table_colgroup().inline_sizes {
|
||||
for specified_inline_size in &kid.as_mut_table_colgroup().inline_sizes {
|
||||
self.column_intrinsic_inline_sizes.push(ColumnIntrinsicInlineSize {
|
||||
minimum_length: match *specified_inline_size {
|
||||
LengthOrPercentageOrAuto::Auto |
|
||||
|
@ -293,12 +293,12 @@ impl Flow for TableFlow {
|
|||
Some(next_sibling) => {
|
||||
if next_sibling.is_table_rowgroup() {
|
||||
NextBlockCollapsedBorders::FromNextRow(
|
||||
&next_sibling.as_immutable_table_rowgroup()
|
||||
&next_sibling.as_table_rowgroup()
|
||||
.preliminary_collapsed_borders
|
||||
.block_start)
|
||||
} else {
|
||||
NextBlockCollapsedBorders::FromNextRow(
|
||||
&next_sibling.as_immutable_table_row()
|
||||
&next_sibling.as_table_row()
|
||||
.preliminary_collapsed_borders
|
||||
.block_start)
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ impl Flow for TableFlow {
|
|||
}
|
||||
};
|
||||
perform_border_collapse_for_row(
|
||||
kid.as_table_row(),
|
||||
kid.as_mut_table_row(),
|
||||
table_inline_collapsed_borders.as_ref().unwrap(),
|
||||
previous_collapsed_block_end_borders,
|
||||
next_collapsed_borders_in_block_direction,
|
||||
|
@ -330,12 +330,12 @@ impl Flow for TableFlow {
|
|||
Some(grandkid_next_sibling) => {
|
||||
if grandkid_next_sibling.is_table_rowgroup() {
|
||||
NextBlockCollapsedBorders::FromNextRow(
|
||||
&grandkid_next_sibling.as_immutable_table_rowgroup()
|
||||
&grandkid_next_sibling.as_table_rowgroup()
|
||||
.preliminary_collapsed_borders
|
||||
.block_start)
|
||||
} else {
|
||||
NextBlockCollapsedBorders::FromNextRow(
|
||||
&grandkid_next_sibling.as_immutable_table_row()
|
||||
&grandkid_next_sibling.as_table_row()
|
||||
.preliminary_collapsed_borders
|
||||
.block_start)
|
||||
}
|
||||
|
@ -359,7 +359,7 @@ impl Flow for TableFlow {
|
|||
self.table_layout);
|
||||
if collapsing_borders {
|
||||
perform_border_collapse_for_row(
|
||||
grandkid.as_table_row(),
|
||||
grandkid.as_mut_table_row(),
|
||||
table_inline_collapsed_borders.as_ref().unwrap(),
|
||||
previous_collapsed_block_end_borders,
|
||||
next_collapsed_borders_in_block_direction,
|
||||
|
@ -480,12 +480,12 @@ impl Flow for TableFlow {
|
|||
column_computed_inline_sizes,
|
||||
&spacing_per_cell);
|
||||
if child_flow.is_table_row() {
|
||||
let child_table_row = child_flow.as_table_row();
|
||||
let child_table_row = child_flow.as_mut_table_row();
|
||||
child_table_row.populate_collapsed_border_spacing(
|
||||
collapsed_inline_direction_border_widths_for_table,
|
||||
&mut collapsed_block_direction_border_widths_for_table);
|
||||
} else if child_flow.is_table_rowgroup() {
|
||||
let child_table_rowgroup = child_flow.as_table_rowgroup();
|
||||
let child_table_rowgroup = child_flow.as_mut_table_rowgroup();
|
||||
child_table_rowgroup.populate_collapsed_border_spacing(
|
||||
collapsed_inline_direction_border_widths_for_table,
|
||||
&mut collapsed_block_direction_border_widths_for_table);
|
||||
|
|
|
@ -36,15 +36,15 @@ impl Flow for TableCaptionFlow {
|
|||
FlowClass::TableCaption
|
||||
}
|
||||
|
||||
fn as_table_caption<'a>(&'a mut self) -> &'a mut TableCaptionFlow {
|
||||
fn as_mut_table_caption<'a>(&'a mut self) -> &'a mut TableCaptionFlow {
|
||||
self
|
||||
}
|
||||
|
||||
fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
&mut self.block_flow
|
||||
}
|
||||
|
||||
fn as_immutable_block(&self) -> &BlockFlow {
|
||||
fn as_block(&self) -> &BlockFlow {
|
||||
&self.block_flow
|
||||
}
|
||||
|
||||
|
@ -108,4 +108,3 @@ impl fmt::Debug for TableCaptionFlow {
|
|||
write!(f, "TableCaptionFlow: {:?}", self.block_flow)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,19 +84,19 @@ impl Flow for TableCellFlow {
|
|||
FlowClass::TableCell
|
||||
}
|
||||
|
||||
fn as_table_cell<'a>(&'a mut self) -> &'a mut TableCellFlow {
|
||||
fn as_mut_table_cell<'a>(&'a mut self) -> &'a mut TableCellFlow {
|
||||
self
|
||||
}
|
||||
|
||||
fn as_immutable_table_cell<'a>(&'a self) -> &'a TableCellFlow {
|
||||
fn as_table_cell<'a>(&'a self) -> &'a TableCellFlow {
|
||||
self
|
||||
}
|
||||
|
||||
fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
&mut self.block_flow
|
||||
}
|
||||
|
||||
fn as_immutable_block(&self) -> &BlockFlow {
|
||||
fn as_block(&self) -> &BlockFlow {
|
||||
&self.block_flow
|
||||
}
|
||||
|
||||
|
@ -354,4 +354,3 @@ impl CollapsedBordersForCell {
|
|||
*border_styles = logical_border_styles.to_physical(writing_mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ impl Flow for TableColGroupFlow {
|
|||
FlowClass::TableColGroup
|
||||
}
|
||||
|
||||
fn as_table_colgroup<'a>(&'a mut self) -> &'a mut TableColGroupFlow {
|
||||
fn as_mut_table_colgroup<'a>(&'a mut self) -> &'a mut TableColGroupFlow {
|
||||
self
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ impl TableRowFlow {
|
|||
}
|
||||
|
||||
{
|
||||
let child_fragment = kid.as_table_cell().fragment();
|
||||
let child_fragment = kid.as_mut_table_cell().fragment();
|
||||
// TODO: Percentage block-size
|
||||
let child_specified_block_size =
|
||||
MaybeAuto::from_style(child_fragment.style().content_block_size(),
|
||||
|
@ -153,7 +153,7 @@ impl TableRowFlow {
|
|||
|
||||
// Assign the block-size of kid fragments, which is the same value as own block-size.
|
||||
for kid in self.block_flow.base.child_iter() {
|
||||
let child_table_cell = kid.as_table_cell();
|
||||
let child_table_cell = kid.as_mut_table_cell();
|
||||
{
|
||||
let kid_fragment = child_table_cell.mut_fragment();
|
||||
let mut position = kid_fragment.border_box;
|
||||
|
@ -194,19 +194,19 @@ impl Flow for TableRowFlow {
|
|||
FlowClass::TableRow
|
||||
}
|
||||
|
||||
fn as_table_row<'a>(&'a mut self) -> &'a mut TableRowFlow {
|
||||
fn as_mut_table_row<'a>(&'a mut self) -> &'a mut TableRowFlow {
|
||||
self
|
||||
}
|
||||
|
||||
fn as_immutable_table_row<'a>(&'a self) -> &'a TableRowFlow {
|
||||
fn as_table_row<'a>(&'a self) -> &'a TableRowFlow {
|
||||
self
|
||||
}
|
||||
|
||||
fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
&mut self.block_flow
|
||||
}
|
||||
|
||||
fn as_immutable_block(&self) -> &BlockFlow {
|
||||
fn as_block(&self) -> &BlockFlow {
|
||||
&self.block_flow
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ impl Flow for TableRowFlow {
|
|||
let child_specified_inline_size;
|
||||
let child_column_span;
|
||||
{
|
||||
let child_table_cell = kid.as_table_cell();
|
||||
let child_table_cell = kid.as_mut_table_cell();
|
||||
child_specified_inline_size = child_table_cell.block_flow
|
||||
.fragment
|
||||
.style
|
||||
|
@ -685,18 +685,18 @@ pub fn propagate_column_inline_sizes_to_child(
|
|||
// FIXME(pcwalton): This seems inefficient. Reference count it instead?
|
||||
match child_flow.class() {
|
||||
FlowClass::Table => {
|
||||
let child_table_flow = child_flow.as_table();
|
||||
let child_table_flow = child_flow.as_mut_table();
|
||||
child_table_flow.column_computed_inline_sizes = column_computed_inline_sizes.to_vec();
|
||||
}
|
||||
FlowClass::TableRowGroup => {
|
||||
let child_table_rowgroup_flow = child_flow.as_table_rowgroup();
|
||||
let child_table_rowgroup_flow = child_flow.as_mut_table_rowgroup();
|
||||
child_table_rowgroup_flow.column_computed_inline_sizes =
|
||||
column_computed_inline_sizes.to_vec();
|
||||
child_table_rowgroup_flow.spacing = *border_spacing;
|
||||
child_table_rowgroup_flow.table_writing_mode = table_writing_mode;
|
||||
}
|
||||
FlowClass::TableRow => {
|
||||
let child_table_row_flow = child_flow.as_table_row();
|
||||
let child_table_row_flow = child_flow.as_mut_table_row();
|
||||
child_table_row_flow.column_computed_inline_sizes =
|
||||
column_computed_inline_sizes.to_vec();
|
||||
child_table_row_flow.spacing = *border_spacing;
|
||||
|
@ -725,7 +725,7 @@ fn set_inline_position_of_child_flow(
|
|||
let reverse_column_order = table_writing_mode.is_bidi_ltr() != row_writing_mode.is_bidi_ltr();
|
||||
|
||||
// Handle border collapsing, if necessary.
|
||||
let child_table_cell = child_flow.as_table_cell();
|
||||
let child_table_cell = child_flow.as_mut_table_cell();
|
||||
match *border_collapse_info {
|
||||
Some(ref border_collapse_info) => {
|
||||
// Write in the child's border collapse state.
|
||||
|
@ -821,7 +821,7 @@ fn perform_inline_direction_border_collapse_for_row(
|
|||
CollapsedBorderProvenance::FromPreviousTableCell));
|
||||
|
||||
if let Some(&(_, ref next_child_flow)) = iterator.peek() {
|
||||
let next_child_flow = next_child_flow.as_immutable_block();
|
||||
let next_child_flow = next_child_flow.as_block();
|
||||
inline_collapsed_border.combine(
|
||||
&CollapsedBorder::inline_start(&*next_child_flow.fragment.style,
|
||||
CollapsedBorderProvenance::FromNextTableCell))
|
||||
|
|
|
@ -112,19 +112,19 @@ impl Flow for TableRowGroupFlow {
|
|||
FlowClass::TableRowGroup
|
||||
}
|
||||
|
||||
fn as_table_rowgroup<'a>(&'a mut self) -> &'a mut TableRowGroupFlow {
|
||||
fn as_mut_table_rowgroup<'a>(&'a mut self) -> &'a mut TableRowGroupFlow {
|
||||
self
|
||||
}
|
||||
|
||||
fn as_immutable_table_rowgroup<'a>(&'a self) -> &'a TableRowGroupFlow {
|
||||
fn as_table_rowgroup<'a>(&'a self) -> &'a TableRowGroupFlow {
|
||||
self
|
||||
}
|
||||
|
||||
fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
&mut self.block_flow
|
||||
}
|
||||
|
||||
fn as_immutable_block(&self) -> &BlockFlow {
|
||||
fn as_block(&self) -> &BlockFlow {
|
||||
&self.block_flow
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ impl Flow for TableRowGroupFlow {
|
|||
&border_spacing);
|
||||
|
||||
if border_collapse == border_collapse::T::collapse {
|
||||
let child_table_row = child_flow.as_table_row();
|
||||
let child_table_row = child_flow.as_mut_table_row();
|
||||
child_table_row.populate_collapsed_border_spacing(
|
||||
collapsed_inline_direction_border_widths_for_table,
|
||||
&mut collapsed_block_direction_border_widths_for_table);
|
||||
|
|
|
@ -99,7 +99,7 @@ impl TableWrapperFlow {
|
|||
continue
|
||||
}
|
||||
|
||||
let kid_table = kid.as_table();
|
||||
let kid_table = kid.as_mut_table();
|
||||
let kid_block_flow = &mut kid_table.block_flow;
|
||||
kid_block_flow.fragment
|
||||
.compute_border_and_padding(available_inline_size,
|
||||
|
@ -265,19 +265,19 @@ impl Flow for TableWrapperFlow {
|
|||
FlowClass::TableWrapper
|
||||
}
|
||||
|
||||
fn as_table_wrapper<'a>(&'a mut self) -> &'a mut TableWrapperFlow {
|
||||
fn as_mut_table_wrapper<'a>(&'a mut self) -> &'a mut TableWrapperFlow {
|
||||
self
|
||||
}
|
||||
|
||||
fn as_immutable_table_wrapper<'a>(&'a self) -> &'a TableWrapperFlow {
|
||||
fn as_table_wrapper<'a>(&'a self) -> &'a TableWrapperFlow {
|
||||
self
|
||||
}
|
||||
|
||||
fn as_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
fn as_mut_block<'a>(&'a mut self) -> &'a mut BlockFlow {
|
||||
&mut self.block_flow
|
||||
}
|
||||
|
||||
fn as_immutable_block<'a>(&'a self) -> &'a BlockFlow {
|
||||
fn as_block<'a>(&'a self) -> &'a BlockFlow {
|
||||
&self.block_flow
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue