[webkit-reviews] review granted: [Bug 210228] IPC serialization of enums should serialize std::underlying_type instead of uint64_t : [Attachment 395904] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 8 20:36:22 PDT 2020


Darin Adler <darin at apple.com> has granted Alex Christensen
<achristensen at apple.com>'s request for review:
Bug 210228: IPC serialization of enums should serialize std::underlying_type
instead of uint64_t
https://bugs.webkit.org/show_bug.cgi?id=210228

Attachment 395904: Patch

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




--- Comment #4 from Darin Adler <darin at apple.com> ---
Comment on attachment 395904
  --> https://bugs.webkit.org/attachment.cgi?id=395904
Patch

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

> Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp:135
> +	  
graphicsContext.setTextDrawingMode(TextDrawingModeFlags(TextDrawingMode::Fill)
| TextDrawingMode::Stroke);

I suggest initializer list syntax here: { TextDrawingMode::Fill,
TextDrawingMode::Stroke }.

> Source/WebCore/platform/graphics/cairo/CairoOperations.cpp:318
> +    if (!(textDrawingMode & TextDrawingMode::Fill) || shadow.type() ==
ShadowBlur::NoShadow)

I suggest using contains here.

> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:-1763
> -    switch (mode) {

Not new, but a strange omission that this function does nothing if neither Fill
or Stroke is set. Doesn’t set a mode at all. Not even kCGTextInvisible. Nor
assert.

> Source/WebCore/rendering/TextPaintStyle.cpp:188
> +	   newMode = newMode | TextDrawingMode::Letterpress;

I suggest add() here.

> Source/WebCore/rendering/TextPaintStyle.cpp:193
> +	   newMode = newMode | TextDrawingMode::Stroke;

Ditto.

> Source/WebKit/Platform/IPC/Decoder.h:108
> -    template<typename E>
> -    auto decode(E& e) -> std::enable_if_t<std::is_enum<E>::value, bool>
> +    template<typename E, typename =
std::enable_if_t<std::is_enum<E>::value>>
> +    bool decode(E& e)

Why this change?

> Source/WebKit/Platform/IPC/Decoder.h:120
> -    template<typename E, std::enable_if_t<std::is_enum<E>::value>* =
nullptr>
> +    template<typename E, typename =
std::enable_if_t<std::is_enum<E>::value>>

Why this change?

> Source/WebKit/Shared/cf/ArgumentCodersCF.cpp:576
> +    encoder << static_cast<UInt32>(encoding);

Why UInt32 instead of uint32_t?


More information about the webkit-reviews mailing list