libservo: Add ContextMenuElementInformation to for the context menu API (#40607)

This new data structure allows passing more information when popping up
context menus. It's possible in the future that it will be adapted into
a more generic "hit test result" type API ala WebKit, but for now, this
is probably
enough.

Testing: This change includes new API test assertions.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson
2025-11-17 16:53:43 +01:00
committed by GitHub
parent eca996ada3
commit 5494995e01
8 changed files with 165 additions and 45 deletions

View File

@@ -1439,6 +1439,15 @@ impl HTMLImageElement {
self.current_request.borrow_mut().image = Some(Image::Raster(broken_image_icon));
self.upcast::<Node>().dirty(NodeDamage::Other);
}
/// Get the full URL of the current image of this `<img>` element, returning `None` if the URL
/// could not be joined with the `Document` URL.
pub(crate) fn full_image_url_for_user_interface(&self) -> Option<ServoUrl> {
self.owner_document()
.base_url()
.join(&self.CurrentSrc())
.ok()
}
}
#[derive(JSTraceable, MallocSizeOf)]