mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 18:38:12 +00:00
LibWeb: Pass current target box to BFC::run()
The BFC "context box" is now the outer box of the block formatting context. Previously the context box was always the current target box, which made it hard to reason about who was really the containing block of whom in various places. Note that IFC still has the containing block as its context box, this change only affects BFC. However, to clarify the situation in IFC, I've added a containing_block() getter than returns the context_box().
This commit is contained in:
parent
b638e74b68
commit
59de4adb60
14 changed files with 138 additions and 156 deletions
|
@ -110,13 +110,13 @@ HitTestResult BlockBox::hit_test(const Gfx::IntPoint& position, HitTestType type
|
|||
|
||||
void BlockBox::split_into_lines(InlineFormattingContext& context, LayoutMode layout_mode)
|
||||
{
|
||||
auto& container = context.context_box();
|
||||
auto* line_box = &container.ensure_last_line_box();
|
||||
auto& containing_block = context.containing_block();
|
||||
auto* line_box = &containing_block.ensure_last_line_box();
|
||||
|
||||
float available_width = context.available_width_at_line(container.line_boxes().size() - 1);
|
||||
float available_width = context.available_width_at_line(containing_block.line_boxes().size() - 1);
|
||||
|
||||
if (layout_mode != LayoutMode::OnlyRequiredLineBreaks && line_box->width() > 0 && line_box->width() + width() > available_width) {
|
||||
line_box = &container.add_line_box();
|
||||
line_box = &containing_block.add_line_box();
|
||||
}
|
||||
line_box->add_fragment(*this, 0, 0, width(), height());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue