1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:37:45 +00:00

LibWeb: Make FormattingContext::run() take available space as input

Instead of formatting contexts flailing around to figure out from the
"inside" how much space is available on the "outside", we should
provide the amount of available space in both axes as an input to run().

This basically means that when something creates a nested formatting
context, the parent context is responsible for telling the nested context
how much space is available for layout. This information is provided
immediately when invoking run().

Note that this commit doesn't pass accurate values in all cases yet.
This first step just makes it build, and passes available values in some
cases where getting them was trivial.
This commit is contained in:
Andreas Kling 2022-09-25 19:12:09 +02:00
parent 6b2ce2ccc3
commit f161e20e57
17 changed files with 163 additions and 41 deletions

View file

@ -8,6 +8,7 @@
#include <AK/OwnPtr.h>
#include <LibWeb/Forward.h>
#include <LibWeb/Layout/AvailableSpace.h>
#include <LibWeb/Layout/LayoutState.h>
namespace Web::Layout {
@ -24,7 +25,7 @@ public:
SVG,
};
virtual void run(Box const&, LayoutMode) = 0;
virtual void run(Box const&, LayoutMode, AvailableSpace const& available_width, AvailableSpace const& available_height) = 0;
// This function returns the automatic content height of the context's root box.
virtual float automatic_content_height() const = 0;
@ -64,7 +65,7 @@ public:
static float containing_block_width_for(Box const&, LayoutState const&);
static float containing_block_height_for(Box const&, LayoutState const&);
virtual void run_intrinsic_sizing(Box const&);
void run_intrinsic_sizing(Box const&);
float compute_box_y_position_with_respect_to_siblings(Box const&, LayoutState::UsedValues const&);