Bug 250835 - [WPE][GTK] Remove most webkit_web_view_new_with_*() constructors
Summary: [WPE][GTK] Remove most webkit_web_view_new_with_*() constructors
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords:
Depends on:
Blocks: GTK4
  Show dependency treegraph
 
Reported: 2023-01-19 06:28 PST by Michael Catanzaro
Modified: 2023-01-24 09:08 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2023-01-19 06:28:39 PST
Splitting this from bug #222366:

"""
I'm also considering to remove all (or most of) webkit_web_view_new_with constructors. With all the construct properties we currently have I think most people need to use g_object_new and pass properties. Maybe we can keep with_related_view and add optional parameters to new() for the properties that are expected to be passed (web context, network session and settings, for example)
"""

I agree.
Comment 1 Michael Catanzaro 2023-01-21 11:06:08 PST
Um, actually there is one downside to using optional parameters: it makes it difficult to add any new construct parameters in the future without dooming applications back to using g_object_new() directly again.

I have a slightly different proposal that uses variadic arguments instead and just passes them along to g_object_new_valist(), which gives us flexibility to add new construct properties in the future without having to give up on use of webkit_web_view_new(). The downside is using variadic arguments means it can't be introspectable, which previously would not matter since it's a new() function and those aren't used by language bindings anyway, but since we use gi-docgen now it means it can't appear in the API docs. Still, it's worth it IMO. Another downside is I couldn't find a way to make the WPE WebKitWebViewBackend a separate non-variadic parameter as I don't think there's any way to add it to the va_list that gets passed to g_object_new_valist(), so WPE port users have to not forget to pass that.
Comment 2 Michael Catanzaro 2023-01-21 12:55:31 PST
Pull request: https://github.com/WebKit/WebKit/pull/8926
Comment 3 Michael Catanzaro 2023-01-23 13:00:28 PST
(In reply to Michael Catanzaro from comment #1)
> I have a slightly different proposal that uses variadic arguments instead
> and just passes them along to g_object_new_valist(), which gives us
> flexibility to add new construct properties in the future without having to
> give up on use of webkit_web_view_new().

Carlos Garcia did not like this, so I will drop this part of the proposal.
Comment 4 EWS 2023-01-24 09:08:37 PST
Committed 259285@main (f2357aa30823): <https://commits.webkit.org/259285@main>

Reviewed commits have been landed. Closing PR #8926 and removing active labels.