mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
layout: Remove some unneeded is_table
parameters (#35064)
We can just check the `LayoutStyle` instead. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
875e387004
commit
f57ceeb3b4
5 changed files with 10 additions and 20 deletions
|
@ -440,7 +440,6 @@ fn compute_inline_content_sizes_for_block_level_boxes(
|
||||||
&LogicalVec2::zero(),
|
&LogicalVec2::zero(),
|
||||||
false, /* auto_block_size_stretches_to_containing_block */
|
false, /* auto_block_size_stretches_to_containing_block */
|
||||||
false, /* is_replaced */
|
false, /* is_replaced */
|
||||||
false, /* is_table */
|
|
||||||
!matches!(base.style.pseudo(), Some(PseudoElement::ServoAnonymousBox)),
|
!matches!(base.style.pseudo(), Some(PseudoElement::ServoAnonymousBox)),
|
||||||
|_| None, /* TODO: support preferred aspect ratios on non-replaced boxes */
|
|_| None, /* TODO: support preferred aspect ratios on non-replaced boxes */
|
||||||
|constraint_space| {
|
|constraint_space| {
|
||||||
|
@ -855,7 +854,6 @@ fn layout_in_flow_non_replaced_block_level_same_formatting_context(
|
||||||
containing_block,
|
containing_block,
|
||||||
&layout_style,
|
&layout_style,
|
||||||
get_inline_content_sizes,
|
get_inline_content_sizes,
|
||||||
false, /* is_table */
|
|
||||||
);
|
);
|
||||||
let ResolvedMargins {
|
let ResolvedMargins {
|
||||||
margin,
|
margin,
|
||||||
|
@ -1098,7 +1096,6 @@ impl IndependentNonReplacedContents {
|
||||||
containing_block,
|
containing_block,
|
||||||
&layout_style,
|
&layout_style,
|
||||||
get_inline_content_sizes,
|
get_inline_content_sizes,
|
||||||
self.is_table(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let layout = self.layout(
|
let layout = self.layout(
|
||||||
|
@ -1639,7 +1636,6 @@ fn solve_containing_block_padding_and_border_for_in_flow_box<'a>(
|
||||||
containing_block: &ContainingBlock<'_>,
|
containing_block: &ContainingBlock<'_>,
|
||||||
layout_style: &'a LayoutStyle,
|
layout_style: &'a LayoutStyle,
|
||||||
get_inline_content_sizes: impl FnOnce(&ConstraintSpace) -> ContentSizes,
|
get_inline_content_sizes: impl FnOnce(&ConstraintSpace) -> ContentSizes,
|
||||||
is_table: bool,
|
|
||||||
) -> ContainingBlockPaddingAndBorder<'a> {
|
) -> ContainingBlockPaddingAndBorder<'a> {
|
||||||
let style = layout_style.style();
|
let style = layout_style.style();
|
||||||
if matches!(style.pseudo(), Some(PseudoElement::ServoAnonymousBox)) {
|
if matches!(style.pseudo(), Some(PseudoElement::ServoAnonymousBox)) {
|
||||||
|
@ -1701,7 +1697,7 @@ fn solve_containing_block_padding_and_border_for_in_flow_box<'a>(
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
// TODO: the automatic inline size should take `justify-self` into account.
|
// TODO: the automatic inline size should take `justify-self` into account.
|
||||||
let automatic_inline_size = if is_table {
|
let automatic_inline_size = if layout_style.is_table() {
|
||||||
Size::FitContent
|
Size::FitContent
|
||||||
} else {
|
} else {
|
||||||
Size::Stretch
|
Size::Stretch
|
||||||
|
|
|
@ -186,14 +186,6 @@ impl IndependentFormattingContext {
|
||||||
self.base.base_fragment_info
|
self.base.base_fragment_info
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub(crate) fn is_table(&self) -> bool {
|
|
||||||
match &self.contents {
|
|
||||||
IndependentFormattingContextContents::NonReplaced(content) => content.is_table(),
|
|
||||||
IndependentFormattingContextContents::Replaced(_) => false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn inline_content_sizes(
|
pub(crate) fn inline_content_sizes(
|
||||||
&self,
|
&self,
|
||||||
layout_context: &LayoutContext,
|
layout_context: &LayoutContext,
|
||||||
|
@ -222,7 +214,6 @@ impl IndependentFormattingContext {
|
||||||
auto_minimum,
|
auto_minimum,
|
||||||
auto_block_size_stretches_to_containing_block,
|
auto_block_size_stretches_to_containing_block,
|
||||||
self.is_replaced(),
|
self.is_replaced(),
|
||||||
self.is_table(),
|
|
||||||
true, /* establishes_containing_block */
|
true, /* establishes_containing_block */
|
||||||
|padding_border_sums| self.preferred_aspect_ratio(padding_border_sums),
|
|padding_border_sums| self.preferred_aspect_ratio(padding_border_sums),
|
||||||
|constraint_space| self.inline_content_sizes(layout_context, constraint_space),
|
|constraint_space| self.inline_content_sizes(layout_context, constraint_space),
|
||||||
|
|
|
@ -463,15 +463,14 @@ impl HoistedAbsolutelyPositionedBox {
|
||||||
let absolutely_positioned_box = self.absolutely_positioned_box.borrow();
|
let absolutely_positioned_box = self.absolutely_positioned_box.borrow();
|
||||||
let context = &absolutely_positioned_box.context;
|
let context = &absolutely_positioned_box.context;
|
||||||
let style = context.style().clone();
|
let style = context.style().clone();
|
||||||
|
let layout_style = context.layout_style();
|
||||||
let ContentBoxSizesAndPBM {
|
let ContentBoxSizesAndPBM {
|
||||||
content_box_sizes,
|
content_box_sizes,
|
||||||
pbm,
|
pbm,
|
||||||
..
|
..
|
||||||
} = context
|
} = layout_style.content_box_sizes_and_padding_border_margin(&containing_block.into());
|
||||||
.layout_style()
|
|
||||||
.content_box_sizes_and_padding_border_margin(&containing_block.into());
|
|
||||||
let containing_block = &containing_block.into();
|
let containing_block = &containing_block.into();
|
||||||
let is_table = context.is_table();
|
let is_table = layout_style.is_table();
|
||||||
|
|
||||||
let shared_fragment = self.fragment.borrow();
|
let shared_fragment = self.fragment.borrow();
|
||||||
let static_position_rect = shared_fragment
|
let static_position_rect = shared_fragment
|
||||||
|
|
|
@ -115,7 +115,6 @@ pub(crate) fn outer_inline(
|
||||||
auto_minimum: &LogicalVec2<Au>,
|
auto_minimum: &LogicalVec2<Au>,
|
||||||
auto_block_size_stretches_to_containing_block: bool,
|
auto_block_size_stretches_to_containing_block: bool,
|
||||||
is_replaced: bool,
|
is_replaced: bool,
|
||||||
is_table: bool,
|
|
||||||
establishes_containing_block: bool,
|
establishes_containing_block: bool,
|
||||||
get_preferred_aspect_ratio: impl FnOnce(&LogicalVec2<Au>) -> Option<AspectRatio>,
|
get_preferred_aspect_ratio: impl FnOnce(&LogicalVec2<Au>) -> Option<AspectRatio>,
|
||||||
get_content_size: impl FnOnce(&ConstraintSpace) -> InlineContentSizesResult,
|
get_content_size: impl FnOnce(&ConstraintSpace) -> InlineContentSizesResult,
|
||||||
|
@ -234,7 +233,7 @@ pub(crate) fn outer_inline(
|
||||||
|
|
||||||
// Regardless of their sizing properties, tables are always forced to be at least
|
// Regardless of their sizing properties, tables are always forced to be at least
|
||||||
// as big as their min-content size, so floor the minimums.
|
// as big as their min-content size, so floor the minimums.
|
||||||
if is_table {
|
if layout_style.is_table() {
|
||||||
min_min_content.max_assign(content_size.sizes.min_content);
|
min_min_content.max_assign(content_size.sizes.min_content);
|
||||||
min_max_content.max_assign(content_size.sizes.min_content);
|
min_max_content.max_assign(content_size.sizes.min_content);
|
||||||
min_depends_on_block_constraints |= content_size.depends_on_block_constraints;
|
min_depends_on_block_constraints |= content_size.depends_on_block_constraints;
|
||||||
|
|
|
@ -817,6 +817,11 @@ impl LayoutStyle<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub(crate) fn is_table(&self) -> bool {
|
||||||
|
matches!(self, Self::Table(_))
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn content_box_sizes_and_padding_border_margin(
|
pub(crate) fn content_box_sizes_and_padding_border_margin(
|
||||||
&self,
|
&self,
|
||||||
containing_block: &IndefiniteContainingBlock,
|
containing_block: &IndefiniteContainingBlock,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue