mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 10:09:14 +00:00
LibWeb: Support inserting non-inline elements into inline elements
Our layout tree requires that all containers either have inline or non-inline children. In order to support the layout of non-inline elements inside inline elements, we need to do a bit of tree restructuring. It effectively simulates temporarily closing all inline nodes, appending the block element, and resumes appending to the last open inline node. The acid1.txt expectation needed to be updated to reflect the fact that we now hoist its <p> elements out of the inline <form> they were in. Visually, the before and after situations for acid1.html are identical.
This commit is contained in:
parent
7eb4f3da37
commit
336684bc5c
Notes:
github-actions[bot]
2025-01-23 08:34:24 +00:00
Author: https://github.com/gmta
Commit: 336684bc5c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3276
Reviewed-by: https://github.com/kalenikaliaksandr ✅
18 changed files with 520 additions and 145 deletions
|
@ -230,7 +230,7 @@ public:
|
|||
CSS::ImmutableComputedValues const& computed_values() const { return static_cast<CSS::ImmutableComputedValues const&>(*m_computed_values); }
|
||||
CSS::MutableComputedValues& mutable_computed_values() { return static_cast<CSS::MutableComputedValues&>(*m_computed_values); }
|
||||
|
||||
void apply_style(const CSS::ComputedProperties&);
|
||||
void apply_style(CSS::ComputedProperties const&);
|
||||
|
||||
Gfx::Font const& first_available_font() const;
|
||||
Vector<CSS::BackgroundLayerData> const& background_layers() const { return computed_values().background_layers(); }
|
||||
|
@ -266,6 +266,13 @@ public:
|
|||
BoxModelMetrics& box_model() { return m_box_model; }
|
||||
BoxModelMetrics const& box_model() const { return m_box_model; }
|
||||
|
||||
GC::Ptr<NodeWithStyleAndBoxModelMetrics> continuation_of_node() const { return m_continuation_of_node; }
|
||||
void set_continuation_of_node(Badge<TreeBuilder>, GC::Ptr<NodeWithStyleAndBoxModelMetrics> node) { m_continuation_of_node = node; }
|
||||
|
||||
void propagate_style_along_continuation(CSS::ComputedProperties const&) const;
|
||||
|
||||
virtual void visit_edges(Cell::Visitor& visitor) override;
|
||||
|
||||
protected:
|
||||
NodeWithStyleAndBoxModelMetrics(DOM::Document& document, DOM::Node* node, GC::Ref<CSS::ComputedProperties> style)
|
||||
: NodeWithStyle(document, node, style)
|
||||
|
@ -281,6 +288,7 @@ private:
|
|||
virtual bool is_node_with_style_and_box_model_metrics() const final { return true; }
|
||||
|
||||
BoxModelMetrics m_box_model;
|
||||
GC::Ptr<NodeWithStyleAndBoxModelMetrics> m_continuation_of_node;
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue