mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Additional tracing for flex layout, inline layout, and fonts (#34392)
Signed-off-by: Delan Azabani <dazabani@igalia.com>
This commit is contained in:
parent
a4caa0efcb
commit
d65a2e9797
3 changed files with 62 additions and 6 deletions
|
@ -61,6 +61,15 @@ static TEXT_SHAPING_PERFORMANCE_COUNTER: AtomicUsize = AtomicUsize::new(0);
|
||||||
// resources needed by the graphics layer to draw glyphs.
|
// resources needed by the graphics layer to draw glyphs.
|
||||||
|
|
||||||
pub trait PlatformFontMethods: Sized {
|
pub trait PlatformFontMethods: Sized {
|
||||||
|
#[cfg_attr(
|
||||||
|
feature = "tracing",
|
||||||
|
tracing::instrument(
|
||||||
|
name = "PlatformFontMethods::new_from_template",
|
||||||
|
skip_all,
|
||||||
|
fields(servo_profiling = true),
|
||||||
|
level = "trace",
|
||||||
|
)
|
||||||
|
)]
|
||||||
fn new_from_template(
|
fn new_from_template(
|
||||||
template: FontTemplateRef,
|
template: FontTemplateRef,
|
||||||
pt_size: Option<Au>,
|
pt_size: Option<Au>,
|
||||||
|
|
|
@ -121,12 +121,26 @@ struct FlexItemLayoutResult {
|
||||||
|
|
||||||
impl FlexItemLayoutResult {
|
impl FlexItemLayoutResult {
|
||||||
fn compatible_with_containing_block_size(&self, containing_block: &ContainingBlock) -> bool {
|
fn compatible_with_containing_block_size(&self, containing_block: &ContainingBlock) -> bool {
|
||||||
if containing_block.inline_size != self.containing_block_inline_size {
|
if containing_block.inline_size == self.containing_block_inline_size &&
|
||||||
return false;
|
(containing_block.block_size == self.containing_block_block_size ||
|
||||||
|
(!self.depends_on_block_constraints &&
|
||||||
|
!self.has_child_which_depends_on_block_constraints))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
containing_block.block_size == self.containing_block_block_size ||
|
|
||||||
(!self.depends_on_block_constraints &&
|
#[cfg(feature = "tracing")]
|
||||||
!self.has_child_which_depends_on_block_constraints)
|
tracing::warn!(
|
||||||
|
name: "NonReplaced stretch cache miss",
|
||||||
|
cached_inline = ?self.containing_block_inline_size,
|
||||||
|
cached_block = ?self.containing_block_block_size,
|
||||||
|
required_inline = ?containing_block.inline_size,
|
||||||
|
required_block = ?containing_block.block_size,
|
||||||
|
depends_on_block_constraints = self.depends_on_block_constraints,
|
||||||
|
has_child_which_depends_on_block_constraints = self.has_child_which_depends_on_block_constraints,
|
||||||
|
);
|
||||||
|
|
||||||
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compatible_with_containing_block_size_and_content_size(
|
fn compatible_with_containing_block_size_and_content_size(
|
||||||
|
@ -608,7 +622,7 @@ impl FlexContainer {
|
||||||
tracing::instrument(
|
tracing::instrument(
|
||||||
name = "FlexContainer::layout",
|
name = "FlexContainer::layout",
|
||||||
skip_all,
|
skip_all,
|
||||||
fields(servo_profiling = true),
|
fields(servo_profiling = true, self_address = self as *const _ as usize),
|
||||||
level = "trace",
|
level = "trace",
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
|
@ -1833,6 +1847,20 @@ impl FlexItem<'_> {
|
||||||
/// From <https://drafts.csswg.org/css-flexbox/#algo-cross-item>:
|
/// From <https://drafts.csswg.org/css-flexbox/#algo-cross-item>:
|
||||||
/// > performing layout as if it were an in-flow block-level box with the used main
|
/// > performing layout as if it were an in-flow block-level box with the used main
|
||||||
/// > size and the given available space, treating `auto` as `fit-content`.
|
/// > size and the given available space, treating `auto` as `fit-content`.
|
||||||
|
#[cfg_attr(
|
||||||
|
feature = "tracing",
|
||||||
|
tracing::instrument(
|
||||||
|
name = "FlexItem::layout",
|
||||||
|
skip_all,
|
||||||
|
fields(
|
||||||
|
servo_profiling = true,
|
||||||
|
self_address = self as *const _ as usize,
|
||||||
|
box_address = self.box_ as *const _ as usize,
|
||||||
|
for_stretch = non_stretch_layout_result.is_some(),
|
||||||
|
),
|
||||||
|
level = "trace",
|
||||||
|
)
|
||||||
|
)]
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn layout(
|
fn layout(
|
||||||
&self,
|
&self,
|
||||||
|
@ -2774,7 +2802,17 @@ impl FlexItemBox {
|
||||||
if let Some(cache) = &*self.block_content_size_cache.borrow() {
|
if let Some(cache) = &*self.block_content_size_cache.borrow() {
|
||||||
if inline_size == cache.containing_block_inline_size {
|
if inline_size == cache.containing_block_inline_size {
|
||||||
return cache.content_block_size;
|
return cache.content_block_size;
|
||||||
|
} else {
|
||||||
|
#[cfg(feature = "tracing")]
|
||||||
|
tracing::warn!(
|
||||||
|
name: "NonReplaced cache miss",
|
||||||
|
cached = ?cache.containing_block_inline_size,
|
||||||
|
required = ?inline_size,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
#[cfg(feature = "tracing")]
|
||||||
|
tracing::warn!(name: "NonReplaced no cache", required = ?inline_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
let layout = non_replaced.layout(
|
let layout = non_replaced.layout(
|
||||||
|
|
|
@ -1505,6 +1505,15 @@ impl From<&InheritedText> for SegmentContentFlags {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InlineFormattingContext {
|
impl InlineFormattingContext {
|
||||||
|
#[cfg_attr(
|
||||||
|
feature = "tracing",
|
||||||
|
tracing::instrument(
|
||||||
|
name = "InlineFormattingContext::new_with_builder",
|
||||||
|
skip_all,
|
||||||
|
fields(servo_profiling = true),
|
||||||
|
level = "trace",
|
||||||
|
)
|
||||||
|
)]
|
||||||
pub(super) fn new_with_builder(
|
pub(super) fn new_with_builder(
|
||||||
builder: InlineFormattingContextBuilder,
|
builder: InlineFormattingContextBuilder,
|
||||||
layout_context: &LayoutContext,
|
layout_context: &LayoutContext,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue