layout: Rename FlowData to BaseFlow to match other types

This commit is contained in:
Patrick Walton 2014-01-08 21:45:18 -08:00
parent 81769b4c4e
commit ff213b6ad7
4 changed files with 23 additions and 26 deletions

View file

@ -7,7 +7,7 @@
use layout::box_::Box;
use layout::context::LayoutContext;
use layout::display_list_builder::{DisplayListBuilder, ExtraDisplayListData};
use layout::flow::{BlockFlowClass, FlowClass, Flow, FlowData, ImmutableFlowUtils};
use layout::flow::{BaseFlow, BlockFlowClass, FlowClass, Flow, ImmutableFlowUtils};
use layout::flow;
use layout::model::{MaybeAuto, Specified, Auto, specified_or_none, specified};
use layout::float_context::{FloatContext, PlacementInfo, Invalid, FloatType};
@ -50,7 +50,7 @@ impl FloatedBlockInfo {
/// A block formatting context.
pub struct BlockFlow {
/// Data common to all flows.
base: FlowData,
base: BaseFlow,
/// The associated box.
box_: Option<Box>,
@ -63,7 +63,7 @@ pub struct BlockFlow {
}
impl BlockFlow {
pub fn new(base: FlowData) -> BlockFlow {
pub fn new(base: BaseFlow) -> BlockFlow {
BlockFlow {
base: base,
box_: None,
@ -72,7 +72,7 @@ impl BlockFlow {
}
}
pub fn from_box(base: FlowData, box_: Box) -> BlockFlow {
pub fn from_box(base: BaseFlow, box_: Box) -> BlockFlow {
BlockFlow {
base: base,
box_: Some(box_),
@ -81,7 +81,7 @@ impl BlockFlow {
}
}
pub fn float_from_box(base: FlowData, float_type: FloatType, box_: Box) -> BlockFlow {
pub fn float_from_box(base: BaseFlow, float_type: FloatType, box_: Box) -> BlockFlow {
BlockFlow {
base: base,
box_: Some(box_),
@ -90,7 +90,7 @@ impl BlockFlow {
}
}
pub fn new_root(base: FlowData) -> BlockFlow {
pub fn new_root(base: BaseFlow) -> BlockFlow {
BlockFlow {
base: base,
box_: None,
@ -99,7 +99,7 @@ impl BlockFlow {
}
}
pub fn new_float(base: FlowData, float_type: FloatType) -> BlockFlow {
pub fn new_float(base: BaseFlow, float_type: FloatType) -> BlockFlow {
BlockFlow {
base: base,
box_: None,

View file

@ -26,7 +26,7 @@ use layout::box_::{Box, GenericBox, IframeBox, IframeBoxInfo, ImageBox, ImageBox
use layout::box_::{UnscannedTextBox, UnscannedTextBoxInfo};
use layout::context::LayoutContext;
use layout::float_context::FloatType;
use layout::flow::{Flow, FlowData, MutableFlowUtils};
use layout::flow::{BaseFlow, Flow, MutableFlowUtils};
use layout::inline::InlineFlow;
use layout::text::TextRunScanner;
use layout::util::LayoutDataAccess;
@ -234,7 +234,7 @@ impl<'fc> FlowConstructor<'fc> {
#[inline(always)]
fn flush_inline_boxes_to_flow(&mut self, boxes: ~[Box], flow: &mut ~Flow, node: LayoutNode) {
if boxes.len() > 0 {
let inline_base = FlowData::new(self.next_flow_id(), node);
let inline_base = BaseFlow::new(self.next_flow_id(), node);
let mut inline_flow = ~InlineFlow::from_boxes(inline_base, boxes) as ~Flow;
TextRunScanner::new().scan_for_runs(self.layout_context, inline_flow);
flow.add_new_child(inline_flow)
@ -344,7 +344,7 @@ impl<'fc> FlowConstructor<'fc> {
/// other `BlockFlow`s or `InlineFlow`s underneath it, depending on whether {ib} splits needed
/// to happen.
fn build_flow_for_block(&mut self, node: LayoutNode) -> ~Flow {
let base = FlowData::new(self.next_flow_id(), node);
let base = BaseFlow::new(self.next_flow_id(), node);
let box_ = self.build_box_for_node(node);
let mut flow = ~BlockFlow::from_box(base, box_) as ~Flow;
self.build_children_of_block_flow(&mut flow, node);
@ -355,7 +355,7 @@ impl<'fc> FlowConstructor<'fc> {
/// a `BlockFlow` underneath it.
fn build_flow_for_floated_block(&mut self, node: LayoutNode, float_type: FloatType)
-> ~Flow {
let base = FlowData::new(self.next_flow_id(), node);
let base = BaseFlow::new(self.next_flow_id(), node);
let box_ = self.build_box_for_node(node);
let mut flow = ~BlockFlow::float_from_box(base, float_type, box_) as ~Flow;
self.build_children_of_block_flow(&mut flow, node);

View file

@ -119,9 +119,9 @@ pub trait Flow {
// Base access
#[inline(always)]
pub fn base<'a>(this: &'a Flow) -> &'a FlowData {
pub fn base<'a>(this: &'a Flow) -> &'a BaseFlow {
unsafe {
let (_, ptr): (uint, &FlowData) = cast::transmute(this);
let (_, ptr): (uint, &BaseFlow) = cast::transmute(this);
ptr
}
}
@ -132,9 +132,9 @@ pub fn imm_child_iter<'a>(flow: &'a Flow) -> DListIterator<'a,~Flow> {
}
#[inline(always)]
pub fn mut_base<'a>(this: &'a mut Flow) -> &'a mut FlowData {
pub fn mut_base<'a>(this: &'a mut Flow) -> &'a mut BaseFlow {
unsafe {
let (_, ptr): (uint, &mut FlowData) = cast::transmute(this);
let (_, ptr): (uint, &mut BaseFlow) = cast::transmute(this);
ptr
}
}
@ -319,10 +319,7 @@ impl FlowFlags {
}
/// Data common to all flows.
///
/// FIXME: We need a naming convention for pseudo-inheritance like this. How about
/// `CommonFlowInfo`?
pub struct FlowData {
pub struct BaseFlow {
restyle_damage: RestyleDamage,
/// The children of this flow.
@ -371,11 +368,11 @@ impl Iterator<@Box> for BoxIterator {
}
}
impl FlowData {
impl BaseFlow {
#[inline]
pub fn new(id: int, node: LayoutNode) -> FlowData {
pub fn new(id: int, node: LayoutNode) -> BaseFlow {
let style = node.style();
FlowData {
BaseFlow {
restyle_damage: node.restyle_damage(),
children: DList::new(),

View file

@ -7,7 +7,7 @@ use layout::box_::{Box, CannotSplit, GenericBox, IframeBox, ImageBox, ScannedTex
use layout::box_::{SplitDidNotFit, UnscannedTextBox};
use layout::context::LayoutContext;
use layout::display_list_builder::{DisplayListBuilder, ExtraDisplayListData};
use layout::flow::{FlowClass, Flow, FlowData, InlineFlowClass};
use layout::flow::{BaseFlow, FlowClass, Flow, InlineFlowClass};
use layout::flow;
use layout::float_context::FloatContext;
use layout::util::ElementMapping;
@ -419,7 +419,7 @@ impl LineboxScanner {
pub struct InlineFlow {
/// Data common to all flows.
base: FlowData,
base: BaseFlow,
/// A vector of all inline render boxes. Several boxes may correspond to one node/element.
boxes: ~[Box],
@ -436,7 +436,7 @@ pub struct InlineFlow {
}
impl InlineFlow {
pub fn new(base: FlowData) -> InlineFlow {
pub fn new(base: BaseFlow) -> InlineFlow {
InlineFlow {
base: base,
boxes: ~[],
@ -445,7 +445,7 @@ impl InlineFlow {
}
}
pub fn from_boxes(base: FlowData, boxes: ~[Box]) -> InlineFlow {
pub fn from_boxes(base: BaseFlow, boxes: ~[Box]) -> InlineFlow {
InlineFlow {
base: base,
boxes: boxes,