Call BoxTreeRoot::construct from layout_thread_2020

This commit is contained in:
Anthony Ramine 2019-10-03 18:08:16 +02:00
parent 9706cd497d
commit ec74204fa0
12 changed files with 51 additions and 42 deletions

View file

@ -123,7 +123,7 @@ struct BlockContainerBuilder<'dom, 'style, Node> {
}
impl BlockContainer {
pub fn construct<'dom, 'style>(
pub(crate) fn construct<'dom, 'style>(
context: &SharedStyleContext<'style>,
block_container_style: &Arc<ComputedValues>,
contents: NonReplacedContents<impl NodeExt<'dom>>,
@ -646,7 +646,7 @@ where
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(crate) enum ContainsFloats {
pub enum ContainsFloats {
No,
Yes,
}

View file

@ -7,7 +7,7 @@ use servo_arc::Arc;
use style::properties::ComputedValues;
#[derive(Debug)]
pub(crate) struct FloatBox {
pub struct FloatBox {
pub style: Arc<ComputedValues>,
pub contents: IndependentFormattingContext,
}

View file

@ -16,12 +16,12 @@ use style::values::computed::Length;
use style::Zero;
#[derive(Debug, Default)]
pub(crate) struct InlineFormattingContext {
pub struct InlineFormattingContext {
pub(super) inline_level_boxes: Vec<Arc<InlineLevelBox>>,
}
#[derive(Debug)]
pub(crate) enum InlineLevelBox {
pub enum InlineLevelBox {
InlineBox(InlineBox),
TextRun(TextRun),
OutOfFlowAbsolutelyPositionedBox(AbsolutelyPositionedBox),
@ -34,7 +34,7 @@ pub(crate) enum InlineLevelBox {
}
#[derive(Debug)]
pub(crate) struct InlineBox {
pub struct InlineBox {
pub style: Arc<ComputedValues>,
pub first_fragment: bool,
pub last_fragment: bool,
@ -43,7 +43,7 @@ pub(crate) struct InlineBox {
/// https://www.w3.org/TR/css-display-3/#css-text-run
#[derive(Debug)]
pub(crate) struct TextRun {
pub struct TextRun {
pub parent_style: Arc<ComputedValues>,
pub text: String,
}

View file

@ -25,22 +25,22 @@ use style::Zero;
mod construct;
mod float;
pub mod inline;
mod root;
pub mod root;
#[derive(Debug)]
pub(crate) struct BlockFormattingContext {
pub struct BlockFormattingContext {
pub contents: BlockContainer,
pub contains_floats: bool,
}
#[derive(Debug)]
pub(crate) enum BlockContainer {
pub enum BlockContainer {
BlockLevelBoxes(Vec<Arc<BlockLevelBox>>),
InlineFormattingContext(InlineFormattingContext),
}
#[derive(Debug)]
pub(crate) enum BlockLevelBox {
pub enum BlockLevelBox {
SameFormattingContextBlock {
style: Arc<ComputedValues>,
contents: BlockContainer,

View file

@ -22,17 +22,8 @@ use style::properties::ComputedValues;
use style::values::computed::{Length, LengthOrAuto};
use style_traits::CSSPixel;
// FIXME
// impl crate::dom::Document {
// pub(crate) fn layout(
// &self,
// viewport: crate::geom::Size<crate::geom::CssPx>,
// ) -> Vec<Fragment> {
// BoxTreeRoot::construct(self).layout(viewport)
// }
// }
struct BoxTreeRoot(BlockFormattingContext);
#[derive(Debug)]
pub struct BoxTreeRoot(BlockFormattingContext);
impl BoxTreeRoot {
pub fn construct<'dom>(