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:
Martin Robinson 2025-01-15 14:24:14 +01:00 committed by GitHub
parent 2cd5e1356c
commit e81951a973
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
45 changed files with 64 additions and 675 deletions

View file

@ -67,8 +67,8 @@ use crate::incremental::RelayoutMode;
use crate::model::{
AdjoiningMargins, CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo, MaybeAuto,
};
use crate::sequential;
use crate::traversal::PreorderFlowTraversal;
use crate::{layout_debug, layout_debug_scope, sequential};
/// Information specific to floated blocks.
#[derive(Clone, Serialize)]
@ -922,8 +922,6 @@ impl BlockFlow {
mut fragmentation_context: Option<FragmentationContext>,
margins_may_collapse: MarginsMayCollapseFlag,
) -> Option<Arc<dyn Flow>> {
let _scope = layout_debug_scope!("assign_block_size_block_base {:x}", self.base.debug_id());
let mut break_at = None;
let content_box = self.fragment.content_box();
if self
@ -1861,8 +1859,6 @@ impl BlockFlow {
/// Computes intrinsic inline sizes for a block.
pub fn bubble_inline_sizes_for_block(&mut self, consult_children: bool) {
let _scope = layout_debug_scope!("block::bubble_inline_sizes {:x}", self.base.debug_id());
let mut flags = self.base.flags;
if self.definitely_has_zero_block_size() {
// This is kind of a hack for Acid2. But it's a harmless one, because (a) this behavior
@ -2186,8 +2182,6 @@ impl Flow for BlockFlow {
/// Dual fragments consume some inline-size first, and the remainder is assigned to all child
/// (block) contexts.
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
let _scope = layout_debug_scope!("block::assign_inline_sizes {:x}", self.base.debug_id());
let shared_context = layout_context.shared_context();
self.compute_inline_sizes(shared_context);
@ -2277,11 +2271,6 @@ impl Flow for BlockFlow {
fragmentation_context: Option<FragmentationContext>,
) -> Option<Arc<dyn Flow>> {
if self.fragment.is_replaced() {
let _scope = layout_debug_scope!(
"assign_replaced_block_size_if_necessary {:x}",
self.base.debug_id()
);
// Assign block-size for fragment if it is an image fragment.
self.fragment.assign_replaced_block_size_if_necessary();
if !self
@ -2315,10 +2304,6 @@ impl Flow for BlockFlow {
{
// Root element margins should never be collapsed according to CSS § 8.3.1.
debug!("{}", self.is_root());
debug!(
"assign_block_size: assigning block_size for root flow {:#x?}",
self.base().debug_id()
);
trace!("BlockFlow before assigning: {:?}", &self);
let flow = self.assign_block_size_block_base(
layout_context,
@ -2328,10 +2313,6 @@ impl Flow for BlockFlow {
trace!("BlockFlow after assigning: {:?}", &self);
flow
} else {
debug!(
"assign_block_size: assigning block_size for block {:#x?}",
self.base().debug_id()
);
trace!("BlockFlow before assigning: {:?}", &self);
let flow = self.assign_block_size_block_base(
layout_context,
@ -2660,13 +2641,7 @@ impl Flow for BlockFlow {
impl fmt::Debug for BlockFlow {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(
f,
"{:?}({:x}) {:?}",
self.class(),
self.base.debug_id(),
self.base
)
write!(f, "{:?} {:?}", self.class(), self.base)
}
}