mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
refactor: use is_zero() instead of comparing with Au::Zero() (#36347)
Use `is_zero()` instead of comparing with `Au::Zero()` for zero checks. Testing: This change does not cause behaviour change, a test is not necessary. Fixes: #36300 --------- Signed-off-by: Barigbue <barigbuenbira@gmail.com>
This commit is contained in:
parent
2fe57cc2a2
commit
a0730d7154
7 changed files with 16 additions and 14 deletions
|
@ -1720,7 +1720,7 @@ impl InlineFormattingContext {
|
|||
let mut collapsible_margins_in_children = CollapsedBlockMargins::zero();
|
||||
let content_block_size = layout.current_line.start_position.block;
|
||||
collapsible_margins_in_children.collapsed_through = !layout.had_inflow_content &&
|
||||
content_block_size == Au::zero() &&
|
||||
content_block_size.is_zero() &&
|
||||
collapsible_with_parent_start_margin.0;
|
||||
|
||||
CacheableLayoutResult {
|
||||
|
|
|
@ -162,7 +162,7 @@ impl BlockLevelBox {
|
|||
_ => return false,
|
||||
};
|
||||
|
||||
if pbm.padding.block_start != Au::zero() || pbm.border.block_start != Au::zero() {
|
||||
if !pbm.padding.block_start.is_zero() || !pbm.border.block_start.is_zero() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ impl BlockLevelBox {
|
|||
|
||||
if !block_size_is_zero_or_intrinsic(style.content_block_size(), containing_block) ||
|
||||
!block_size_is_zero_or_intrinsic(style.min_block_size(), containing_block) ||
|
||||
pbm.padding_border_sums.block != Au::zero()
|
||||
!pbm.padding_border_sums.block.is_zero()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -907,7 +907,7 @@ fn layout_in_flow_non_replaced_block_level_same_formatting_context(
|
|||
|
||||
let computed_block_size = style.content_block_size();
|
||||
let start_margin_can_collapse_with_children =
|
||||
pbm.padding.block_start == Au::zero() && pbm.border.block_start == Au::zero();
|
||||
pbm.padding.block_start.is_zero() && pbm.border.block_start.is_zero();
|
||||
|
||||
let mut clearance = None;
|
||||
let parent_containing_block_position_info;
|
||||
|
@ -1024,14 +1024,14 @@ fn layout_in_flow_non_replaced_block_level_same_formatting_context(
|
|||
}
|
||||
|
||||
let collapsed_through = collapsible_margins_in_children.collapsed_through &&
|
||||
pbm.padding_border_sums.block == Au::zero() &&
|
||||
pbm.padding_border_sums.block.is_zero() &&
|
||||
block_size_is_zero_or_intrinsic(computed_block_size, containing_block) &&
|
||||
block_size_is_zero_or_intrinsic(style.min_block_size(), containing_block);
|
||||
block_margins_collapsed_with_children.collapsed_through = collapsed_through;
|
||||
|
||||
let end_margin_can_collapse_with_children = collapsed_through ||
|
||||
(pbm.padding.block_end == Au::zero() &&
|
||||
pbm.border.block_end == Au::zero() &&
|
||||
(pbm.padding.block_end.is_zero() &&
|
||||
pbm.border.block_end.is_zero() &&
|
||||
!containing_block_for_children.size.block.is_definite());
|
||||
if end_margin_can_collapse_with_children {
|
||||
block_margins_collapsed_with_children
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue