Bug 235706

Summary: [GTK] Support accent colors
Product: WebKit Reporter: Alice Mikhaylenko <alicem>
Component: WebKitGTKAssignee: Alice Mikhaylenko <alicem>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, benjamin, berto, bugs-noreply, cdumez, cgarcia, changseok, cmarcelo, esprehn+autocc, ews-watchlist, glenn, gustavo, gyuyoung.kim, kondapallykalyan, mcatanzaro, pdr, ryuan.choi, sergio
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Alice Mikhaylenko 2022-01-27 04:37:32 PST
See the patch. Had it lying around for a while, probably forgot to submit.

Untested on WPE, let's see what EWS says. There is logic to fall back to the previous blue if no accent was set, but I don't know if it builds.
Comment 1 Alice Mikhaylenko 2022-01-27 04:39:04 PST
Created attachment 450127 [details]
Patch
Comment 2 EWS Watchlist 2022-01-27 04:41:31 PST
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See https://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 3 Michael Catanzaro 2022-01-27 07:05:01 PST
Comment on attachment 450127 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=450127&action=review

> Source/WebCore/ChangeLog:9
> +        here. Remove the last bits of ThemeGtk and foreign drawing on GTK3.

You haven't really removed the last bits, since we still draw GTK-style scrollbars.

> Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp:1847
> +#if USE(GTK4)
> +static void webkitWebViewBaseCssChanged(GtkWidget* widget, GtkCssStyleChange* change)
> +#else
> +static void webkitWebViewBaseStyleUpdated(GtkWidget* widget)
> +#endif
> +{
> +#if USE(GTK4)
> +    GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->css_changed(widget, change);
> +#else
> +    GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->style_updated(widget);
> +#endif
> +
> +    WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget);
> +    WebKitWebViewBasePrivate* priv = webViewBase->priv;
> +    priv->pageProxy->accentColorDidChange();
> +}

Style nit: it's more readable to duplicate this short function for GTK 4 vs. GTK 3 than to have all the #ifs inside of it.
Comment 4 Alice Mikhaylenko 2022-01-27 08:09:04 PST
Created attachment 450138 [details]
Patch
Comment 5 EWS 2022-01-27 10:18:20 PST
Committed r288679 (246485@main): <https://commits.webkit.org/246485@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 450138 [details].