1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:38:10 +00:00
serenity/Libraries/LibWeb/Layout
Andreas Kling c7d9229a0f 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. :^)
2020-06-14 19:01:54 +02:00
..
BoxModelMetrics.cpp LibWeb: Rename BoxModelMetrics::full_margin() => margin_box() 2020-06-12 13:44:11 +02:00
BoxModelMetrics.h LibWeb: Rename BoxModelMetrics::full_margin() => margin_box() 2020-06-12 13:44:11 +02:00
LayoutBlock.cpp LibWeb: Reorganize layout algorithm 2020-06-14 19:01:54 +02:00
LayoutBlock.h LibWeb: Reorganize layout algorithm 2020-06-14 19:01:54 +02:00
LayoutBox.cpp LibWeb: Add LayoutNode::frame() reference getter 2020-06-14 16:45:45 +02:00
LayoutBox.h LibWeb: Reorganize layout algorithm 2020-06-14 19:01:54 +02:00
LayoutBreak.cpp LibWeb: Basic support for display:inline-block with width:auto 2020-05-26 22:02:27 +02:00
LayoutBreak.h LibWeb: Basic support for display:inline-block with width:auto 2020-05-26 22:02:27 +02:00
LayoutCanvas.cpp LibWeb: Rework the layout engine to use relative offsets 2020-06-10 10:46:57 +02:00
LayoutCanvas.h LibWeb: Basic support for display:inline-block with width:auto 2020-05-26 22:02:27 +02:00
LayoutDocument.cpp LibWeb: Add LayoutNode::frame() reference getter 2020-06-14 16:45:45 +02:00
LayoutDocument.h LibGfx: Rename Rect,Point,Size => IntRect,IntPoint,IntSize 2020-06-10 10:59:04 +02:00
LayoutFrame.cpp LibWeb: Don't choke when trying to render a document-less <iframe> 2020-06-14 15:32:38 +02:00
LayoutFrame.h LibWeb: Start adding support for the <iframe> element! :^) 2020-06-05 23:36:02 +02:00
LayoutImage.cpp LibWeb: Split out image loading logic from HTMLImageElement 2020-06-13 22:22:54 +02:00
LayoutImage.h LibWeb: Split out image loading logic from HTMLImageElement 2020-06-13 22:22:54 +02:00
LayoutInline.cpp LibWeb: Rename directory LibHTML => LibWeb 2020-03-07 10:32:51 +01:00
LayoutInline.h LibWeb: Rename directory LibHTML => LibWeb 2020-03-07 10:32:51 +01:00
LayoutListItem.cpp LibWeb: Rework the layout engine to use relative offsets 2020-06-10 10:46:57 +02:00
LayoutListItem.h LibWeb: Basic support for display:inline-block with width:auto 2020-05-26 22:02:27 +02:00
LayoutListItemMarker.cpp LibGfx: Rename Rect,Point,Size => IntRect,IntPoint,IntSize 2020-06-10 10:59:04 +02:00
LayoutListItemMarker.h LibWeb: Rename directory LibHTML => LibWeb 2020-03-07 10:32:51 +01:00
LayoutNode.cpp LibWeb: Add LayoutNode::frame() reference getter 2020-06-14 16:45:45 +02:00
LayoutNode.h LibWeb: Add LayoutNode::frame() reference getter 2020-06-14 16:45:45 +02:00
LayoutPosition.h LibWeb: Rename directory LibHTML => LibWeb 2020-03-07 10:32:51 +01:00
LayoutReplaced.cpp LibWeb: Reorganize layout algorithm 2020-06-14 19:01:54 +02:00
LayoutReplaced.h LibWeb: Reorganize layout algorithm 2020-06-14 19:01:54 +02:00
LayoutTable.cpp LibWeb: LayoutMode line_break_policy => LayoutMode layout_mode 2020-05-27 19:52:18 +02:00
LayoutTable.h LibWeb: Basic support for display:inline-block with width:auto 2020-05-26 22:02:27 +02:00
LayoutTableCell.cpp LibWeb: Add LayoutTableCell::colspan() 2020-06-13 00:10:52 +02:00
LayoutTableCell.h LibWeb: Add LayoutTableCell::colspan() 2020-06-13 00:10:52 +02:00
LayoutTableRow.cpp LibWeb: Remove some unused functions in LayoutTableRow 2020-06-13 15:30:27 +02:00
LayoutTableRow.h LibWeb: Remove some unused functions in LayoutTableRow 2020-06-13 15:30:27 +02:00
LayoutTableRowGroup.cpp LibWeb: Reorganize layout algorithm 2020-06-14 19:01:54 +02:00
LayoutTableRowGroup.h LibWeb: More work on table layout 2020-06-13 00:12:23 +02:00
LayoutText.cpp LibWeb: Teach line layout to collapse whitespace across fragments 2020-06-13 15:03:16 +02:00
LayoutText.h LibWeb: Basic support for display:inline-block with width:auto 2020-05-26 22:02:27 +02:00
LayoutTreeBuilder.cpp LibWeb: Whine in debug log instead of asserting on partial layout FIXME 2020-06-06 22:15:17 +02:00
LayoutTreeBuilder.h LibWeb: Rename directory LibHTML => LibWeb 2020-03-07 10:32:51 +01:00
LayoutWidget.cpp LibWeb: Add LayoutNode::frame() reference getter 2020-06-14 16:45:45 +02:00
LayoutWidget.h LibWeb: Simplify LayoutWidget layout 2020-06-05 21:50:03 +02:00
LineBox.cpp LibWeb: Teach line layout to collapse whitespace across fragments 2020-06-13 15:03:16 +02:00
LineBox.h LibWeb: Teach line layout to collapse whitespace across fragments 2020-06-13 15:03:16 +02:00
LineBoxFragment.cpp LibWeb: Teach line layout to collapse whitespace across fragments 2020-06-13 15:03:16 +02:00
LineBoxFragment.h LibWeb: Teach line layout to collapse whitespace across fragments 2020-06-13 15:03:16 +02:00