1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-17 20:45:09 +00:00
serenity/Userland/Libraries/LibWeb/Layout
Andreas Kling 39b7fbfeb9 LibWeb: Rewrite CSS float implementation to use offset-from-edge
The previous implementation used relative X offsets for both left and
right-side floats. This made right-side floats super awkward, since we
could only determine their X position once the width of the BFC root was
known, and for BFC roots with automatic width, this was not even working
at all most of the time.

This patch changes the way we deal with floats so that BFC keeps track
of the offset-from-edge for each float. The offset is the distance from
the BFC root edge (left or right, depending on float direction) to the
"innermost" margin edge of the floating box.

Floating box are now laid out in two passes: while going through the
normal flow layout, we put floats in their *static* position (i.e the
position they would have occupied if they weren't floating) and then
update the Y position value to the final one.

The second pass occurs later on, when the BFC root has had its width
assigned by the parent context. Once we know the root width, we can
set the X position value of floating boxes. (Because the X position of
right-side floats is relative to the right edge of the BFC root.)
2022-03-18 15:18:48 +01:00
..
BlockContainer.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
BlockContainer.h LibWeb: Move hit testing to the painting tree 2022-03-11 00:21:49 +01:00
BlockFormattingContext.cpp LibWeb: Rewrite CSS float implementation to use offset-from-edge 2022-03-18 15:18:48 +01:00
BlockFormattingContext.h LibWeb: Rewrite CSS float implementation to use offset-from-edge 2022-03-18 15:18:48 +01:00
Box.cpp LibWeb: Remove a bunch of no-longer needed #includes 2022-03-11 00:21:49 +01:00
Box.h LibWeb: Remove a bunch of no-longer needed #includes 2022-03-11 00:21:49 +01:00
BoxModelMetrics.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
BoxModelMetrics.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
BreakNode.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
BreakNode.h LibWeb: Let Paintable perform the painting 2022-03-11 00:21:49 +01:00
ButtonBox.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
ButtonBox.h LibWeb: Refactor all LabelableNode subclasses + input event handling :^) 2022-03-16 00:38:31 +01:00
CanvasBox.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
CanvasBox.h LibWeb: Make Paintable ref-counted 2022-03-11 00:21:49 +01:00
CheckBox.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
CheckBox.h LibWeb: Refactor all LabelableNode subclasses + input event handling :^) 2022-03-16 00:38:31 +01:00
FlexFormattingContext.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
FlexFormattingContext.h LibWeb: Add a debug helper to dump current state of an FFC 2022-03-13 00:04:51 +01:00
FormAssociatedLabelableNode.h LibWeb: Refactor all LabelableNode subclasses + input event handling :^) 2022-03-16 00:38:31 +01:00
FormattingContext.cpp LibWeb: Rewrite CSS float implementation to use offset-from-edge 2022-03-18 15:18:48 +01:00
FormattingContext.h LibWeb: Rewrite CSS float implementation to use offset-from-edge 2022-03-18 15:18:48 +01:00
FormattingState.cpp LibWeb: Make Layout::FormattingState copies shallow 2022-03-13 00:04:51 +01:00
FormattingState.h LibWeb: Give FormattingState a reference to its root state 2022-03-18 15:18:48 +01:00
FrameBox.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
FrameBox.h LibWeb: Make Paintable ref-counted 2022-03-11 00:21:49 +01:00
ImageBox.cpp LibWeb: Remove a bunch of no-longer needed #includes 2022-03-11 00:21:49 +01:00
ImageBox.h LibWeb: Make Paintable ref-counted 2022-03-11 00:21:49 +01:00
InitialContainingBlock.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
InitialContainingBlock.h LibWeb: Move hit testing to the painting tree 2022-03-11 00:21:49 +01:00
InlineFormattingContext.cpp LibWeb: Rewrite CSS float implementation to use offset-from-edge 2022-03-18 15:18:48 +01:00
InlineFormattingContext.h LibWeb: Rewrite CSS float implementation to use offset-from-edge 2022-03-18 15:18:48 +01:00
InlineLevelIterator.cpp LibWeb: Make InlineLevelIterator emit absolutely positioned items 2022-03-08 00:19:49 +01:00
InlineLevelIterator.h LibWeb: Make InlineLevelIterator emit absolutely positioned items 2022-03-08 00:19:49 +01:00
InlineNode.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
InlineNode.h LibWeb: Make Paintable ref-counted 2022-03-11 00:21:49 +01:00
Label.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
Label.h LibWeb: Refactor all LabelableNode subclasses + input event handling :^) 2022-03-16 00:38:31 +01:00
LabelableNode.cpp LibWeb: Move mouse event and label logic from layout to painting tree 2022-03-11 00:21:49 +01:00
LabelableNode.h LibWeb: Move mouse event and label logic from layout to painting tree 2022-03-11 00:21:49 +01:00
LayoutPosition.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
LayoutPosition.h Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
LineBox.cpp LibWeb: Respect inline-axis margins between line box fragments :^) 2022-03-09 18:47:32 +01:00
LineBox.h Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
LineBoxFragment.cpp LibWeb: Move text fragment painting to PaintableWithLines 2022-03-16 23:13:05 +01:00
LineBoxFragment.h LibWeb: Move text fragment painting to PaintableWithLines 2022-03-16 23:13:05 +01:00
LineBuilder.cpp LibWeb: Rewrite CSS float implementation to use offset-from-edge 2022-03-18 15:18:48 +01:00
LineBuilder.h LibWeb: Make LineBuilder aware of the current LayoutMode 2022-03-18 15:18:48 +01:00
ListItemBox.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
ListItemBox.h LibWeb: Make display: foo box constructors take the Element by pointer 2022-02-25 19:35:34 +01:00
ListItemMarkerBox.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
ListItemMarkerBox.h LibWeb: Add some fast_is<T> helpers for hot classes on GitHub :^) 2022-03-13 18:09:43 +01:00
Node.cpp LibWeb: Simplify Layout::Node::containing_block() 2022-03-18 15:18:48 +01:00
Node.h Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
Progress.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
Progress.h LibWeb: Make Paintable ref-counted 2022-03-11 00:21:49 +01:00
RadioButton.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
RadioButton.h LibWeb: Refactor all LabelableNode subclasses + input event handling :^) 2022-03-16 00:38:31 +01:00
ReplacedBox.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
ReplacedBox.h LibWeb: Add some fast_is<T> helpers for hot classes on GitHub :^) 2022-03-13 18:09:43 +01:00
SVGBox.cpp LibWeb: Make Layout::SVGBox a BlockContainer again 2022-03-13 00:04:51 +01:00
SVGBox.h LibWeb: Make Layout::SVGBox a BlockContainer again 2022-03-13 00:04:51 +01:00
SVGFormattingContext.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
SVGFormattingContext.h LibWeb: Start making our layout system "transactional" 2022-02-21 18:35:12 +01:00
SVGGeometryBox.cpp LibWeb: Remove a bunch of no-longer needed #includes 2022-03-11 00:21:49 +01:00
SVGGeometryBox.h LibWeb: Make Paintable ref-counted 2022-03-11 00:21:49 +01:00
SVGGraphicsBox.cpp LibWeb: Let Paintable perform the painting 2022-03-11 00:21:49 +01:00
SVGGraphicsBox.h LibWeb: Let Paintable perform the painting 2022-03-11 00:21:49 +01:00
SVGSVGBox.cpp LibWeb: Make Paintable ref-counted 2022-03-11 00:21:49 +01:00
SVGSVGBox.h LibWeb: Make Paintable ref-counted 2022-03-11 00:21:49 +01:00
TableBox.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
TableBox.h LibWeb: Rename Layout::BlockBox => BlockContainer 2021-10-06 20:10:36 +02:00
TableCellBox.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
TableCellBox.h LibWeb: Remove Layout::Box::width_of_logical_containing_block() 2021-10-27 18:00:51 +02:00
TableFormattingContext.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
TableFormattingContext.h LibWeb: Start making our layout system "transactional" 2022-02-21 18:35:12 +01:00
TableRowBox.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
TableRowBox.h LibWeb: Start work towards modern CSS "display" values 2021-10-06 19:12:52 +02:00
TableRowGroupBox.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
TableRowGroupBox.h LibWeb: Make display: foo box constructors take the Element by pointer 2022-02-25 19:35:34 +01:00
TextNode.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
TextNode.h LibWeb: Move text fragment painting to PaintableWithLines 2022-03-16 23:13:05 +01:00
TreeBuilder.cpp Libraries: Use default constructors/destructors in LibWeb 2022-03-17 17:23:49 +00:00
TreeBuilder.h LibWeb: Add missing headers 2021-10-20 09:20:18 +01:00