mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 18:02:20 +00:00
LibWeb/SVG: Prefer href
to xlink:href
attribute on images
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This commit is contained in:
parent
93a35895ae
commit
4dd538e708
Notes:
github-actions[bot]
2025-07-12 11:14:56 +00:00
Author: https://github.com/tcl3
Commit: 4dd538e708
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5406
Reviewed-by: https://github.com/gmta ✅
5 changed files with 31 additions and 1 deletions
|
@ -14,6 +14,7 @@
|
|||
#include <LibWeb/HTML/PotentialCORSRequest.h>
|
||||
#include <LibWeb/HTML/SharedResourceRequest.h>
|
||||
#include <LibWeb/Layout/SVGImageBox.h>
|
||||
#include <LibWeb/Namespace.h>
|
||||
#include <LibWeb/Painting/Paintable.h>
|
||||
#include <LibWeb/SVG/SVGDecodedImageData.h>
|
||||
|
||||
|
@ -60,7 +61,19 @@ void SVGImageElement::attribute_changed(FlyString const& name, Optional<String>
|
|||
auto parsed_value = AttributeParser::parse_coordinate(value.value_or(String {}));
|
||||
MUST(height()->base_val()->set_value(parsed_value.value_or(0)));
|
||||
} else if (name == SVG::AttributeNames::href) {
|
||||
process_the_url(value);
|
||||
// https://svgwg.org/svg2-draft/linking.html#XLinkRefAttrs
|
||||
// For backwards compatibility, elements with an ‘href’ attribute also recognize an ‘href’ attribute in the
|
||||
// XLink namespace. If the element is in the XLink namespace, it does not recognize an ‘href’ attribute in the
|
||||
// SVG namespace. When the ‘href’ attribute is present in both the XLink namespace and without a namespace, the
|
||||
// value of the attribute without a namespace shall be used. The attribute in the XLink namespace shall be ignored.
|
||||
if (namespace_ == Namespace::XLink && has_attribute_ns({}, name))
|
||||
return;
|
||||
|
||||
auto href = value;
|
||||
if (!namespace_.has_value() && !href.has_value())
|
||||
href = get_attribute_ns(SVG::AttributeNames::href, Namespace::XLink);
|
||||
|
||||
process_the_url(href);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue