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
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -97,14 +97,6 @@ impl ConstructionResult {
|
|||
// inefficient!
|
||||
(*self).clone()
|
||||
}
|
||||
|
||||
pub fn debug_id(&self) -> usize {
|
||||
match *self {
|
||||
ConstructionResult::None => 0,
|
||||
ConstructionResult::ConstructionItem(_) => 0,
|
||||
ConstructionResult::Flow(ref flow_ref, _) => flow_ref.base().debug_id(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents the output of flow construction for a DOM node that has not yet resulted in a
|
||||
|
|
|
@ -32,7 +32,6 @@ use crate::model::{
|
|||
self, AdjoiningMargins, CollapsibleMargins, IntrinsicISizes, MaybeAuto, SizeConstraint,
|
||||
};
|
||||
use crate::traversal::PreorderFlowTraversal;
|
||||
use crate::{layout_debug, layout_debug_scope};
|
||||
|
||||
/// The size of an axis. May be a specified size, a min/max
|
||||
/// constraint, or an unlimited size
|
||||
|
@ -513,7 +512,6 @@ impl FlexFlow {
|
|||
inline_end_content_edge: Au,
|
||||
content_inline_size: Au,
|
||||
) {
|
||||
let _scope = layout_debug_scope!("flex::block_mode_assign_inline_sizes");
|
||||
debug!("flex::block_mode_assign_inline_sizes");
|
||||
|
||||
// FIXME (mbrubeck): Get correct mode for absolute containing block
|
||||
|
@ -560,7 +558,6 @@ impl FlexFlow {
|
|||
_inline_end_content_edge: Au,
|
||||
content_inline_size: Au,
|
||||
) {
|
||||
let _scope = layout_debug_scope!("flex::inline_mode_assign_inline_sizes");
|
||||
debug!("inline_mode_assign_inline_sizes");
|
||||
|
||||
debug!("content_inline_size = {:?}", content_inline_size);
|
||||
|
@ -718,8 +715,6 @@ impl FlexFlow {
|
|||
}
|
||||
|
||||
fn inline_mode_assign_block_size(&mut self, layout_context: &LayoutContext) {
|
||||
let _scope = layout_debug_scope!("flex::inline_mode_assign_block_size");
|
||||
|
||||
let line_count = self.lines.len() as i32;
|
||||
let line_align = {
|
||||
let line_align = self
|
||||
|
@ -932,11 +927,6 @@ impl Flow for FlexFlow {
|
|||
}
|
||||
|
||||
fn bubble_inline_sizes(&mut self) {
|
||||
let _scope = layout_debug_scope!(
|
||||
"flex::bubble_inline_sizes {:x}",
|
||||
self.block_flow.base.debug_id()
|
||||
);
|
||||
|
||||
// Flexbox Section 9.0: Generate anonymous flex items:
|
||||
// This part was handled in the flow constructor.
|
||||
|
||||
|
@ -968,10 +958,6 @@ impl Flow for FlexFlow {
|
|||
}
|
||||
|
||||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
||||
let _scope = layout_debug_scope!(
|
||||
"flex::assign_inline_sizes {:x}",
|
||||
self.block_flow.base.debug_id()
|
||||
);
|
||||
debug!("assign_inline_sizes");
|
||||
|
||||
if !self
|
||||
|
|
|
@ -1010,7 +1010,6 @@ impl fmt::Debug for BaseFlow {
|
|||
impl Serialize for BaseFlow {
|
||||
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||
let mut serializer = serializer.serialize_struct("base", 5)?;
|
||||
serializer.serialize_field("id", &self.debug_id())?;
|
||||
serializer.serialize_field(
|
||||
"stacking_relative_position",
|
||||
&self.stacking_relative_position,
|
||||
|
@ -1187,11 +1186,6 @@ impl BaseFlow {
|
|||
self.children.iter_mut()
|
||||
}
|
||||
|
||||
pub fn debug_id(&self) -> usize {
|
||||
let p = self as *const _;
|
||||
p as usize
|
||||
}
|
||||
|
||||
pub fn collect_stacking_contexts_for_children(
|
||||
&mut self,
|
||||
state: &mut StackingContextCollectionState,
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ use crate::fragment::{
|
|||
};
|
||||
use crate::model::IntrinsicISizesContribution;
|
||||
use crate::traversal::PreorderFlowTraversal;
|
||||
use crate::{layout_debug, layout_debug_scope, text, ServoArc};
|
||||
use crate::{text, ServoArc};
|
||||
|
||||
/// `Line`s are represented as offsets into the child list, rather than
|
||||
/// as an object that "owns" fragments. Choosing a different set of line
|
||||
|
@ -1479,8 +1479,6 @@ impl Flow for InlineFlow {
|
|||
fn bubble_inline_sizes(&mut self) {
|
||||
self.update_restyle_damage();
|
||||
|
||||
let _scope = layout_debug_scope!("inline::bubble_inline_sizes {:x}", self.base.debug_id());
|
||||
|
||||
let writing_mode = self.base.writing_mode;
|
||||
for kid in self.base.child_iter_mut() {
|
||||
kid.mut_base().floats = Floats::new(writing_mode);
|
||||
|
@ -1579,8 +1577,6 @@ impl Flow for InlineFlow {
|
|||
/// Recursively (top-down) determines the actual inline-size of child contexts and fragments.
|
||||
/// When called on this context, the context has had its inline-size set by the parent context.
|
||||
fn assign_inline_sizes(&mut self, _: &LayoutContext) {
|
||||
let _scope = layout_debug_scope!("inline::assign_inline_sizes {:x}", self.base.debug_id());
|
||||
|
||||
// Initialize content fragment inline-sizes if they haven't been initialized already.
|
||||
//
|
||||
// TODO: Combine this with `LineBreaker`'s walk in the fragment list, or put this into
|
||||
|
@ -1623,8 +1619,6 @@ impl Flow for InlineFlow {
|
|||
/// Note that we do not need to do in-order traversal because the children
|
||||
/// are always block formatting context.
|
||||
fn assign_block_size(&mut self, layout_context: &LayoutContext) {
|
||||
let _scope = layout_debug_scope!("inline::assign_block_size {:x}", self.base.debug_id());
|
||||
|
||||
// Divide the fragments into lines.
|
||||
//
|
||||
// TODO(pcwalton, #226): Get the CSS `line-height` property from the
|
||||
|
@ -2044,13 +2038,7 @@ impl Flow for InlineFlow {
|
|||
|
||||
impl fmt::Debug for InlineFlow {
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,127 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! Supports writing a trace file created during each layout scope
|
||||
//! that can be viewed by an external tool to make layout debugging easier.
|
||||
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::RefCell;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
#[cfg(debug_assertions)]
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
use serde::Serialize;
|
||||
use serde_json::{to_string, to_value, Value};
|
||||
|
||||
use crate::flow::GetBaseFlow;
|
||||
use crate::flow_ref::FlowRef;
|
||||
|
||||
thread_local!(static STATE_KEY: RefCell<Option<State>> = const { RefCell::new(None) });
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
static DEBUG_ID_COUNTER: AtomicUsize = AtomicUsize::new(0);
|
||||
|
||||
pub struct Scope;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! layout_debug_scope(
|
||||
($($arg:tt)*) => (
|
||||
if cfg!(debug_assertions) {
|
||||
layout_debug::Scope::new(format!($($arg)*))
|
||||
} else {
|
||||
layout_debug::Scope
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct ScopeData {
|
||||
name: String,
|
||||
pre: Value,
|
||||
post: Value,
|
||||
children: Vec<ScopeData>,
|
||||
}
|
||||
|
||||
impl ScopeData {
|
||||
fn new(name: String, pre: Value) -> ScopeData {
|
||||
ScopeData {
|
||||
name,
|
||||
pre,
|
||||
post: Value::Null,
|
||||
children: vec![],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct State {
|
||||
flow_root: FlowRef,
|
||||
scope_stack: Vec<ScopeData>,
|
||||
}
|
||||
|
||||
/// A layout debugging scope. The entire state of the flow tree
|
||||
/// will be output at the beginning and end of this scope.
|
||||
impl Scope {
|
||||
pub fn new(name: String) -> Scope {
|
||||
STATE_KEY.with(|r| {
|
||||
if let Some(ref mut state) = *r.borrow_mut() {
|
||||
let flow_trace = to_value(state.flow_root.base()).unwrap();
|
||||
let data = Box::new(ScopeData::new(name.clone(), flow_trace));
|
||||
state.scope_stack.push(*data);
|
||||
}
|
||||
});
|
||||
Scope
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
impl Drop for Scope {
|
||||
fn drop(&mut self) {
|
||||
STATE_KEY.with(|r| {
|
||||
if let Some(ref mut state) = *r.borrow_mut() {
|
||||
let mut current_scope = state.scope_stack.pop().unwrap();
|
||||
current_scope.post = to_value(state.flow_root.base()).unwrap();
|
||||
let previous_scope = state.scope_stack.last_mut().unwrap();
|
||||
previous_scope.children.push(current_scope);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Generate a unique ID. This is used for items such as Fragment
|
||||
/// which are often reallocated but represent essentially the
|
||||
/// same data.
|
||||
#[cfg(debug_assertions)]
|
||||
pub fn generate_unique_debug_id() -> u16 {
|
||||
DEBUG_ID_COUNTER.fetch_add(1, Ordering::SeqCst) as u16
|
||||
}
|
||||
|
||||
/// Begin a layout debug trace. If this has not been called,
|
||||
/// creating debug scopes has no effect.
|
||||
pub fn begin_trace(flow_root: FlowRef) {
|
||||
assert!(STATE_KEY.with(|r| r.borrow().is_none()));
|
||||
|
||||
STATE_KEY.with(|r| {
|
||||
let flow_trace = to_value(flow_root.base()).unwrap();
|
||||
let state = State {
|
||||
scope_stack: vec![*Box::new(ScopeData::new("root".to_owned(), flow_trace))],
|
||||
flow_root: flow_root.clone(),
|
||||
};
|
||||
*r.borrow_mut() = Some(state);
|
||||
});
|
||||
}
|
||||
|
||||
/// End the debug layout trace. This will write the layout
|
||||
/// trace to disk in the current directory. The output
|
||||
/// file can then be viewed with an external tool.
|
||||
pub fn end_trace(generation: u32) {
|
||||
let mut thread_state = STATE_KEY.with(|r| r.borrow_mut().take().unwrap());
|
||||
assert_eq!(thread_state.scope_stack.len(), 1);
|
||||
let mut root_scope = thread_state.scope_stack.pop().unwrap();
|
||||
root_scope.post = to_value(thread_state.flow_root.base()).unwrap();
|
||||
|
||||
let result = to_string(&root_scope).unwrap();
|
||||
let mut file = File::create(format!("layout_trace-{}.json", generation)).unwrap();
|
||||
file.write_all(result.as_bytes()).unwrap();
|
||||
}
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
#![deny(unsafe_code)]
|
||||
|
||||
pub mod layout_debug;
|
||||
|
||||
mod block;
|
||||
pub mod construct;
|
||||
pub mod context;
|
||||
|
|
|
@ -41,7 +41,6 @@ use crate::table_row::{
|
|||
TableRowSizeData,
|
||||
};
|
||||
use crate::table_wrapper::TableLayout;
|
||||
use crate::{layout_debug, layout_debug_scope};
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe impl crate::flow::HasBaseFlow for TableFlow {}
|
||||
|
@ -292,11 +291,6 @@ impl Flow for TableFlow {
|
|||
/// The maximum min/pref inline-sizes of each column are set from the rows for the automatic
|
||||
/// table layout calculation.
|
||||
fn bubble_inline_sizes(&mut self) {
|
||||
let _scope = layout_debug_scope!(
|
||||
"table::bubble_inline_sizes {:x}",
|
||||
self.block_flow.base.debug_id()
|
||||
);
|
||||
|
||||
// Get column inline sizes from colgroups
|
||||
for kid in self
|
||||
.block_flow
|
||||
|
@ -415,10 +409,6 @@ impl Flow for TableFlow {
|
|||
/// Recursively (top-down) determines the actual inline-size of child contexts and fragments.
|
||||
/// When called on this context, the context has had its inline-size set by the parent context.
|
||||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
||||
let _scope = layout_debug_scope!(
|
||||
"table::assign_inline_sizes {:x}",
|
||||
self.block_flow.base.debug_id()
|
||||
);
|
||||
debug!(
|
||||
"assign_inline_sizes({}): assigning inline_size for flow",
|
||||
"table"
|
||||
|
|
|
@ -27,7 +27,6 @@ use crate::flow::{Flow, FlowClass, FlowFlags, GetBaseFlow, OpaqueFlow};
|
|||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use crate::table::InternalTable;
|
||||
use crate::table_row::{CollapsedBorder, CollapsedBorderFrom};
|
||||
use crate::{layout_debug, layout_debug_scope};
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe impl crate::flow::HasBaseFlow for TableCellFlow {}
|
||||
|
@ -199,11 +198,6 @@ impl Flow for TableCellFlow {
|
|||
/// Minimum/preferred inline-sizes set by this function are used in automatic table layout
|
||||
/// calculation.
|
||||
fn bubble_inline_sizes(&mut self) {
|
||||
let _scope = layout_debug_scope!(
|
||||
"table_cell::bubble_inline_sizes {:x}",
|
||||
self.block_flow.base.debug_id()
|
||||
);
|
||||
|
||||
self.block_flow.bubble_inline_sizes_for_block(true);
|
||||
let specified_inline_size = self
|
||||
.block_flow
|
||||
|
@ -250,10 +244,6 @@ impl Flow for TableCellFlow {
|
|||
/// When called on this context, the context has had its inline-size set by the parent table
|
||||
/// row.
|
||||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
||||
let _scope = layout_debug_scope!(
|
||||
"table_cell::assign_inline_sizes {:x}",
|
||||
self.block_flow.base.debug_id()
|
||||
);
|
||||
debug!(
|
||||
"assign_inline_sizes({}): assigning inline_size for flow",
|
||||
"table_cell"
|
||||
|
|
|
@ -16,7 +16,6 @@ use crate::context::LayoutContext;
|
|||
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
|
||||
use crate::flow::{BaseFlow, Flow, FlowClass, ForceNonfloatedFlag, OpaqueFlow};
|
||||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use crate::{layout_debug, layout_debug_scope};
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe impl crate::flow::HasBaseFlow for TableColGroupFlow {}
|
||||
|
@ -69,11 +68,6 @@ impl Flow for TableColGroupFlow {
|
|||
}
|
||||
|
||||
fn bubble_inline_sizes(&mut self) {
|
||||
let _scope = layout_debug_scope!(
|
||||
"table_colgroup::bubble_inline_sizes {:x}",
|
||||
self.base.debug_id()
|
||||
);
|
||||
|
||||
for fragment in &self.cols {
|
||||
// Retrieve the specified value from the appropriate CSS property.
|
||||
let inline_size = fragment.style().content_inline_size();
|
||||
|
|
|
@ -32,7 +32,6 @@ use crate::flow_list::MutFlowListIterator;
|
|||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt};
|
||||
use crate::table_cell::{CollapsedBordersForCell, TableCellFlow};
|
||||
use crate::{layout_debug, layout_debug_scope};
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe impl crate::flow::HasBaseFlow for TableRowFlow {}
|
||||
|
@ -372,11 +371,6 @@ impl Flow for TableRowFlow {
|
|||
/// The specified column inline-sizes of children cells are used in fixed table layout
|
||||
/// calculation.
|
||||
fn bubble_inline_sizes(&mut self) {
|
||||
let _scope = layout_debug_scope!(
|
||||
"table_row::bubble_inline_sizes {:x}",
|
||||
self.block_flow.base.debug_id()
|
||||
);
|
||||
|
||||
// Bubble up the specified inline-sizes from child table cells.
|
||||
let (mut min_inline_size, mut pref_inline_size) = (Au(0), Au(0));
|
||||
let collapsing_borders = self
|
||||
|
@ -466,10 +460,6 @@ impl Flow for TableRowFlow {
|
|||
}
|
||||
|
||||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
||||
let _scope = layout_debug_scope!(
|
||||
"table_row::assign_inline_sizes {:x}",
|
||||
self.block_flow.base.debug_id()
|
||||
);
|
||||
debug!(
|
||||
"assign_inline_sizes({}): assigning inline_size for flow",
|
||||
"table_row"
|
||||
|
|
|
@ -24,7 +24,6 @@ use crate::display_list::{
|
|||
use crate::flow::{Flow, FlowClass, OpaqueFlow};
|
||||
use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use crate::table::{ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow};
|
||||
use crate::{layout_debug, layout_debug_scope};
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe impl crate::flow::HasBaseFlow for TableRowGroupFlow {}
|
||||
|
@ -122,10 +121,6 @@ impl Flow for TableRowGroupFlow {
|
|||
}
|
||||
|
||||
fn bubble_inline_sizes(&mut self) {
|
||||
let _scope = layout_debug_scope!(
|
||||
"table_rowgroup::bubble_inline_sizes {:x}",
|
||||
self.block_flow.base.debug_id()
|
||||
);
|
||||
// Proper calculation of intrinsic sizes in table layout requires access to the entire
|
||||
// table, which we don't have yet. Defer to our parent.
|
||||
}
|
||||
|
@ -133,10 +128,6 @@ impl Flow for TableRowGroupFlow {
|
|||
/// Recursively (top-down) determines the actual inline-size of child contexts and fragments.
|
||||
/// When called on this context, the context has had its inline-size set by the parent context.
|
||||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
||||
let _scope = layout_debug_scope!(
|
||||
"table_rowgroup::assign_inline_sizes {:x}",
|
||||
self.block_flow.base.debug_id()
|
||||
);
|
||||
debug!(
|
||||
"assign_inline_sizes({}): assigning inline_size for flow",
|
||||
"table_rowgroup"
|
||||
|
|
|
@ -224,11 +224,7 @@ fn construct_flows_at<'dom>(context: &LayoutContext, node: impl LayoutNode<'dom>
|
|||
let mut flow_constructor = FlowConstructor::new(context);
|
||||
if nonincremental_layout || !flow_constructor.repair_if_possible(&tnode) {
|
||||
flow_constructor.process(&tnode);
|
||||
debug!(
|
||||
"Constructed flow for {:?}: {:x}",
|
||||
tnode,
|
||||
tnode.flow_debug_id()
|
||||
);
|
||||
debug!("Constructed flow for {:?}", tnode,);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ use crate::data::{InnerLayoutData, LayoutData, LayoutDataFlags};
|
|||
pub trait ThreadSafeLayoutNodeHelpers<'dom> {
|
||||
fn borrow_layout_data(self) -> Option<AtomicRef<'dom, InnerLayoutData>>;
|
||||
fn mutate_layout_data(self) -> Option<AtomicRefMut<'dom, InnerLayoutData>>;
|
||||
fn flow_debug_id(self) -> usize;
|
||||
|
||||
/// Returns the layout data flags for this node.
|
||||
fn flags(self) -> LayoutDataFlags;
|
||||
|
@ -83,11 +82,6 @@ where
|
|||
.map(|data| data.0.borrow_mut())
|
||||
}
|
||||
|
||||
fn flow_debug_id(self) -> usize {
|
||||
self.borrow_layout_data()
|
||||
.map_or(0, |d| d.flow_construction_result.debug_id())
|
||||
}
|
||||
|
||||
fn flags(self) -> LayoutDataFlags {
|
||||
self.borrow_layout_data().as_ref().unwrap().flags
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue