Skip to content
Permalink
Browse files

Make some of layout_2020 private

  • Loading branch information...
SimonSapin committed Oct 4, 2019
1 parent ec74204 commit 1bb85ed05b36a63e2cf879aa307ba297d52d00cf
@@ -35,12 +35,12 @@ pub(super) enum Contents<Node> {
OfPseudoElement(Vec<PseudoElementContentItem>),
}

pub enum NonReplacedContents<Node> {
pub(super) enum NonReplacedContents<Node> {
OfElement(Node),
OfPseudoElement(Vec<PseudoElementContentItem>),
}

pub enum PseudoElementContentItem {
pub(super) enum PseudoElementContentItem {
Text(String),
Replaced(ReplacedContent),
}
@@ -258,18 +258,18 @@ pub struct BoxSlot<'dom> {
}

impl BoxSlot<'_> {
pub fn new(slot: Arc<AtomicRefCell<Option<LayoutBox>>>) -> Self {
pub(crate) fn new(slot: Arc<AtomicRefCell<Option<LayoutBox>>>) -> Self {
*slot.borrow_mut() = None;
let slot = Some(slot);
Self { slot, marker }
}

pub fn dummy() -> Self {
pub(crate) fn dummy() -> Self {
let slot = None;
Self { slot, marker }
}

pub fn set(mut self, box_: LayoutBox) {
pub(crate) fn set(mut self, box_: LayoutBox) {
if let Some(slot) = &mut self.slot {
*slot.borrow_mut() = Some(box_);
}
@@ -19,7 +19,7 @@ pub(super) struct PseudoElementBoxes {
pub after: Arc<AtomicRefCell<Option<LayoutBox>>>,
}

pub enum LayoutBox {
pub(super) enum LayoutBox {
DisplayContents,
BlockLevel(Arc<BlockLevelBox>),
InlineLevel(Arc<InlineLevelBox>),
@@ -123,7 +123,7 @@ struct BlockContainerBuilder<'dom, 'style, Node> {
}

impl BlockContainer {
pub(crate) fn construct<'dom, 'style>(
pub 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 enum ContainsFloats {
pub(crate) enum ContainsFloats {
No,
Yes,
}
@@ -7,7 +7,7 @@ use servo_arc::Arc;
use style::properties::ComputedValues;

#[derive(Debug)]
pub struct FloatBox {
pub(crate) struct FloatBox {
pub style: Arc<ComputedValues>,
pub contents: IndependentFormattingContext,
}
@@ -16,12 +16,12 @@ use style::values::computed::Length;
use style::Zero;

#[derive(Debug, Default)]
pub struct InlineFormattingContext {
pub(crate) struct InlineFormattingContext {
pub(super) inline_level_boxes: Vec<Arc<InlineLevelBox>>,
}

#[derive(Debug)]
pub enum InlineLevelBox {
pub(crate) enum InlineLevelBox {
InlineBox(InlineBox),
TextRun(TextRun),
OutOfFlowAbsolutelyPositionedBox(AbsolutelyPositionedBox),
@@ -34,7 +34,7 @@ pub enum InlineLevelBox {
}

#[derive(Debug)]
pub struct InlineBox {
pub(crate) struct InlineBox {
pub style: Arc<ComputedValues>,
pub first_fragment: bool,
pub last_fragment: bool,
@@ -43,7 +43,7 @@ pub struct InlineBox {

/// https://www.w3.org/TR/css-display-3/#css-text-run
#[derive(Debug)]
pub struct TextRun {
pub(crate) struct TextRun {
pub parent_style: Arc<ComputedValues>,
pub text: String,
}
@@ -25,22 +25,24 @@ use style::Zero;
mod construct;
mod float;
pub mod inline;
pub mod root;
mod root;

pub use root::BoxTreeRoot;

#[derive(Debug)]
pub struct BlockFormattingContext {
pub(crate) struct BlockFormattingContext {
pub contents: BlockContainer,
pub contains_floats: bool,
}

#[derive(Debug)]
pub enum BlockContainer {
pub(crate) enum BlockContainer {
BlockLevelBoxes(Vec<Arc<BlockLevelBox>>),
InlineFormattingContext(InlineFormattingContext),
}

#[derive(Debug)]
pub enum BlockLevelBox {
pub(crate) enum BlockLevelBox {
SameFormattingContextBlock {
style: Arc<ComputedValues>,
contents: BlockContainer,
@@ -22,7 +22,6 @@ use style::properties::ComputedValues;
use style::values::computed::{Length, LengthOrAuto};
use style_traits::CSSPixel;

#[derive(Debug)]
pub struct BoxTreeRoot(BlockFormattingContext);

impl BoxTreeRoot {
@@ -11,40 +11,41 @@
#[macro_use]
extern crate serde;

use crate::dom_traversal::{Contents, NodeExt};
use crate::flow::{BlockFormattingContext, FlowChildren};
use crate::geom::flow_relative::Vec2;
use crate::positioned::AbsolutelyPositionedFragment;
use crate::replaced::ReplacedContent;
use crate::style_ext::{ComputedValuesExt, Direction, Position, WritingMode};
use servo_arc::Arc;
use std::convert::TryInto;
use style::context::SharedStyleContext;
use style::properties::ComputedValues;
use style::values::computed::{Length, LengthOrAuto};
use style::values::specified::box_::DisplayInside;
use style::Zero;

pub mod context;
pub mod data;
pub mod dom_traversal;
pub mod element_data;
pub mod flow;
pub mod fragments;
pub mod geom;
pub mod opaque_node;
pub mod positioned;
mod dom_traversal;
mod element_data;
mod flow;
mod fragments;
mod geom;
mod opaque_node;
mod positioned;
pub mod query;
pub mod replaced;
pub mod style_ext;
mod replaced;
mod style_ext;
pub mod traversal;
pub mod wrapper;

pub use crate::flow::root::BoxTreeRoot;
pub use flow::BoxTreeRoot;

use crate::dom_traversal::{Contents, NodeExt};
use crate::flow::{BlockFormattingContext, FlowChildren};
use crate::geom::flow_relative::Vec2;
use crate::positioned::AbsolutelyPositionedFragment;
use crate::replaced::ReplacedContent;
use crate::style_ext::{ComputedValuesExt, Direction, Position, WritingMode};
use servo_arc::Arc;
use std::convert::TryInto;
use style::context::SharedStyleContext;
use style::values::specified::box_::DisplayInside;

/// https://drafts.csswg.org/css-display/#independent-formatting-context
#[derive(Debug)]
pub enum IndependentFormattingContext {
enum IndependentFormattingContext {
Flow(BlockFormattingContext),

// Not called FC in specs, but behaves close enough
@@ -13,7 +13,7 @@ use style::values::computed::{Length, LengthOrAuto, LengthPercentage, LengthPerc
use style::Zero;

#[derive(Debug)]
pub struct AbsolutelyPositionedBox {
pub(crate) struct AbsolutelyPositionedBox {
pub style: Arc<ComputedValues>,
pub contents: IndependentFormattingContext,
}
@@ -6,7 +6,7 @@ use crate::dom_traversal::NodeExt;
use style::context::SharedStyleContext;

#[derive(Debug)]
pub enum ReplacedContent {
pub(super) enum ReplacedContent {
// Not implemented yet
}

0 comments on commit 1bb85ed

Please sign in to comment.
You can’t perform that action at this time.