mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 18:00:16 +00:00
LibWeb: Resolve SVGImageElement
source URL correctly
This fixes an issue where an SVGImageElement, whose source was a relative URL would not load inside an iframe.
This commit is contained in:
parent
b7512deada
commit
400aefb784
Notes:
github-actions[bot]
2025-01-19 14:03:31 +00:00
Author: https://github.com/tcl3
Commit: 400aefb784
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3304
3 changed files with 13 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, Tim Ledbetter <tim.ledbetter@ladybird.org>
|
* Copyright (c) 2024-2025, Tim Ledbetter <tim.ledbetter@ladybird.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -140,7 +140,13 @@ Gfx::Rect<CSSPixels> SVGImageElement::bounding_box() const
|
||||||
// https://www.w3.org/TR/SVG2/linking.html#processingURL
|
// https://www.w3.org/TR/SVG2/linking.html#processingURL
|
||||||
void SVGImageElement::process_the_url(Optional<String> const& href)
|
void SVGImageElement::process_the_url(Optional<String> const& href)
|
||||||
{
|
{
|
||||||
m_href = document().url().complete_url(href.value_or(String {}));
|
if (!href.has_value()) {
|
||||||
|
m_href = {};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_href = document().parse_url(*href);
|
||||||
|
|
||||||
if (!m_href.is_valid())
|
if (!m_href.is_valid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
2
Tests/LibWeb/Ref/expected/svg-image-in-iframe-ref.html
Normal file
2
Tests/LibWeb/Ref/expected/svg-image-in-iframe-ref.html
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<iframe srcdoc="<svg xmlns='http://www.w3.org/2000/svg'><rect width='150' height='100' fill='green' /></svg>"></iframe>
|
3
Tests/LibWeb/Ref/input/svg-image-in-iframe.html
Normal file
3
Tests/LibWeb/Ref/input/svg-image-in-iframe.html
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<link rel="match" href="../expected/svg-image-in-iframe-ref.html" />
|
||||||
|
<iframe srcdoc="<svg xmlns='http://www.w3.org/2000/svg'><image href='../data/rectangle.png' width='150' height='100' /></svg>"></iframe>
|
Loading…
Add table
Add a link
Reference in a new issue