Bug 162326 - PlatformEvent::m_modifiers should be an OptionSet
Summary: PlatformEvent::m_modifiers should be an OptionSet
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Anders Carlsson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-09-20 16:52 PDT by Anders Carlsson
Modified: 2017-04-25 16:37 PDT (History)
9 users (show)

See Also:


Attachments
Patch (19.10 KB, patch)
2016-09-20 16:54 PDT, Anders Carlsson
no flags Details | Formatted Diff | Diff
Patch (27.97 KB, patch)
2016-09-22 13:27 PDT, Anders Carlsson
no flags Details | Formatted Diff | Diff
Patch (28.08 KB, patch)
2016-09-22 14:01 PDT, Anders Carlsson
dbates: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Carlsson 2016-09-20 16:52:15 PDT
PlatformEvent::m_modifiers should be an OptionSet
Comment 1 Anders Carlsson 2016-09-20 16:54:18 PDT
Created attachment 289410 [details]
Patch
Comment 2 Anders Carlsson 2016-09-22 13:27:11 PDT
Created attachment 289590 [details]
Patch
Comment 3 Anders Carlsson 2016-09-22 14:01:12 PDT
Created attachment 289593 [details]
Patch
Comment 4 Daniel Bates 2016-09-22 14:22:28 PDT
Comment on attachment 289593 [details]
Patch

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

> Source/WTF/wtf/OptionSet.h:116
> +    constexpr friend bool operator!=(OptionSet lhs, OptionSet rhs)
> +    {
> +        return lhs.m_storage != rhs.m_storage;
> +    }
> +

Although the implementation of this function is trivial, I suggest that we add a test for it to file Tools/TestWebKitAPI/Tests/WTF/OptionSet.cpp.

> Source/WTF/wtf/OptionSet.h:128
> +    constexpr friend OptionSet operator-(OptionSet lhs, OptionSet rhs)
> +    {
> +        return OptionSet::fromRaw(lhs.m_storage & ~rhs.m_storage);
> +    }
> +

Ditto.

> Source/WebCore/page/EventHandler.cpp:2974
> +    ASSERT(!(accessKeyModifiers().contains(PlatformEvent::Modifier::ShiftKey)));

The inner parentheses are not needed. I suggest that we remove them.

> Source/WebKit2/Shared/WebEventConversion.cpp:316
> +            m_modifiers |= PlatformEvent::Modifier::ShiftKey;

Can we remove PlatformEvent::?

> Source/WebKit2/Shared/WebEventConversion.cpp:318
> +            m_modifiers |= PlatformEvent::Modifier::CtrlKey;

Ditto.

> Source/WebKit2/Shared/WebEventConversion.cpp:320
> +            m_modifiers |= PlatformEvent::Modifier::AltKey;

Ditto.

> Source/WebKit2/Shared/WebEventConversion.cpp:322
> +            m_modifiers |= PlatformEvent::Modifier::MetaKey;

Ditto.
Comment 5 Anders Carlsson 2016-09-27 12:10:56 PDT
Committed r206450: <http://trac.webkit.org/changeset/206450>
Comment 6 Radar WebKit Bug Importer 2017-04-21 09:45:54 PDT
<rdar://problem/31759503>
Comment 7 Alex Christensen 2017-04-25 16:37:55 PDT
Comment on attachment 289593 [details]
Patch

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

> Source/WebKit2/Shared/WebEventConversion.cpp:-117
> -        m_modifierFlags = 0;
> -        if (webEvent.shiftKey())
> -            m_modifierFlags |= WebEvent::ShiftKey;
> -        if (webEvent.controlKey())
> -            m_modifierFlags |= WebEvent::ControlKey;
> -        if (webEvent.altKey())
> -            m_modifierFlags |= WebEvent::AltKey;
> -        if (webEvent.metaKey())
> -            m_modifierFlags |= WebEvent::MetaKey;

Removing this with no replacement was a regression fixed in https://bugs.webkit.org/show_bug.cgi?id=171297