mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
layout: Rename FlowData
to BaseFlow
to match other types
This commit is contained in:
parent
81769b4c4e
commit
ff213b6ad7
4 changed files with 23 additions and 26 deletions
|
@ -7,7 +7,7 @@
|
||||||
use layout::box_::Box;
|
use layout::box_::Box;
|
||||||
use layout::context::LayoutContext;
|
use layout::context::LayoutContext;
|
||||||
use layout::display_list_builder::{DisplayListBuilder, ExtraDisplayListData};
|
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::flow;
|
||||||
use layout::model::{MaybeAuto, Specified, Auto, specified_or_none, specified};
|
use layout::model::{MaybeAuto, Specified, Auto, specified_or_none, specified};
|
||||||
use layout::float_context::{FloatContext, PlacementInfo, Invalid, FloatType};
|
use layout::float_context::{FloatContext, PlacementInfo, Invalid, FloatType};
|
||||||
|
@ -50,7 +50,7 @@ impl FloatedBlockInfo {
|
||||||
/// A block formatting context.
|
/// A block formatting context.
|
||||||
pub struct BlockFlow {
|
pub struct BlockFlow {
|
||||||
/// Data common to all flows.
|
/// Data common to all flows.
|
||||||
base: FlowData,
|
base: BaseFlow,
|
||||||
|
|
||||||
/// The associated box.
|
/// The associated box.
|
||||||
box_: Option<Box>,
|
box_: Option<Box>,
|
||||||
|
@ -63,7 +63,7 @@ pub struct BlockFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BlockFlow {
|
impl BlockFlow {
|
||||||
pub fn new(base: FlowData) -> BlockFlow {
|
pub fn new(base: BaseFlow) -> BlockFlow {
|
||||||
BlockFlow {
|
BlockFlow {
|
||||||
base: base,
|
base: base,
|
||||||
box_: None,
|
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 {
|
BlockFlow {
|
||||||
base: base,
|
base: base,
|
||||||
box_: Some(box_),
|
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 {
|
BlockFlow {
|
||||||
base: base,
|
base: base,
|
||||||
box_: Some(box_),
|
box_: Some(box_),
|
||||||
|
@ -90,7 +90,7 @@ impl BlockFlow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_root(base: FlowData) -> BlockFlow {
|
pub fn new_root(base: BaseFlow) -> BlockFlow {
|
||||||
BlockFlow {
|
BlockFlow {
|
||||||
base: base,
|
base: base,
|
||||||
box_: None,
|
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 {
|
BlockFlow {
|
||||||
base: base,
|
base: base,
|
||||||
box_: None,
|
box_: None,
|
||||||
|
|
|
@ -26,7 +26,7 @@ use layout::box_::{Box, GenericBox, IframeBox, IframeBoxInfo, ImageBox, ImageBox
|
||||||
use layout::box_::{UnscannedTextBox, UnscannedTextBoxInfo};
|
use layout::box_::{UnscannedTextBox, UnscannedTextBoxInfo};
|
||||||
use layout::context::LayoutContext;
|
use layout::context::LayoutContext;
|
||||||
use layout::float_context::FloatType;
|
use layout::float_context::FloatType;
|
||||||
use layout::flow::{Flow, FlowData, MutableFlowUtils};
|
use layout::flow::{BaseFlow, Flow, MutableFlowUtils};
|
||||||
use layout::inline::InlineFlow;
|
use layout::inline::InlineFlow;
|
||||||
use layout::text::TextRunScanner;
|
use layout::text::TextRunScanner;
|
||||||
use layout::util::LayoutDataAccess;
|
use layout::util::LayoutDataAccess;
|
||||||
|
@ -234,7 +234,7 @@ impl<'fc> FlowConstructor<'fc> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn flush_inline_boxes_to_flow(&mut self, boxes: ~[Box], flow: &mut ~Flow, node: LayoutNode) {
|
fn flush_inline_boxes_to_flow(&mut self, boxes: ~[Box], flow: &mut ~Flow, node: LayoutNode) {
|
||||||
if boxes.len() > 0 {
|
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;
|
let mut inline_flow = ~InlineFlow::from_boxes(inline_base, boxes) as ~Flow;
|
||||||
TextRunScanner::new().scan_for_runs(self.layout_context, inline_flow);
|
TextRunScanner::new().scan_for_runs(self.layout_context, inline_flow);
|
||||||
flow.add_new_child(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
|
/// other `BlockFlow`s or `InlineFlow`s underneath it, depending on whether {ib} splits needed
|
||||||
/// to happen.
|
/// to happen.
|
||||||
fn build_flow_for_block(&mut self, node: LayoutNode) -> ~Flow {
|
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 box_ = self.build_box_for_node(node);
|
||||||
let mut flow = ~BlockFlow::from_box(base, box_) as ~Flow;
|
let mut flow = ~BlockFlow::from_box(base, box_) as ~Flow;
|
||||||
self.build_children_of_block_flow(&mut flow, node);
|
self.build_children_of_block_flow(&mut flow, node);
|
||||||
|
@ -355,7 +355,7 @@ impl<'fc> FlowConstructor<'fc> {
|
||||||
/// a `BlockFlow` underneath it.
|
/// a `BlockFlow` underneath it.
|
||||||
fn build_flow_for_floated_block(&mut self, node: LayoutNode, float_type: FloatType)
|
fn build_flow_for_floated_block(&mut self, node: LayoutNode, float_type: FloatType)
|
||||||
-> ~Flow {
|
-> ~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 box_ = self.build_box_for_node(node);
|
||||||
let mut flow = ~BlockFlow::float_from_box(base, float_type, box_) as ~Flow;
|
let mut flow = ~BlockFlow::float_from_box(base, float_type, box_) as ~Flow;
|
||||||
self.build_children_of_block_flow(&mut flow, node);
|
self.build_children_of_block_flow(&mut flow, node);
|
||||||
|
|
|
@ -119,9 +119,9 @@ pub trait Flow {
|
||||||
// Base access
|
// Base access
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn base<'a>(this: &'a Flow) -> &'a FlowData {
|
pub fn base<'a>(this: &'a Flow) -> &'a BaseFlow {
|
||||||
unsafe {
|
unsafe {
|
||||||
let (_, ptr): (uint, &FlowData) = cast::transmute(this);
|
let (_, ptr): (uint, &BaseFlow) = cast::transmute(this);
|
||||||
ptr
|
ptr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,9 +132,9 @@ pub fn imm_child_iter<'a>(flow: &'a Flow) -> DListIterator<'a,~Flow> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[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 {
|
unsafe {
|
||||||
let (_, ptr): (uint, &mut FlowData) = cast::transmute(this);
|
let (_, ptr): (uint, &mut BaseFlow) = cast::transmute(this);
|
||||||
ptr
|
ptr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -319,10 +319,7 @@ impl FlowFlags {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Data common to all flows.
|
/// Data common to all flows.
|
||||||
///
|
pub struct BaseFlow {
|
||||||
/// FIXME: We need a naming convention for pseudo-inheritance like this. How about
|
|
||||||
/// `CommonFlowInfo`?
|
|
||||||
pub struct FlowData {
|
|
||||||
restyle_damage: RestyleDamage,
|
restyle_damage: RestyleDamage,
|
||||||
|
|
||||||
/// The children of this flow.
|
/// The children of this flow.
|
||||||
|
@ -371,11 +368,11 @@ impl Iterator<@Box> for BoxIterator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FlowData {
|
impl BaseFlow {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(id: int, node: LayoutNode) -> FlowData {
|
pub fn new(id: int, node: LayoutNode) -> BaseFlow {
|
||||||
let style = node.style();
|
let style = node.style();
|
||||||
FlowData {
|
BaseFlow {
|
||||||
restyle_damage: node.restyle_damage(),
|
restyle_damage: node.restyle_damage(),
|
||||||
|
|
||||||
children: DList::new(),
|
children: DList::new(),
|
||||||
|
|
|
@ -7,7 +7,7 @@ use layout::box_::{Box, CannotSplit, GenericBox, IframeBox, ImageBox, ScannedTex
|
||||||
use layout::box_::{SplitDidNotFit, UnscannedTextBox};
|
use layout::box_::{SplitDidNotFit, UnscannedTextBox};
|
||||||
use layout::context::LayoutContext;
|
use layout::context::LayoutContext;
|
||||||
use layout::display_list_builder::{DisplayListBuilder, ExtraDisplayListData};
|
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::flow;
|
||||||
use layout::float_context::FloatContext;
|
use layout::float_context::FloatContext;
|
||||||
use layout::util::ElementMapping;
|
use layout::util::ElementMapping;
|
||||||
|
@ -419,7 +419,7 @@ impl LineboxScanner {
|
||||||
|
|
||||||
pub struct InlineFlow {
|
pub struct InlineFlow {
|
||||||
/// Data common to all flows.
|
/// Data common to all flows.
|
||||||
base: FlowData,
|
base: BaseFlow,
|
||||||
|
|
||||||
/// A vector of all inline render boxes. Several boxes may correspond to one node/element.
|
/// A vector of all inline render boxes. Several boxes may correspond to one node/element.
|
||||||
boxes: ~[Box],
|
boxes: ~[Box],
|
||||||
|
@ -436,7 +436,7 @@ pub struct InlineFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InlineFlow {
|
impl InlineFlow {
|
||||||
pub fn new(base: FlowData) -> InlineFlow {
|
pub fn new(base: BaseFlow) -> InlineFlow {
|
||||||
InlineFlow {
|
InlineFlow {
|
||||||
base: base,
|
base: base,
|
||||||
boxes: ~[],
|
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 {
|
InlineFlow {
|
||||||
base: base,
|
base: base,
|
||||||
boxes: boxes,
|
boxes: boxes,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue