1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:58:11 +00:00
serenity/Userland/Libraries/LibWeb/Layout
Andreas Kling 5af02a914c LibWeb: Let parent formatting context determine size of flex containers
Until now, we had implemented flex container sizing by awkwardly doing
exactly what the spec said (basically having FFC size the container)
despite that not really making sense in the big picture. (Parent
formatting contexts should be responsible for sizing and placing their
children)

This patch moves us away from the Flexbox spec text a little bit, by
removing the logic for sizing the flex container in FFC, and instead
making sure that all formatting contexts can set both width and height
of flex container children.

This required changes in BFC and IFC, but it's actually quite simple!
Width was already not a problem, and it turns out height isn't either,
since the automatic height of a flex container is max-content.
With this in mind, we can simply determine the height of flex containers
before transferring control to FFC, and everything flows nicely.

With this change, we can remove all the virtuals and FFC logic for
negotiating container size with the parent formatting context.
We also don't need the "available space for flex container" stuff
anymore either, so that's gone as well.

There are some minor diffs in layout test results from this, but the
new results actually match other browsers more closely, so that's fine.

This should make flex layout, and indeed layout in general, easier to
understand, since this was the main weird special case outside of
BFC/IFC where a formatting context delegates work to its parent instead
of the other way around. :^)
2024-01-10 16:28:12 +01:00
..
AudioBox.cpp LibWeb: Begin implementing the HTMLAudioElement for audio playback 2023-06-13 06:14:01 +02:00
AudioBox.h LibWeb: Begin implementing the HTMLAudioElement for audio playback 2023-06-13 06:14:01 +02:00
AvailableSpace.cpp LibWeb: Port AvailableSpace from DeprecatedString to String 2023-11-28 17:15:27 -05:00
AvailableSpace.h LibWeb: Port AvailableSpace from DeprecatedString to String 2023-11-28 17:15:27 -05:00
BlockContainer.cpp LibWeb/Layout: Rename BlockContainer::paint{_box => able_with_lines}() 2023-04-20 20:43:30 +02:00
BlockContainer.h LibWeb/Layout: Rename BlockContainer::paint{_box => able_with_lines}() 2023-04-20 20:43:30 +02:00
BlockFormattingContext.cpp LibWeb: Let parent formatting context determine size of flex containers 2024-01-10 16:28:12 +01:00
BlockFormattingContext.h LibWeb: Let parent formatting context determine size of flex containers 2024-01-10 16:28:12 +01:00
Box.cpp LibWeb: Introduce RecordingPainter to serialize painting commands 2023-10-18 10:58:42 +02:00
Box.h LibWeb: Use CSSPixelFraction to represent aspect ratios 2023-09-04 12:40:17 +02:00
BoxModelMetrics.cpp
BoxModelMetrics.h LibWeb+Browser+WebContent: Convert BoxModelMetrics to new pixel units 2023-01-05 17:42:31 +01:00
BreakNode.cpp LibWeb: Remove Layout::Node::set_inline() 2022-10-06 15:29:38 +02:00
BreakNode.h LibWeb: Don't generate ::before/::after for BR elements 2023-09-14 21:46:28 +02:00
ButtonBox.cpp LibGfx+LibWeb: Produce font cascade list in CSS font matching algorithm 2023-12-10 17:32:04 +01:00
ButtonBox.h LibWeb: Make a handful of layout node leaf classes final 2023-01-11 14:03:18 +01:00
CanvasBox.cpp LibWeb: Introduce RecordingPainter to serialize painting commands 2023-10-18 10:58:42 +02:00
CanvasBox.h LibWeb: Make a handful of layout node leaf classes final 2023-01-11 14:03:18 +01:00
CheckBox.cpp LibWeb: Move "natural size" concept into Layout::Box 2023-06-09 20:37:51 +02:00
CheckBox.h LibWeb: Make a handful of layout node leaf classes final 2023-01-11 14:03:18 +01:00
FlexFormattingContext.cpp LibWeb: Let parent formatting context determine size of flex containers 2024-01-10 16:28:12 +01:00
FlexFormattingContext.h LibWeb: Let parent formatting context determine size of flex containers 2024-01-10 16:28:12 +01:00
FormAssociatedLabelableNode.h LibWeb: Make the layout tree GC-allocated 2022-10-20 15:16:23 +02:00
FormattingContext.cpp LibWeb: Return CSSPixels from calculate_inner_height() 2024-01-07 09:03:57 +01:00
FormattingContext.h LibWeb: Let parent formatting context determine size of flex containers 2024-01-10 16:28:12 +01:00
FrameBox.cpp Everywhere: Use to_number<T> instead of to_{int,uint,float,double} 2023-12-23 20:41:07 +01:00
FrameBox.h LibWeb: Fix iframes flickering on window resize 2023-05-15 14:08:08 +02:00
GridFormattingContext.cpp LibWeb: Add support for implicit grid lines formed by grid areas in GFC 2024-01-08 09:28:37 +01:00
GridFormattingContext.h LibWeb: Support auto-fill for rows in GFC 2024-01-07 11:12:35 +01:00
ImageBox.cpp LibWeb: Add CSSPixels::nearest_value_for(FloatingPoint) 2023-08-26 23:53:45 +02:00
ImageBox.h LibWeb: Don't force HTMLImageElement to have a legacy ImageLoader 2023-05-13 09:08:42 +02:00
ImageProvider.h LibGfx+LibWeb: Add ImmutableBitmap for images bitmap caching in painter 2023-11-26 12:55:43 +01:00
InlineFormattingContext.cpp LibWeb: Let parent formatting context determine size of flex containers 2024-01-10 16:28:12 +01:00
InlineFormattingContext.h LibWeb: Let parent formatting context determine size of flex containers 2024-01-10 16:28:12 +01:00
InlineLevelIterator.cpp LibGfx+LibWeb: Update for_each_glyph_position to use font cascade list 2023-12-10 17:32:04 +01:00
InlineLevelIterator.h LibGfx+LibWeb: Calculate and save glyph positions during layout 2023-12-02 22:06:11 +01:00
InlineNode.cpp LibWeb: Make the paint tree GC-allocated 2023-01-11 12:55:00 +01:00
InlineNode.h LibWeb: Make a handful of layout node leaf classes final 2023-01-11 14:03:18 +01:00
Label.cpp AK+Everywhere: Remove the null state of DeprecatedString 2023-10-13 18:33:21 +03:30
Label.h LibWeb+WebContent+headless-browser: Use CSSPixels for PageClient events 2022-12-10 12:03:19 +00:00
LabelableNode.cpp
LabelableNode.h LibWeb: Make the layout tree GC-allocated 2022-10-20 15:16:23 +02:00
LayoutState.cpp LibWeb: Take padding into account when resolving border radii 2024-01-07 19:28:38 +01:00
LayoutState.h LibWeb: Resolve box shadow data for paintable boxes during layout 2023-12-19 21:08:51 +01:00
LineBox.cpp LibGfx+LibWeb: Produce font cascade list in CSS font matching algorithm 2023-12-10 17:32:04 +01:00
LineBox.h LibGfx+LibWeb: Calculate and save glyph positions during layout 2023-12-02 22:06:11 +01:00
LineBoxFragment.cpp LibGfx+LibWeb: Produce font cascade list in CSS font matching algorithm 2023-12-10 17:32:04 +01:00
LineBoxFragment.h LibWeb: Paint fragments contained by inline node as part of this node 2024-01-05 19:36:55 +01:00
LineBuilder.cpp LibGfx+LibWeb: Produce font cascade list in CSS font matching algorithm 2023-12-10 17:32:04 +01:00
LineBuilder.h LibGfx+LibWeb: Calculate and save glyph positions during layout 2023-12-02 22:06:11 +01:00
ListItemBox.cpp LibWeb: Make the layout tree GC-allocated 2022-10-20 15:16:23 +02:00
ListItemBox.h LibWeb: Add fast_is<T>() for various types stood out in a profile 2023-03-11 10:46:26 +01:00
ListItemMarkerBox.cpp Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
ListItemMarkerBox.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Node.cpp LibWeb: Improve style propagation to anonymous wrappers 2024-01-07 14:24:38 +01:00
Node.h LibWeb: Improve style propagation to anonymous wrappers 2024-01-07 14:24:38 +01:00
RadioButton.cpp LibWeb: Move "natural size" concept into Layout::Box 2023-06-09 20:37:51 +02:00
RadioButton.h LibWeb: Make the paint tree GC-allocated 2023-01-11 12:55:00 +01:00
ReplacedBox.cpp LibWeb: Remove Layout::Node::set_inline() 2022-10-06 15:29:38 +02:00
ReplacedBox.h LibWeb: Move "natural size" concept into Layout::Box 2023-06-09 20:37:51 +02:00
SVGBox.cpp
SVGBox.h LibWeb: Make the layout tree GC-allocated 2022-10-20 15:16:23 +02:00
SVGFormattingContext.cpp LibWeb: Add initial support for SVG <textPath> 2023-12-19 21:29:03 +01:00
SVGFormattingContext.h LibWeb: Let FormattingContext decide the automatic width of its root 2023-03-20 17:57:58 +01:00
SVGGeometryBox.cpp LibWeb: Support transforms, stroking, gradients, etc for SVG <text> 2023-11-05 02:46:46 +01:00
SVGGeometryBox.h LibWeb: Store computed SVG path data/transforms in LayoutState 2023-10-30 19:44:54 +01:00
SVGGraphicsBox.cpp LibWeb: Make SVG <g> elements generate a SVGGraphicsPaintable 2023-04-19 07:52:26 +02:00
SVGGraphicsBox.h LibWeb: Make SVG <g> elements generate a SVGGraphicsPaintable 2023-04-19 07:52:26 +02:00
SVGSVGBox.cpp LibWeb: Use CSSPixelFraction to represent aspect ratios 2023-09-04 12:40:17 +02:00
SVGSVGBox.h LibWeb: Use CSSPixelFraction to represent aspect ratios 2023-09-04 12:40:17 +02:00
SVGTextBox.cpp LibWeb: Support transforms, stroking, gradients, etc for SVG <text> 2023-11-05 02:46:46 +01:00
SVGTextBox.h LibWeb: Layout SVG <text> elements during layout (not while painting) 2023-10-30 19:44:54 +01:00
SVGTextPathBox.cpp LibWeb: Add initial support for SVG <textPath> 2023-12-19 21:29:03 +01:00
SVGTextPathBox.h LibWeb: Add initial support for SVG <textPath> 2023-12-19 21:29:03 +01:00
TableFormattingContext.cpp Everywhere: Use to_number<T> instead of to_{int,uint,float,double} 2023-12-23 20:41:07 +01:00
TableFormattingContext.h LibWeb: Implement table missing cells fixup 2023-08-20 18:38:15 +02:00
TableGrid.cpp LibWeb: Consider colgroups while calculating table grid size 2023-11-04 17:37:38 +01:00
TableGrid.h AK: Rename GenericTraits to DefaultTraits 2023-11-09 10:05:51 -05:00
TableWrapper.cpp LibWeb: Override width calculation for table wrappers 2023-01-14 19:22:08 +01:00
TableWrapper.h LibWeb: Override width calculation for table wrappers 2023-01-14 19:22:08 +01:00
TextNode.cpp LibWeb: Port Layout::TextNode from DeprecatedString 2023-11-28 17:15:27 -05:00
TextNode.h LibWeb: Port Layout::TextNode from DeprecatedString 2023-11-28 17:15:27 -05:00
TreeBuilder.cpp LibWeb: Ignore "display: contents" boxes while inserting inline nodes 2023-12-23 20:52:42 +01:00
TreeBuilder.h LibWeb: Wrap PseudoElements stored in SimpleSelector in a class 2023-12-11 16:54:59 +01:00
VideoBox.cpp LibWeb: Use CSSPixelFraction to represent aspect ratios 2023-09-04 12:40:17 +02:00
VideoBox.h LibWeb: Move viewport subscriptions from BrowsingContext to Document 2023-08-23 20:14:20 +02:00
Viewport.cpp LibWeb: Move painting logic from Layout::Viewport to ViewportPaintable 2023-08-20 05:02:59 +02:00
Viewport.h LibWeb: Move painting logic from Layout::Viewport to ViewportPaintable 2023-08-20 05:02:59 +02:00