mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:37:36 +00:00
LibWeb: Some improvements to absolute positioning
Absolutely positioned blocks now register themselves with their containing block (and note that the containing block of an absolutely positioned box is the nearest non-statically positioned block ancestor or the ICB as fallback.) Containing blocks then drive the layout of their tracked absolutely positioned descendants as a separate layout pass. This is very far from perfect but the general direction seems good.
This commit is contained in:
parent
ff2c949d70
commit
260427f0ad
8 changed files with 166 additions and 24 deletions
|
@ -65,10 +65,14 @@ public:
|
|||
|
||||
virtual void split_into_lines(LayoutBlock& container, LayoutMode) override;
|
||||
|
||||
void add_absolutely_positioned_descendant(LayoutBox&);
|
||||
size_t absolutely_positioned_descendant_count() const { return m_absolutely_positioned_descendants.size(); }
|
||||
|
||||
protected:
|
||||
void compute_width();
|
||||
void compute_position();
|
||||
void compute_height();
|
||||
void layout_absolute_descendants();
|
||||
|
||||
private:
|
||||
virtual bool is_block() const override { return true; }
|
||||
|
@ -80,6 +84,7 @@ private:
|
|||
void layout_block_children(LayoutMode);
|
||||
|
||||
Vector<LineBox> m_line_boxes;
|
||||
HashTable<RefPtr<LayoutBox>> m_absolutely_positioned_descendants;
|
||||
};
|
||||
|
||||
template<typename Callback>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue