Since gtk 3.18 gtk_style_context_set_background has been deprecated[1]. gtk_render_background should be used instead. gtk_style_context_set_background is still used in "Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp". In a few minutes I'm going to attach a patch to this issue. [1] https://developer.gnome.org/gtk3/stable/GtkStyleContext.html#gtk-style-context-set-background
Created attachment 367416 [details] Patch
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment on attachment 367416 [details] Patch This looks correct to me. Could you test webkit_web_view_set_background_color(), please? Especially with transparent background.
I tried to launch it with the bg-color option, e.g. `/Tools/Scripts/webkit-flatpak --gtk --bg-color="rgba(200,10,10,0)"` I was not sure how to test it though. In the fraction of a second before the webpage was loaded I saw that the background was indeed transparent. Then I tried to increase the alpha value and I got a colored background.
Can you try with Tools/Scripts/run-minibrowser --gtk --bg-color=rgba(....) ? run-minibrowser should invoke the built MiniBrowser in the Flatpak environment.
Philippe, yes I'm able to open the MiniBrowser even with webkit-flatpak. What I meant when I said that I wasn't sure how to test my changes, is that the chosen background color is visible only for a few ms before the webpage gets loaded on top of it. And I was unable to find another place where I could see the chosen background color. For example a blank you tab is always white. Is that how it is supposed to be?
s/blank you tab/blank new tab
Comment on attachment 367416 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=367416&action=review > Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp:-387 > - gtk_style_context_set_background(gtk_widget_get_style_context(widget), window); > - Actually, I think this is no longer needed since we don't render backgrounds in the UI process. I think we can simply remove this without adding the render_background.
(In reply to Ludovico de Nittis from comment #4) > I tried to launch it with the bg-color option, e.g. > `/Tools/Scripts/webkit-flatpak --gtk --bg-color="rgba(200,10,10,0)"` > > I was not sure how to test it though. > In the fraction of a second before the webpage was loaded I saw that the > background was indeed transparent. > Then I tried to increase the alpha value and I got a colored background. You can use the MiniBrowser editor mode (-e) to try it out. You can also try with any page not setting a background color in the css, as simple as <html></html> for example. But you have to load MiniBrowser without arguments and then load the test page (for some reason I don't remember the background color is not set when MiniBrowser receives arguments).
Created attachment 367936 [details] Patch
Carlos I tested it again and you are right, the background is available even without the gtk_render_background. So I uploaded a new patch, this time that just removes gtk_style_context_set_background.
Comment on attachment 367936 [details] Patch Clearing flags on attachment: 367936 Committed r244500: <https://trac.webkit.org/changeset/244500>
All reviewed patches have been landed. Closing bug.