Bug 213086 - DragState::type should be Optional<DragSourceAction> instead of OptionSet<DragSourceAction>
Summary: DragState::type should be Optional<DragSourceAction> instead of OptionSet<Dra...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 212885
Blocks:
  Show dependency treegraph
 
Reported: 2020-06-11 11:20 PDT by David Kilzer (:ddkilzer)
Modified: 2024-03-01 17:22 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2020-06-11 11:20:50 PDT
Per Darin's feedback in Bug 212885 Comment #12, DragState::type should be Optional<DragSourceAction> instead of OptionSet<DragSourceAction>.

'''
Refactoring this to be explicitly "OptionSet" when before it was not explicit is making the confusion worse, so I think we need to straighten this out first.

I guess there is some code can set the type to more than one thing. But this seems disorganized and messy. I think it’s not really a general set. It’s just one type plus possibly "selection". Seems really messy. I suppose you aren’t making it worse, but all this "hasExactlyOneBitSet" stuff is just what happens when we make the data structure too confusing. Clearly the "selection" is an independent flag, and need not be included in an option set.
'''
Comment 1 David Kilzer (:ddkilzer) 2020-06-11 11:37:02 PDT
Note that when DragState::type is changed from OptionSet<> to Optional<>, then WTF::Optional<>::hasExactlyOneBitSet() and WTF::Optional<>::toSingleValue() may also be removed.

The need for both of these methods are also indicative of the need to change DragState::type to Optional<>.