[Webkit-unassigned] [Bug 142673] [GTK] Automatically adjust font size when gtk-xft-dpi changes

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 14 03:05:01 PST 2017


https://bugs.webkit.org/show_bug.cgi?id=142673

--- Comment #60 from Carlos Garcia Campos <cgarcia at igalia.com> ---
(In reply to Gabriel Ivașcu from comment #59)
> (In reply to Carlos Garcia Campos from comment #58)
> > > Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp:164
> > > +    WebCore::setScreenDPIObserverHandler(nullptr);
> > 
> > This doesn't work, because there can be multiple instances of
> > WebKitSettings, it's the way we make web view groups, by sharing
> > WebKitSettings objects. In this case, once one instance is deleted, all
> > others will stop receiving notifications. We should either change
> > PlatformScreen to receive a pair of Function, context and keep a map, or use
> > a single handler here but notify all WebKitSetting instances. The former
> > should be easier.
> 
> What do you mean by context? The WebKitSettings object itself?

Yes, in this case is the WebKitSettings object itself, but from the WebCore point of view it's void*.

> > > Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp:190
> > > +        auto prevFontSize = settings->priv->preferences->defaultFontSize();
> > > +        auto prevMonospaceFontSize = settings->priv->preferences->defaultFixedFontSize();
> > > +
> > > +        settings->priv->preferences->setDefaultFontSize(std::round(prevFontSize * scalingFactor));
> > > +        g_object_notify(G_OBJECT(settings), "default-font-size");
> > > +
> > > +        settings->priv->preferences->setDefaultFixedFontSize(std::round(prevMonospaceFontSize * scalingFactor));
> > > +        g_object_notify(G_OBJECT(settings), "default-monospace-font-size");
> > 
> > This is already done by webkit_settings_set_default_font_size() and
> > webkit_settings_set_default_monospace_font_size(), so I would use those
> > instead. I would also use g_object_freeze_notify()/thaw_notify().
> 
> Why would we need to freeze/thaw the notify signals if we're going to
> replace the manual set and notify with the setter function? Do we want to
> emit the signals only after both font sizes were set?

We don't need it, but it's desirable when we know that notify could be called multiple times in a row.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20171114/beb2a5de/attachment-0001.html>


More information about the webkit-unassigned mailing list