mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +00:00
LibWeb: Use foreignObject's own size as available space inside it
This ensures that percentages resolve against the foreignObject's size instead of the size of its containing block. This makes user profile pictures clip correctly in the "Friends" view of the Discord app.
This commit is contained in:
parent
c39edfab2d
commit
4e23882995
Notes:
github-actions[bot]
2025-07-12 12:12:54 +00:00
Author: https://github.com/awesomekling
Commit: 4e23882995
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5417
Reviewed-by: https://github.com/gmta ✅
2 changed files with 5 additions and 3 deletions
|
@ -279,7 +279,6 @@ void SVGFormattingContext::layout_svg_element(Box const& child)
|
|||
layout_nested_viewport(child);
|
||||
} else if (is<SVG::SVGForeignObjectElement>(child.dom_node()) && is<BlockContainer>(child)) {
|
||||
Layout::BlockFormattingContext bfc(m_state, m_layout_mode, static_cast<BlockContainer const&>(child), this);
|
||||
bfc.run(*m_available_space);
|
||||
auto& child_state = m_state.get_mutable(child);
|
||||
CSSPixelRect rect {
|
||||
{
|
||||
|
@ -295,6 +294,9 @@ void SVGFormattingContext::layout_svg_element(Box const& child)
|
|||
child_state.set_content_offset(transformed_rect.location());
|
||||
child_state.set_content_width(transformed_rect.width());
|
||||
child_state.set_content_height(transformed_rect.height());
|
||||
|
||||
bfc.run(AvailableSpace(AvailableSize::make_definite(child_state.content_width()), AvailableSize::make_definite(child_state.content_height())));
|
||||
|
||||
if (auto* mask_box = child.first_child_of_type<SVGMaskBox>())
|
||||
layout_mask_or_clip(*mask_box);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue