mirror of
https://github.com/RGBCube/serenity
synced 2025-10-29 05:12:33 +00:00
LibWeb: Allow <svg> to act as a containing block
This change makes overflow clipping work correctly for children of svg
element.
Fixes following example:
```html
<!doctype html><style>
body {
width: 300px;
height: 300px;
position: relative;
overflow: hidden;
border: 1px solid black;
}
svg {
position: absolute;
left: 50%;
top: 50%;
width: 100%;
height: 100%;
transform: translate(-50%, -50%);
}
</style>
<body>
<svg viewBox="0 0 100 100">
<g>
<rect x="0" y="0" width="100" height="100" fill="green"></rect>
</g>
</svg>
```
This commit is contained in:
parent
c8d7bcede6
commit
38edab09a0
1 changed files with 2 additions and 1 deletions
|
|
@ -90,7 +90,8 @@ static Box const* nearest_ancestor_capable_of_forming_a_containing_block(Node co
|
|||
for (auto const* ancestor = node.parent(); ancestor; ancestor = ancestor->parent()) {
|
||||
if (ancestor->is_block_container()
|
||||
|| ancestor->display().is_flex_inside()
|
||||
|| ancestor->display().is_grid_inside()) {
|
||||
|| ancestor->display().is_grid_inside()
|
||||
|| ancestor->is_svg_svg_box()) {
|
||||
return verify_cast<Box>(ancestor);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue