Remove unused code from gfx and layout crates

This commit is contained in:
est31 2019-05-29 21:16:11 +02:00
parent 8dc7a25893
commit 3efc5e59bc
9 changed files with 2 additions and 222 deletions

View file

@ -35,11 +35,9 @@ use crate::flow_list::{FlowList, FlowListIterator, MutFlowListIterator};
use crate::flow_ref::{FlowRef, WeakFlowRef};
use crate::fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow};
use crate::inline::InlineFlow;
use crate::model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo};
use crate::multicol::MulticolFlow;
use crate::model::{CollapsibleMargins, IntrinsicISizes};
use crate::parallel::FlowParallelInfo;
use crate::table::TableFlow;
use crate::table_caption::TableCaptionFlow;
use crate::table_cell::TableCellFlow;
use crate::table_colgroup::TableColGroupFlow;
use crate::table_row::TableRowFlow;
@ -146,12 +144,6 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
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(&mut self) -> &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(&self) -> &TableWrapperFlow {
panic!("called as_table_wrapper() on a non-tablewrapper flow")
@ -201,24 +193,12 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
panic!("called as_table_row() on a non-tablerow flow")
}
/// If this is a table cell flow, returns the underlying object, borrowed mutably. Fails
/// otherwise.
fn as_mut_table_caption(&mut self) -> &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(&mut self) -> &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(&mut self) -> &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_cell(&self) -> &TableCellFlow {
panic!("called as_table_cell() on a non-tablecell flow")
@ -432,14 +412,6 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
/// Mutably iterates through fragments in this flow.
fn mutate_fragments(&mut self, mutator: &mut dyn FnMut(&mut Fragment));
fn compute_collapsible_block_start_margin(
&mut self,
_layout_context: &mut LayoutContext,
_margin_collapse_info: &mut MarginCollapseInfo,
) {
// The default implementation is a no-op.
}
/// Marks this flow as the root flow. The default implementation is a no-op.
fn mark_as_root(&mut self) {
debug!("called mark_as_root() on a flow of type {:?}", self.class());
@ -530,9 +502,6 @@ pub trait ImmutableFlowUtils {
/// Returns true if this flow is a table caption flow.
fn is_table_caption(self) -> bool;
/// Returns true if this flow is a proper table child.
fn is_proper_table_child(self) -> bool;
/// Returns true if this flow is a table row flow.
fn is_table_row(self) -> bool;
@ -545,18 +514,9 @@ pub trait ImmutableFlowUtils {
/// Returns true if this flow is a table rowgroup flow.
fn is_table_rowgroup(self) -> bool;
/// Returns true if this flow is one of table-related flows.
fn is_table_kind(self) -> bool;
/// Returns true if this flow has no children.
fn is_leaf(self) -> bool;
/// Returns the number of children that this flow possesses.
fn child_count(self) -> usize;
/// Return true if this flow is a Block Container.
fn is_block_container(self) -> bool;
/// Returns true if this flow is a block flow.
fn is_block_flow(self) -> bool;
@ -1205,10 +1165,6 @@ impl BaseFlow {
p as usize
}
pub fn flow_id(&self) -> usize {
return self as *const BaseFlow as usize;
}
pub fn collect_stacking_contexts_for_children(
&mut self,
state: &mut StackingContextCollectionState,
@ -1252,19 +1208,6 @@ impl<'a> ImmutableFlowUtils for &'a dyn Flow {
self.class().is_block_like()
}
/// Returns true if this flow is a proper table child.
/// 'Proper table child' is defined as table-row flow, table-rowgroup flow,
/// table-column-group flow, or table-caption flow.
fn is_proper_table_child(self) -> bool {
match self.class() {
FlowClass::TableRow |
FlowClass::TableRowGroup |
FlowClass::TableColGroup |
FlowClass::TableCaption => true,
_ => false,
}
}
/// Returns true if this flow is a table row flow.
fn is_table_row(self) -> bool {
match self.class() {
@ -1313,47 +1256,11 @@ impl<'a> ImmutableFlowUtils for &'a dyn Flow {
}
}
/// Returns true if this flow is one of table-related flows.
fn is_table_kind(self) -> bool {
match self.class() {
FlowClass::TableWrapper |
FlowClass::Table |
FlowClass::TableColGroup |
FlowClass::TableRowGroup |
FlowClass::TableRow |
FlowClass::TableCaption |
FlowClass::TableCell => true,
_ => false,
}
}
/// Returns true if this flow has no children.
fn is_leaf(self) -> bool {
self.base().children.is_empty()
}
/// Returns the number of children that this flow possesses.
fn child_count(self) -> usize {
self.base().children.len()
}
/// Return true if this flow is a Block Container.
///
/// Except for table fragments and replaced elements, block-level fragments (`BlockFlow`) are
/// also block container fragments.
/// Non-replaced inline blocks and non-replaced table cells are also block
/// containers.
fn is_block_container(self) -> bool {
match self.class() {
// TODO: Change this when inline-blocks are supported.
FlowClass::Block | FlowClass::TableCaption | FlowClass::TableCell => {
// FIXME: Actually check the type of the node
self.child_count() != 0
},
_ => false,
}
}
/// Returns true if this flow is a block flow.
fn is_block_flow(self) -> bool {
match self.class() {