Bug 301089

Summary: [GTK][WPE] Add WebKitImage utility class to the public API
Product: WebKit Reporter: Adrian Perez <aperez>
Component: WebKitGTKAssignee: Simon Pena <spena>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply, jmurphy, mcatanzaro
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 301086    

Adrian Perez
Reported 2025-10-20 05:35:34 PDT
The goal is to use it as representation of site icons (favicons) and WebExtension icons. Here's the list of requirements, extracted from bug #301086: - It least it needs to allow querying width, height, stride, and provide a method to obtain a GBytes wrapping a buffer with 32bpp RGBA/BGRA pixels. - Implementing the GIcon and GLoadableIcon interfaces would be desirable. - For the GTK port, it may have a method to obtain a GdkTexture out of it, for the sake of convenience (optional?). - Provide a nullable “url” property which may be filled with the URL from which the image was loaded (doubtful: would it better belong in a WebKitFavicon subclass?)
Attachments
Jamie Murphy
Comment 1 2025-10-20 08:36:37 PDT
One thing I'd like to see if possible would be the ability to scale an image, as the WebExtensions code does have the capability of resizing an image to fit a better screen size. Implementing GIcon would be desirable, yes, and WebExtensions already uses GIcon so this makes it easier on the API side to port. I don't think the "url" property would be super useful for the overall class, it should be added to a sublcass. While extensions do have a concept of a URL that the image could be loaded from, it doesn't really make sense to expose that unless the extension itself wants to.
Michael Catanzaro
Comment 2 2025-10-20 09:05:08 PDT
Subclasses are complex, though. If it's really useful to have subclasses, then OK. But otherwise we should avoid it.
Jamie Murphy
Comment 3 2025-10-20 09:08:13 PDT
I don't think the property is useful for WebExtensions usage, but if it's more difficult to use a subclass, we could include it and just document that it's not used with WebExtensions
Simon Pena
Comment 4 2025-10-21 14:55:33 PDT
Adrian Perez
Comment 5 2025-11-05 13:46:57 PST
EWS
Comment 6 2025-11-07 05:35:36 PST
Committed 302720@main (f53dba1d3a1d): <https://commits.webkit.org/302720@main> Reviewed commits have been landed. Closing PR #52767 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.