1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 18:20:43 +09:00

LibWeb: Move SVG mask/clip layout node creation under DOM::Element

This is a non-functional change, but makes it clearer other element
properties (like `display=none`) apply to these too.
This commit is contained in:
MacDue 2024-05-04 17:02:18 +01:00 committed by Andreas Kling
parent 033877f628
commit 561beb5e95
Notes: sideshowbarker 2024-07-16 23:13:25 +09:00

View file

@ -340,7 +340,18 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::Context&
display = style->display();
if (display.is_none())
return;
layout_node = element.create_layout_node(*style);
if (context.layout_svg_mask_or_clip_path) {
if (is<SVG::SVGMaskElement>(dom_node))
layout_node = document.heap().allocate_without_realm<Layout::SVGMaskBox>(document, static_cast<SVG::SVGMaskElement&>(dom_node), *style);
else if (is<SVG::SVGClipPathElement>(dom_node))
layout_node = document.heap().allocate_without_realm<Layout::SVGClipBox>(document, static_cast<SVG::SVGClipPathElement&>(dom_node), *style);
else
VERIFY_NOT_REACHED();
// Only layout direct uses of SVG masks/clipPaths.
context.layout_svg_mask_or_clip_path = false;
} else {
layout_node = element.create_layout_node(*style);
}
} else if (is<DOM::Document>(dom_node)) {
style = style_computer.create_document_style();
display = style->display();
@ -350,17 +361,6 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::Context&
display = CSS::Display(CSS::DisplayOutside::Inline, CSS::DisplayInside::Flow);
}
if (context.layout_svg_mask_or_clip_path) {
if (is<SVG::SVGMaskElement>(dom_node))
layout_node = document.heap().allocate_without_realm<Layout::SVGMaskBox>(document, static_cast<SVG::SVGMaskElement&>(dom_node), *style);
else if (is<SVG::SVGClipPathElement>(dom_node))
layout_node = document.heap().allocate_without_realm<Layout::SVGClipBox>(document, static_cast<SVG::SVGClipPathElement&>(dom_node), *style);
else
VERIFY_NOT_REACHED();
// Only layout direct uses of SVG masks/clipPaths.
context.layout_svg_mask_or_clip_path = false;
}
if (!layout_node)
return;