mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:28:12 +00:00
LibWeb: Basic support for display:inline-block with width:auto
We now implement the somewhat fuzzy shrink-to-fit algorithm when laying out inline-block elements with both block and inline children. Shrink-to-fit works by doing two speculative layouts of the entire subtree inside the current block, to compute two things: 1. Preferred minimum width: If we made a line break at every chance we had, how wide would the widest line be? 2. Preferred width: We break only when explicitly told to (e.g "<br>") How wide would the widest line be? We then shrink the width of the inline-block element to an appropriate value based on the above, taking the available width in the containing block into consideration (sans all the box model fluff.) To make the speculative layouts possible, plumb a LayoutMode enum throughout the layout system since it needs to be respected in various places. Note that this is quite hackish and I'm sure there are smarter ways to do a lot of this. But it does kinda work! :^)
This commit is contained in:
parent
4e8bcda4d1
commit
f01af62313
24 changed files with 184 additions and 97 deletions
|
@ -39,9 +39,9 @@ LayoutTableRow::~LayoutTableRow()
|
|||
{
|
||||
}
|
||||
|
||||
void LayoutTableRow::layout()
|
||||
void LayoutTableRow::layout(LayoutMode line_break_policy)
|
||||
{
|
||||
LayoutBox::layout();
|
||||
LayoutBox::layout(line_break_policy);
|
||||
}
|
||||
|
||||
LayoutTableCell* LayoutTableRow::first_cell()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue