[webkit-reviews] review granted: [Bug 142673] [GTK] Automatically adjust font size when gtk-xft-dpi changes : [Attachment 326881] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 14 23:52:57 PST 2017


Carlos Garcia Campos <cgarcia at igalia.com> has granted Gabriel Ivașcu
<givascu at igalia.com>'s request for review:
Bug 142673: [GTK] Automatically adjust font size when gtk-xft-dpi changes
https://bugs.webkit.org/show_bug.cgi?id=142673

Attachment 326881: Patch

https://bugs.webkit.org/attachment.cgi?id=326881&action=review




--- Comment #63 from Carlos Garcia Campos <cgarcia at igalia.com> ---
Comment on attachment 326881
  --> https://bugs.webkit.org/attachment.cgi?id=326881
Patch

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

> Source/WebCore/platform/gtk/PlatformScreenGtk.cpp:43
> -#include <wtf/Optional.h>
> +#include <unordered_map>

Use HashMap from WTF, please.

> Source/WebCore/platform/gtk/PlatformScreenGtk.cpp:116
> -static std::optional<Function<void()>> screenDPIObserverHandler;
> +static std::unordered_map<void*, Function<void()>>
m_screenDPIObserverHandlersMap;

For global maps we normally use a function with a NeverDestroyed map that
returns a reference of the map.

> Source/WebCore/platform/gtk/PlatformScreenGtk.cpp:128
>  

Instead of null-checking gtkSettings everywhere  we can just return early since
it doesn't make sense to save the handler that we are not going to call ever.

> Source/WebCore/platform/gtk/PlatformScreenGtk.cpp:134
> +    if (m_screenDPIObserverHandlersMap.size() > 0) {

Do not compare to 0, use either size() or when using HashMap !isEmpty().


More information about the webkit-reviews mailing list