diff options
author | Andreas Kling <kling@serenityos.org> | 2020-06-14 18:48:10 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-14 19:01:54 +0200 |
commit | c7d9229a0f1cc880ea8f9b0da772ca72b48094ef (patch) | |
tree | db3524e7b2e372ebf42e5f3e8e7ed9f614dd2c27 /Libraries/LibWeb/Dump.cpp | |
parent | 2b47ba6c3fe4a161a531d8f5963676b76a51106f (diff) | |
download | serenity-c7d9229a0f1cc880ea8f9b0da772ca72b48094ef.zip |
LibWeb: Reorganize layout algorithm
Previously, layout recursively performed these steps (roughly):
1. Compute own width
2. Compute own position
3. Layout in-flow children
4. Compute own height
5. Layout absolutely positioned descendants
However, step (2) was pretty inconsistent. Some things computed their
own position, others had their parent do it for them, etc.
To get closer to CSS spec language, and make things easier in general,
this patch reorganizes the algorithm into:
1. Compute own width & height
2. Compute width & height of in-flow managed descendants
3. Move in-flow managed descendants to their final position
4. Layout absolutely positioned descendants
Block layout is now driven by the containing block, which will iterate
the descendants it's responsible for. There are a lot of inefficient
patterns in this logic right now, but they can easily be replaced with
better iteration functions once we settle on a long-term architecture.
Since the ICB (LayoutDocument) is at (0, 0), it doesn't rely on a
containing block to move it into place.
This code is still evolving along with my understanding of CSS layout,
so it's likely that we'll reorganize this again sooner or later. :^)
Diffstat (limited to 'Libraries/LibWeb/Dump.cpp')
-rw-r--r-- | Libraries/LibWeb/Dump.cpp | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/Libraries/LibWeb/Dump.cpp b/Libraries/LibWeb/Dump.cpp index 99b12ead93..46d1c2898c 100644 --- a/Libraries/LibWeb/Dump.cpp +++ b/Libraries/LibWeb/Dump.cpp @@ -146,11 +146,6 @@ void dump_tree(const LayoutNode& layout_node) if (layout_node.is_block() && static_cast<const LayoutBlock&>(layout_node).children_are_inline()) { auto& block = static_cast<const LayoutBlock&>(layout_node); - if (block.absolutely_positioned_descendant_count()) { - for (size_t i = 0; i < indent; ++i) - dbgprintf(" "); - dbgprintf(" %zu absolutely positioned descendant(s) tracked here\n", block.absolutely_positioned_descendant_count()); - } for (size_t i = 0; i < indent; ++i) dbgprintf(" "); dbgprintf(" Line boxes (%d):\n", block.line_boxes().size()); |