mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 05:05:08 +00:00
LibWeb: Move replaced element layout out of Layout::ReplacedBox
Replaced elements are now laid out by the current formatting context. Since the logic is almost identical in BFC and IFC, it's implemented by static helpers in FormattingContext.
This commit is contained in:
parent
e8d6691470
commit
67732df034
7 changed files with 102 additions and 91 deletions
|
@ -83,8 +83,7 @@ void BlockFormattingContext::compute_width(Box& box)
|
|||
// FIXME: This should not be done *by* ReplacedBox
|
||||
auto& replaced = downcast<ReplacedBox>(box);
|
||||
replaced.prepare_for_replaced_layout();
|
||||
auto width = replaced.calculate_width();
|
||||
replaced.set_width(width);
|
||||
compute_width_for_block_level_replaced_element_in_normal_flow(replaced);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -257,6 +256,16 @@ void BlockFormattingContext::compute_width_for_floating_box(Box& box)
|
|||
box.set_width(final_width);
|
||||
}
|
||||
|
||||
void BlockFormattingContext::compute_width_for_block_level_replaced_element_in_normal_flow(ReplacedBox& box)
|
||||
{
|
||||
box.set_width(compute_width_for_replaced_element(box));
|
||||
}
|
||||
|
||||
void BlockFormattingContext::compute_height_for_block_level_replaced_element_in_normal_flow(ReplacedBox& box)
|
||||
{
|
||||
box.set_height(compute_height_for_replaced_element(box));
|
||||
}
|
||||
|
||||
void BlockFormattingContext::compute_width_for_absolutely_positioned_block(Box& box)
|
||||
{
|
||||
auto& containing_block = context_box();
|
||||
|
@ -400,9 +409,7 @@ void BlockFormattingContext::compute_width_for_absolutely_positioned_block(Box&
|
|||
void BlockFormattingContext::compute_height(Box& box)
|
||||
{
|
||||
if (box.is_replaced()) {
|
||||
// FIXME: This should not be done *by* ReplacedBox
|
||||
auto height = downcast<ReplacedBox>(box).calculate_height();
|
||||
box.set_height(height);
|
||||
compute_height_for_block_level_replaced_element_in_normal_flow(downcast<ReplacedBox>(box));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue