-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
b7512de
commit 400aefb
Showing
3 changed files
with
13 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 2024, Tim Ledbetter <[email protected]> | ||
* Copyright (c) 2024-2025, Tim Ledbetter <[email protected]> | ||
* | ||
* 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 | ||
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()) | ||
return; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |