mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 10:38:13 +00:00
LibWeb: Reorganize layout algorithms around available space
This is a big and messy change, and here's the gist: - AvaliableSpace is now 2x AvailableSize (width and height) - Layout algorithms are redesigned around the idea of available space - When doing layout across nested formatting contexts, the parent context tells the child context how much space is available for the child's root box in both axes. - "Available space" replaces "containing block width" in most places. - The width and height in a box's UsedValues are considered to be definite after they're assigned to. Marking something as having definite size is no longer a separate step, This probably introduces various regressions, but the big win here is that our layout system now works with available space, just like the specs are written. Fixing issues will be much easier going forward, since you don't need to do nearly as much conversion from "spec logic" to "LibWeb logic" as you previously did.
This commit is contained in:
parent
b55c4ccdf7
commit
9c44634ca5
19 changed files with 651 additions and 652 deletions
|
@ -804,16 +804,15 @@ void Document::update_layout()
|
|||
|
||||
auto& icb = static_cast<Layout::InitialContainingBlock&>(*m_layout_root);
|
||||
auto& icb_state = layout_state.get_mutable(icb);
|
||||
icb_state.set_has_definite_width(true);
|
||||
icb_state.set_has_definite_height(true);
|
||||
icb_state.set_content_width(viewport_rect.width());
|
||||
icb_state.set_content_height(viewport_rect.height());
|
||||
|
||||
root_formatting_context.run(
|
||||
*m_layout_root,
|
||||
Layout::LayoutMode::Normal,
|
||||
Layout::AvailableSpace::make_definite(viewport_rect.width()),
|
||||
Layout::AvailableSpace::make_definite(viewport_rect.height()));
|
||||
Layout::AvailableSpace(
|
||||
Layout::AvailableSize::make_definite(viewport_rect.width()),
|
||||
Layout::AvailableSize::make_definite(viewport_rect.height())));
|
||||
}
|
||||
|
||||
layout_state.commit();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue