mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Dump box tree state into json files and display it on layout 2020 viewer
This commit is contained in:
parent
aaa3cd9a59
commit
a042f85083
11 changed files with 161 additions and 56 deletions
|
@ -10,7 +10,7 @@ use crate::style_ext::{ComputedValuesExt, DisplayInside};
|
|||
use servo_arc::Arc;
|
||||
use style::properties::ComputedValues;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Serialize)]
|
||||
pub(crate) struct FloatBox {
|
||||
pub contents: IndependentFormattingContext,
|
||||
}
|
||||
|
|
|
@ -23,12 +23,12 @@ use style::values::specified::text::TextAlignKeyword;
|
|||
use style::Zero;
|
||||
use webrender_api::FontInstanceKey;
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
#[derive(Debug, Default, Serialize)]
|
||||
pub(crate) struct InlineFormattingContext {
|
||||
pub(super) inline_level_boxes: Vec<Arc<InlineLevelBox>>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Serialize)]
|
||||
pub(crate) enum InlineLevelBox {
|
||||
InlineBox(InlineBox),
|
||||
TextRun(TextRun),
|
||||
|
@ -37,9 +37,10 @@ pub(crate) enum InlineLevelBox {
|
|||
Atomic(IndependentFormattingContext),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Serialize)]
|
||||
pub(crate) struct InlineBox {
|
||||
pub tag: OpaqueNode,
|
||||
#[serde(skip_serializing)]
|
||||
pub style: Arc<ComputedValues>,
|
||||
pub first_fragment: bool,
|
||||
pub last_fragment: bool,
|
||||
|
@ -47,9 +48,10 @@ pub(crate) struct InlineBox {
|
|||
}
|
||||
|
||||
/// https://www.w3.org/TR/css-display-3/#css-text-run
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Serialize)]
|
||||
pub(crate) struct TextRun {
|
||||
pub tag: OpaqueNode,
|
||||
#[serde(skip_serializing)]
|
||||
pub parent_style: Arc<ComputedValues>,
|
||||
pub text: String,
|
||||
}
|
||||
|
|
|
@ -31,22 +31,23 @@ mod root;
|
|||
|
||||
pub use root::{BoxTreeRoot, FragmentTreeRoot};
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Serialize)]
|
||||
pub(crate) struct BlockFormattingContext {
|
||||
pub contents: BlockContainer,
|
||||
pub contains_floats: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Serialize)]
|
||||
pub(crate) enum BlockContainer {
|
||||
BlockLevelBoxes(Vec<Arc<BlockLevelBox>>),
|
||||
InlineFormattingContext(InlineFormattingContext),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Serialize)]
|
||||
pub(crate) enum BlockLevelBox {
|
||||
SameFormattingContextBlock {
|
||||
tag: OpaqueNode,
|
||||
#[serde(skip_serializing)]
|
||||
style: Arc<ComputedValues>,
|
||||
contents: BlockContainer,
|
||||
},
|
||||
|
|
|
@ -28,6 +28,7 @@ use style::properties::ComputedValues;
|
|||
use style::values::computed::Length;
|
||||
use style_traits::CSSPixel;
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct BoxTreeRoot(BlockFormattingContext);
|
||||
|
||||
#[derive(Serialize)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue