mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-23 16:40:03 +00:00
LibWeb: Do not stomp over content size of SVGs
When displaying SVGs inside a navigable directly, we want to display
them in the size specified by their width and height attributes instead
of stretching them to the viewport as layout normally would.
However, when doing so, we need to actually check that the SVG we are
laying out is indeed directly inside the navigable. Otherwise we just
blindly overwrite whatever content sizes have been calculated by layout
code for e.g. SVG elements inlined somewhere in an HTML document.
Due to the way this was written originally, the bug was not very
noticable. The code overwrote the content width/height with the computed
width/height, which was often still correct in the sense that those two
had the same value. However, content size may also be the result of
{min,max}-{width,height} constraints, which can make it differ from the
computed values.
This bug was likely a regression introduced in
f5e01192cc
.
This commit is contained in:
parent
b76f1fb011
commit
9d7689ecd8
Notes:
github-actions[bot]
2025-09-24 10:27:05 +00:00
Author: https://github.com/InvalidUsernameException
Commit: 9d7689ecd8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6258
Reviewed-by: https://github.com/AtkinsSJ ✅
3 changed files with 79 additions and 1 deletions
|
@ -179,7 +179,8 @@ void SVGFormattingContext::run(AvailableSpace const& available_space)
|
|||
|
||||
auto& svg_box_state = m_state.get_mutable(context_box());
|
||||
|
||||
if (!this->context_box().root().document().is_decoded_svg()) {
|
||||
auto const& document = context_box().document();
|
||||
if (document.document_element() == context_box().dom_node() && !document.is_decoded_svg()) {
|
||||
// Overwrite the content width/height with the styled node width/height (from <svg width height ...>)
|
||||
|
||||
// NOTE: If a height had not been provided by the svg element, it was set to the height of the container
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue