mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
LibWeb: Move line boxes from Layout::Box to BlockContainer
Per the spec, only a BlockContainer" can have line boxes, so let's not clutter up every Layout::Box with line boxes. This also allows us to establish an invariant that BFC and IFC always operate on a Layout::BlockContainer. Note that if BlockContainer has all block-level children, its line boxes are not used for anything. They are only used in the all inline-level children scenario.
This commit is contained in:
parent
a0bea52a5f
commit
f73aa8e2bd
13 changed files with 80 additions and 74 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <AK/Vector.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/Layout/BlockContainer.h>
|
||||
#include <LibWeb/Layout/FormattingContext.h>
|
||||
|
||||
namespace Web::Layout {
|
||||
|
@ -15,7 +16,7 @@ namespace Web::Layout {
|
|||
// https://drafts.csswg.org/css-display/#block-formatting-context
|
||||
class BlockFormattingContext : public FormattingContext {
|
||||
public:
|
||||
explicit BlockFormattingContext(Box&, FormattingContext* parent);
|
||||
explicit BlockFormattingContext(BlockContainer&, FormattingContext* parent);
|
||||
~BlockFormattingContext();
|
||||
|
||||
virtual void run(Box&, LayoutMode) override;
|
||||
|
@ -25,12 +26,12 @@ public:
|
|||
const Vector<Box*>& left_floating_boxes() const { return m_left_floating_boxes; }
|
||||
const Vector<Box*>& right_floating_boxes() const { return m_right_floating_boxes; }
|
||||
|
||||
static float compute_theoretical_height(const Box&);
|
||||
static float compute_theoretical_height(Box const&);
|
||||
void compute_width(Box&);
|
||||
|
||||
// https://drafts.csswg.org/css-display/#block-formatting-context-root
|
||||
Box& root() { return context_box(); }
|
||||
Box const& root() const { return context_box(); }
|
||||
BlockContainer& root() { return static_cast<BlockContainer&>(context_box()); }
|
||||
BlockContainer const& root() const { return static_cast<BlockContainer const&>(context_box()); }
|
||||
|
||||
protected:
|
||||
static void compute_height(Box&);
|
||||
|
@ -45,13 +46,13 @@ private:
|
|||
|
||||
void layout_initial_containing_block(LayoutMode);
|
||||
|
||||
void layout_block_level_children(Box&, LayoutMode);
|
||||
void layout_inline_children(Box&, LayoutMode);
|
||||
void layout_block_level_children(BlockContainer&, LayoutMode);
|
||||
void layout_inline_children(BlockContainer&, LayoutMode);
|
||||
|
||||
void place_block_level_replaced_element_in_normal_flow(Box& child, Box& container);
|
||||
void place_block_level_non_replaced_element_in_normal_flow(Box& child, Box& container);
|
||||
void place_block_level_replaced_element_in_normal_flow(Box& child, BlockContainer const&);
|
||||
void place_block_level_non_replaced_element_in_normal_flow(Box& child, BlockContainer const&);
|
||||
|
||||
void layout_floating_child(Box&, Box& containing_block);
|
||||
void layout_floating_child(Box& child, BlockContainer const& containing_block);
|
||||
|
||||
void apply_transformations_to_children(Box&);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue