move padding adjustments to inside is_replaced condition

This commit is contained in:
Bob 2017-11-22 11:57:34 +00:00
parent e926bef796
commit 0eb8c06c7f

View file

@ -1259,7 +1259,7 @@ impl BlockFlow {
// TODO: Right now, this content block-size value includes the // TODO: Right now, this content block-size value includes the
// margin because of erroneous block-size calculation in fragment. // margin because of erroneous block-size calculation in fragment.
// Check this when that has been fixed. // Check this when that has been fixed.
let block_size_used_val = self.fragment.border_box.size.block; let block_size_used_val = self.fragment.border_box.size.block - self.fragment.border_padding.block_start_end();
solution = Some(BSizeConstraintSolution::solve_vertical_constraints_abs_replaced( solution = Some(BSizeConstraintSolution::solve_vertical_constraints_abs_replaced(
block_size_used_val, block_size_used_val,
margin_block_start, margin_block_start,
@ -1300,11 +1300,7 @@ impl BlockFlow {
self.base.position.start.b = solution.block_start + self.fragment.margin.block_start self.base.position.start.b = solution.block_start + self.fragment.margin.block_start
} }
let block_size = if self.fragment.is_replaced() { let block_size = solution.block_size + self.fragment.border_padding.block_start_end();
solution.block_size
} else {
(solution.block_size + self.fragment.border_padding.block_start_end())
};
self.fragment.border_box.size.block = block_size; self.fragment.border_box.size.block = block_size;
self.base.position.size.block = block_size; self.base.position.size.block = block_size;