mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
LibWeb: Allow <svg> layout boxes to have children
We can't say that "no replaced boxes can have children", since that breaks SVG. Instead, let each LayoutNode decide whether it's allowed to have children. Fixes #4223.
This commit is contained in:
parent
1ecea2f105
commit
e424e4749f
Notes:
sideshowbarker
2024-07-19 01:12:00 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/e424e4749fb
4 changed files with 7 additions and 5 deletions
|
@ -103,6 +103,8 @@ public:
|
|||
virtual bool is_list_item() const { return false; }
|
||||
bool has_style() const { return m_has_style; }
|
||||
|
||||
virtual bool can_have_children() const { return true; }
|
||||
|
||||
bool is_inline() const { return m_inline; }
|
||||
void set_inline(bool b) { m_inline = b; }
|
||||
|
||||
|
|
|
@ -62,6 +62,8 @@ public:
|
|||
|
||||
virtual void prepare_for_replaced_layout() { }
|
||||
|
||||
virtual bool can_have_children() const override { return false; }
|
||||
|
||||
protected:
|
||||
virtual void split_into_lines(Layout::BlockBox& container, LayoutMode) override;
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ public:
|
|||
virtual void before_children_paint(PaintContext& context, PaintPhase phase) override;
|
||||
virtual void after_children_paint(PaintContext& context, PaintPhase phase) override;
|
||||
|
||||
virtual bool can_have_children() const override { return true; }
|
||||
|
||||
private:
|
||||
const char* class_name() const override { return "SVGSVGBox"; }
|
||||
};
|
||||
|
|
|
@ -129,11 +129,7 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node)
|
|||
}
|
||||
}
|
||||
|
||||
// Ignore fallback content inside replaced elements.
|
||||
if (layout_node->is_replaced())
|
||||
return;
|
||||
|
||||
if (dom_node.has_children()) {
|
||||
if (dom_node.has_children() && layout_node->can_have_children()) {
|
||||
push_parent(*layout_node);
|
||||
downcast<DOM::ParentNode>(dom_node).for_each_child([&](auto& dom_child) {
|
||||
create_layout_tree(dom_child);
|
||||
|
|
Loading…
Add table
Reference in a new issue