mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
layout: Remove the obsolete layout tracing functionality (#35001)
There were two kinds of layout tracing controlled by the same debugging option: - modern layout: Functionality that dumped a JSON serialization of the layout tree before and after layout. - legacy layout: A scope based tracing that reported the process of layout in a structured way. I don't think anyone working on layout is using either of these two features. For modern layout requiring data structure to implement `serde` serialization is incredibly inconvenient and also generates a lot of extra code. We also have a more modern tracing functionality based on perfetto that we have started to use for layout and IMO it's actually being used and more robust. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
2cd5e1356c
commit
e81951a973
45 changed files with 64 additions and 675 deletions
|
@ -13,7 +13,6 @@ use std::ops::Range;
|
|||
|
||||
use app_units::{Au, MAX_AU, MIN_AU};
|
||||
use euclid::num::Zero;
|
||||
use serde::Serialize;
|
||||
use servo_arc::Arc;
|
||||
use style::computed_values::float::T as FloatProperty;
|
||||
use style::computed_values::position::T as Position;
|
||||
|
@ -33,7 +32,7 @@ use crate::style_ext::{DisplayInside, PaddingBorderMargin};
|
|||
use crate::ContainingBlock;
|
||||
|
||||
/// A floating box.
|
||||
#[derive(Debug, Serialize)]
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct FloatBox {
|
||||
/// The formatting context that makes up the content of this box.
|
||||
pub contents: IndependentFormattingContext,
|
||||
|
|
|
@ -6,7 +6,6 @@ use std::vec::IntoIter;
|
|||
|
||||
use app_units::Au;
|
||||
use fonts::FontMetrics;
|
||||
use serde::Serialize;
|
||||
use servo_arc::Arc;
|
||||
use style::properties::ComputedValues;
|
||||
|
||||
|
@ -19,10 +18,9 @@ use crate::fragment_tree::BaseFragmentInfo;
|
|||
use crate::style_ext::{ComputedValuesExt, PaddingBorderMargin};
|
||||
use crate::ContainingBlock;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct InlineBox {
|
||||
pub base_fragment_info: BaseFragmentInfo,
|
||||
#[serde(skip_serializing)]
|
||||
pub style: Arc<ComputedValues>,
|
||||
/// The identifier of this inline box in the containing [`super::InlineFormattingContext`].
|
||||
pub(super) identifier: InlineBoxIdentifier,
|
||||
|
@ -56,7 +54,7 @@ impl InlineBox {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Serialize)]
|
||||
#[derive(Debug, Default)]
|
||||
pub(crate) struct InlineBoxes {
|
||||
/// A collection of all inline boxes in a particular [`super::InlineFormattingContext`].
|
||||
inline_boxes: Vec<ArcRefCell<InlineBox>>,
|
||||
|
@ -158,7 +156,7 @@ impl InlineBoxes {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Serialize)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub(super) enum InlineBoxTreePathToken {
|
||||
Start(InlineBoxIdentifier),
|
||||
End(InlineBoxIdentifier),
|
||||
|
@ -179,7 +177,7 @@ impl InlineBoxTreePathToken {
|
|||
/// [`u32`] is used for the index, in order to save space. The value refers to the token
|
||||
/// in the start tree data structure which can be fetched to find the actual index of
|
||||
/// of the [`InlineBox`] in [`InlineBoxes::inline_boxes`].
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq, Serialize)]
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
|
||||
pub(crate) struct InlineBoxIdentifier {
|
||||
pub index_of_start_in_tree: u32,
|
||||
pub index_in_inline_boxes: u32,
|
||||
|
|
|
@ -88,7 +88,6 @@ use line::{
|
|||
TextRunLineItem,
|
||||
};
|
||||
use line_breaker::LineBreaker;
|
||||
use serde::Serialize;
|
||||
use servo_arc::Arc;
|
||||
use style::computed_values::text_wrap_mode::T as TextWrapMode;
|
||||
use style::computed_values::vertical_align::T as VerticalAlign;
|
||||
|
@ -134,7 +133,7 @@ use crate::{ConstraintSpace, ContainingBlock};
|
|||
static FONT_SUBSCRIPT_OFFSET_RATIO: f32 = 0.20;
|
||||
static FONT_SUPERSCRIPT_OFFSET_RATIO: f32 = 0.34;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct InlineFormattingContext {
|
||||
/// All [`InlineItem`]s in this [`InlineFormattingContext`] stored in a flat array.
|
||||
/// [`InlineItem::StartInlineBox`] and [`InlineItem::EndInlineBox`] allow representing
|
||||
|
@ -171,14 +170,14 @@ pub(crate) struct InlineFormattingContext {
|
|||
}
|
||||
|
||||
/// A collection of data used to cache [`FontMetrics`] in the [`InlineFormattingContext`]
|
||||
#[derive(Debug, Serialize)]
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct FontKeyAndMetrics {
|
||||
pub key: FontInstanceKey,
|
||||
pub pt_size: Au,
|
||||
pub metrics: FontMetrics,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum InlineItem {
|
||||
StartInlineBox(ArcRefCell<InlineBox>),
|
||||
EndInlineBox,
|
||||
|
|
|
@ -13,7 +13,6 @@ use fonts::{
|
|||
use fonts_traits::ByteIndex;
|
||||
use log::warn;
|
||||
use range::Range as ServoRange;
|
||||
use serde::Serialize;
|
||||
use servo_arc::Arc;
|
||||
use style::computed_values::text_rendering::T as TextRendering;
|
||||
use style::computed_values::white_space_collapse::T as WhiteSpaceCollapse;
|
||||
|
@ -38,10 +37,9 @@ pub(crate) const XI_LINE_BREAKING_CLASS_WJ: u8 = 30;
|
|||
pub(crate) const XI_LINE_BREAKING_CLASS_ZWJ: u8 = 42;
|
||||
|
||||
/// <https://www.w3.org/TR/css-display-3/#css-text-run>
|
||||
#[derive(Debug, Serialize)]
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct TextRun {
|
||||
pub base_fragment_info: BaseFragmentInfo,
|
||||
#[serde(skip_serializing)]
|
||||
pub parent_style: Arc<ComputedValues>,
|
||||
pub text_range: Range<usize>,
|
||||
|
||||
|
@ -64,14 +62,13 @@ enum SegmentStartSoftWrapPolicy {
|
|||
FollowLinebreaker,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct TextRunSegment {
|
||||
/// The index of this font in the parent [`super::InlineFormattingContext`]'s collection of font
|
||||
/// information.
|
||||
pub font_index: usize,
|
||||
|
||||
/// The [`Script`] of this segment.
|
||||
#[serde(skip_serializing)]
|
||||
pub script: Script,
|
||||
|
||||
/// The bidi Level of this segment.
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
use app_units::{Au, MAX_AU};
|
||||
use inline::InlineFormattingContext;
|
||||
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
|
||||
use serde::Serialize;
|
||||
use servo_arc::Arc;
|
||||
use style::computed_values::clear::T as StyleClear;
|
||||
use style::properties::ComputedValues;
|
||||
|
@ -53,13 +52,13 @@ mod root;
|
|||
pub(crate) use construct::BlockContainerBuilder;
|
||||
pub use root::{BoxTree, CanvasBackground};
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct BlockFormattingContext {
|
||||
pub contents: BlockContainer,
|
||||
pub contains_floats: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum BlockContainer {
|
||||
BlockLevelBoxes(Vec<ArcRefCell<BlockLevelBox>>),
|
||||
InlineFormattingContext(InlineFormattingContext),
|
||||
|
@ -76,7 +75,7 @@ impl BlockContainer {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum BlockLevelBox {
|
||||
Independent(IndependentFormattingContext),
|
||||
OutOfFlowAbsolutelyPositionedBox(ArcRefCell<AbsolutelyPositionedBox>),
|
||||
|
@ -231,9 +230,8 @@ pub(crate) struct CollapsibleWithParentStartMargin(bool);
|
|||
|
||||
/// The contentes of a BlockContainer created to render a list marker
|
||||
/// for a list that has `list-style-position: outside`.
|
||||
#[derive(Debug, Serialize)]
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct OutsideMarker {
|
||||
#[serde(skip_serializing)]
|
||||
pub marker_style: Arc<ComputedValues>,
|
||||
pub base: LayoutBoxBase,
|
||||
pub block_container: BlockContainer,
|
||||
|
|
|
@ -8,7 +8,6 @@ use script_layout_interface::wrapper_traits::{
|
|||
LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode,
|
||||
};
|
||||
use script_layout_interface::{LayoutElementType, LayoutNodeType};
|
||||
use serde::Serialize;
|
||||
use servo_arc::Arc;
|
||||
use style::dom::OpaqueNode;
|
||||
use style::properties::ComputedValues;
|
||||
|
@ -33,7 +32,6 @@ use crate::style_ext::{ComputedValuesExt, Display, DisplayGeneratingBox, Display
|
|||
use crate::taffy::{TaffyItemBox, TaffyItemBoxInner};
|
||||
use crate::DefiniteContainingBlock;
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct BoxTree {
|
||||
/// Contains typically exactly one block-level box, which was generated by the root element.
|
||||
/// There may be zero if that element has `display: none`.
|
||||
|
@ -409,7 +407,7 @@ impl BoxTree {
|
|||
}
|
||||
|
||||
/// <https://drafts.csswg.org/css-backgrounds/#root-background>
|
||||
#[derive(Clone, Serialize)]
|
||||
#[derive(Clone)]
|
||||
pub struct CanvasBackground {
|
||||
/// DOM node for the root element
|
||||
pub root_element: OpaqueNode,
|
||||
|
@ -420,7 +418,6 @@ pub struct CanvasBackground {
|
|||
pub from_element: OpaqueNode,
|
||||
|
||||
/// The computed styles to take background properties from.
|
||||
#[serde(skip)]
|
||||
pub style: Option<Arc<ComputedValues>>,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue