aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2019-10-04 17:51:05 +0200
committerSimon Sapin <simon.sapin@exyr.org>2019-10-04 17:51:05 +0200
commit1bb85ed05b36a63e2cf879aa307ba297d52d00cf (patch)
tree33b18edc486148cbe1b98e2f1a82e080af200dc1
parentec74204fa0719856069770ac05c5aa7ac90cc4b2 (diff)
downloadservo-1bb85ed05b36a63e2cf879aa307ba297d52d00cf.tar.gz
servo-1bb85ed05b36a63e2cf879aa307ba297d52d00cf.zip
Make some of layout_2020 private
-rw-r--r--components/layout_2020/dom_traversal.rs10
-rw-r--r--components/layout_2020/element_data.rs2
-rw-r--r--components/layout_2020/flow/construct.rs4
-rw-r--r--components/layout_2020/flow/float.rs2
-rw-r--r--components/layout_2020/flow/inline.rs8
-rw-r--r--components/layout_2020/flow/mod.rs10
-rw-r--r--components/layout_2020/flow/root.rs1
-rw-r--r--components/layout_2020/lib.rs43
-rw-r--r--components/layout_2020/positioned.rs2
-rw-r--r--components/layout_2020/replaced.rs2
10 files changed, 43 insertions, 41 deletions
diff --git a/components/layout_2020/dom_traversal.rs b/components/layout_2020/dom_traversal.rs
index 528c2b49271..3475b4e0eef 100644
--- a/components/layout_2020/dom_traversal.rs
+++ b/components/layout_2020/dom_traversal.rs
@@ -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_);
}
diff --git a/components/layout_2020/element_data.rs b/components/layout_2020/element_data.rs
index 5cedbf65f1b..ccd48ac04e3 100644
--- a/components/layout_2020/element_data.rs
+++ b/components/layout_2020/element_data.rs
@@ -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>),
diff --git a/components/layout_2020/flow/construct.rs b/components/layout_2020/flow/construct.rs
index abdfae0bc84..6b2027a8794 100644
--- a/components/layout_2020/flow/construct.rs
+++ b/components/layout_2020/flow/construct.rs
@@ -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,
}
diff --git a/components/layout_2020/flow/float.rs b/components/layout_2020/flow/float.rs
index 4a7a4bb31c4..31fec0b79c0 100644
--- a/components/layout_2020/flow/float.rs
+++ b/components/layout_2020/flow/float.rs
@@ -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,
}
diff --git a/components/layout_2020/flow/inline.rs b/components/layout_2020/flow/inline.rs
index 1334560b337..59b822976ca 100644
--- a/components/layout_2020/flow/inline.rs
+++ b/components/layout_2020/flow/inline.rs
@@ -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,
}
diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs
index a68eaff563e..189a5aeb436 100644
--- a/components/layout_2020/flow/mod.rs
+++ b/components/layout_2020/flow/mod.rs
@@ -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,
diff --git a/components/layout_2020/flow/root.rs b/components/layout_2020/flow/root.rs
index 2a0d1f66be0..994ce29bb16 100644
--- a/components/layout_2020/flow/root.rs
+++ b/components/layout_2020/flow/root.rs
@@ -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 {
diff --git a/components/layout_2020/lib.rs b/components/layout_2020/lib.rs
index 33d46f75fa1..f491411eb3c 100644
--- a/components/layout_2020/lib.rs
+++ b/components/layout_2020/lib.rs
@@ -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
diff --git a/components/layout_2020/positioned.rs b/components/layout_2020/positioned.rs
index 06da2a9fc0e..55888fb8842 100644
--- a/components/layout_2020/positioned.rs
+++ b/components/layout_2020/positioned.rs
@@ -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,
}
diff --git a/components/layout_2020/replaced.rs b/components/layout_2020/replaced.rs
index c67acd1b8ad..04defc26b02 100644
--- a/components/layout_2020/replaced.rs
+++ b/components/layout_2020/replaced.rs
@@ -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
}