mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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
|
@ -66,8 +66,6 @@ use crate::inline::{
|
|||
InlineFragmentContext, InlineFragmentNodeFlags, InlineFragmentNodeInfo, InlineMetrics,
|
||||
LineMetrics,
|
||||
};
|
||||
#[cfg(debug_assertions)]
|
||||
use crate::layout_debug;
|
||||
use crate::model::{
|
||||
self, style_length, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, SizeConstraint,
|
||||
};
|
||||
|
@ -151,11 +149,6 @@ pub struct Fragment {
|
|||
/// Various flags for this fragment.
|
||||
pub flags: FragmentFlags,
|
||||
|
||||
/// A debug ID that is consistent for the life of this fragment (via transform etc).
|
||||
/// This ID should not be considered stable across multiple layouts or fragment
|
||||
/// manipulations.
|
||||
debug_id: DebugId,
|
||||
|
||||
/// The ID of the StackingContext that contains this fragment. This is initialized
|
||||
/// to 0, but it assigned during the collect_stacking_contexts phase of display
|
||||
/// list construction.
|
||||
|
@ -170,7 +163,6 @@ pub struct Fragment {
|
|||
impl Serialize for Fragment {
|
||||
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||
let mut serializer = serializer.serialize_struct("fragment", 3)?;
|
||||
serializer.serialize_field("id", &self.debug_id)?;
|
||||
serializer.serialize_field("border_box", &self.border_box)?;
|
||||
serializer.serialize_field("margin", &self.margin)?;
|
||||
serializer.end()
|
||||
|
@ -699,7 +691,6 @@ impl Fragment {
|
|||
inline_context: None,
|
||||
pseudo: node.get_pseudo_element_type(),
|
||||
flags,
|
||||
debug_id: DebugId::new(),
|
||||
stacking_context_id: StackingContextId::root(),
|
||||
established_reference_frame: None,
|
||||
}
|
||||
|
@ -730,7 +721,6 @@ impl Fragment {
|
|||
inline_context: None,
|
||||
pseudo,
|
||||
flags: FragmentFlags::empty(),
|
||||
debug_id: DebugId::new(),
|
||||
stacking_context_id: StackingContextId::root(),
|
||||
established_reference_frame: None,
|
||||
}
|
||||
|
@ -757,7 +747,6 @@ impl Fragment {
|
|||
inline_context: None,
|
||||
pseudo: self.pseudo,
|
||||
flags: FragmentFlags::empty(),
|
||||
debug_id: DebugId::new(),
|
||||
stacking_context_id: StackingContextId::root(),
|
||||
established_reference_frame: None,
|
||||
}
|
||||
|
@ -784,7 +773,6 @@ impl Fragment {
|
|||
inline_context: self.inline_context.clone(),
|
||||
pseudo: self.pseudo,
|
||||
flags: FragmentFlags::empty(),
|
||||
debug_id: self.debug_id.clone(),
|
||||
stacking_context_id: StackingContextId::root(),
|
||||
established_reference_frame: None,
|
||||
}
|
||||
|
@ -3274,14 +3262,13 @@ impl fmt::Debug for Fragment {
|
|||
|
||||
write!(
|
||||
f,
|
||||
"\n{}({}) [{:?}]\
|
||||
"\n{} [{:?}]\
|
||||
\nborder_box={:?}\
|
||||
{border_padding_string}\
|
||||
{margin_string}\
|
||||
{damage_string}\
|
||||
{flags_string}",
|
||||
self.specific.get_type(),
|
||||
self.debug_id,
|
||||
self.specific,
|
||||
self.border_box,
|
||||
)
|
||||
|
@ -3447,53 +3434,3 @@ pub struct SpeculatedInlineContentEdgeOffsets {
|
|||
pub start: Au,
|
||||
pub end: Au,
|
||||
}
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
#[derive(Clone)]
|
||||
struct DebugId;
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
#[derive(Clone)]
|
||||
struct DebugId(u16);
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
impl DebugId {
|
||||
pub fn new() -> DebugId {
|
||||
DebugId
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
impl DebugId {
|
||||
pub fn new() -> DebugId {
|
||||
DebugId(layout_debug::generate_unique_debug_id())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
impl fmt::Display for DebugId {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{:p}", &self)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
impl fmt::Display for DebugId {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
impl Serialize for DebugId {
|
||||
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||
serializer.serialize_str(&format!("{:p}", &self))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
impl Serialize for DebugId {
|
||||
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||
serializer.serialize_u16(self.0)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue