[webkit-reviews] review granted: [Bug 214210] Cleanup GameController framework button binding with some constants : [Attachment 404027] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jul 10 17:55:09 PDT 2020


Darin Adler <darin at apple.com> has granted Brady Eidson <beidson at apple.com>'s
request for review:
Bug 214210: Cleanup GameController framework button binding with some constants
https://bugs.webkit.org/show_bug.cgi?id=214210

Attachment 404027: Patch

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




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

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

> Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.mm:101
> +    m_buttonValues.resize(homeButton ?
(size_t)GamepadButtons::CenterClusterCenter + 1 :
(size_t)GamepadButtons::CenterClusterCenter);

Not thrilled with how this hard-codes which is the last gamepad button 40 lines
after the enum. Maybe two named constants right after the enum class would make
the relationship clearer? Something like this perhaps:

    static constexpr auto numGamepadButtonsWithoutHomeButton =
static_cast<size_t>(GamepadButtons::CenterClusterCenter) + 1;
    static constexpr auto numGamepadButtonsWithHomeButton =
static_cast<size_t>(GamepadButtons::CenterClusterCenter);


More information about the webkit-reviews mailing list