LibWeb: Ensure image context menu uses the correct image source

Previously, the value of the `src` tag would always be used as the
image source URL when requesting an image context menu, which may not
be correct if an image uses a `srcset` or has a parent picture tag.
This commit is contained in:
Tim Ledbetter 2025-08-03 16:03:16 +01:00 committed by Jelle Raaijmakers
commit 4a1740f299
Notes: github-actions[bot] 2025-08-03 15:34:20 +00:00

View file

@ -547,7 +547,7 @@ EventResult EventHandler::handle_mouseup(CSSPixelPoint viewport_position, CSSPix
} else if (button == UIEvents::MouseButton::Secondary) {
if (is<HTML::HTMLImageElement>(*node)) {
auto& image_element = as<HTML::HTMLImageElement>(*node);
auto image_url = image_element.document().encoding_parse_url(image_element.src());
auto image_url = image_element.document().encoding_parse_url(image_element.current_src());
if (image_url.has_value()) {
Optional<Gfx::Bitmap const*> bitmap;
if (image_element.immutable_bitmap())