RESOLVED FIXED 174594
Cleanup: Use OptionSet to represent marker types
https://bugs.webkit.org/show_bug.cgi?id=174594
Summary Cleanup: Use OptionSet to represent marker types
Daniel Bates
Reported 2017-07-17 14:23:13 PDT
Class DocumentMarker::MarkerTypes represents bitmask of marker types and duplicates most of the functionality of OptionSet. Unlike OptionSet, DocumentMarker::MarkerTypes does not support iteration and hence code, such as AlternativeTextController::applyAlternativeTextToRange(), uses Vector<DocumentMarker::MarkerType> to represent a set of marker types. We can use OptionSet to support both uses cases in a space- and time- efficient manner.
Attachments
Patch (35.01 KB, patch)
2017-07-17 14:25 PDT, Daniel Bates
darin: review+
Daniel Bates
Comment 1 2017-07-17 14:25:46 PDT
Darin Adler
Comment 2 2017-07-17 18:50:50 PDT
Comment on attachment 315713 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=315713&action=review > Source/WebCore/dom/DocumentMarker.h:164 > + AcceptedCandidate > + , Autocorrected > + , CorrectionIndicator > + , DeletedAutocorrection > + , DictationAlternatives > + , Grammar > + , RejectedCorrection > + , Replacement > + , SpellCheckingExemption > + , Spelling > + , TextMatch > +#if ENABLE(TELEPHONE_NUMBER_DETECTION) > + , TelephoneNumber > +#endif > +#if PLATFORM(IOS) > + , DictationPhraseWithAlternatives > + , DictationResult > +#endif > + , DraggedContent I would like to see this sorted alphabetically (including "DraggedContent", but not including the conditional items. And we should use trailing commas instead of leading commas, with the extra one at the end that C++ allows in initializer lists. That way we don’t have to have one line different from the others. > Source/WebCore/editing/Editor.cpp:2752 > + DocumentMarker::Spelling, DocumentMarker::CorrectionIndicator, DocumentMarker::SpellCheckingExemption, > + DocumentMarker::DictationAlternatives > +#if !PLATFORM(IOS) > + , DocumentMarker::Grammar > #endif Trailing commas after each item is a cleaner way to do this since you can have an extra comma.
Darin Adler
Comment 3 2017-07-17 18:54:00 PDT
You will have to rebase and merge with r219595 since it overlaps some functions you changed.
Daniel Bates
Comment 4 2017-07-17 19:35:14 PDT
(In reply to Darin Adler from comment #2) > > Source/WebCore/dom/DocumentMarker.h:164 > > + AcceptedCandidate > > + , Autocorrected > > + , CorrectionIndicator > > + , DeletedAutocorrection > > + , DictationAlternatives > > + , Grammar > > + , RejectedCorrection > > + , Replacement > > + , SpellCheckingExemption > > + , Spelling > > + , TextMatch > > +#if ENABLE(TELEPHONE_NUMBER_DETECTION) > > + , TelephoneNumber > > +#endif > > +#if PLATFORM(IOS) > > + , DictationPhraseWithAlternatives > > + , DictationResult > > +#endif > > + , DraggedContent > > I would like to see this sorted alphabetically (including "DraggedContent", > but not including the conditional items. And we should use trailing commas > instead of leading commas, with the extra one at the end that C++ allows in > initializer lists. That way we don’t have to have one line different from > the others. > Will fix. > > Source/WebCore/editing/Editor.cpp:2752 > > + DocumentMarker::Spelling, DocumentMarker::CorrectionIndicator, DocumentMarker::SpellCheckingExemption, > > + DocumentMarker::DictationAlternatives > > +#if !PLATFORM(IOS) > > + , DocumentMarker::Grammar > > #endif > > Trailing commas after each item is a cleaner way to do this since you can > have an extra comma. Will fix.
Daniel Bates
Comment 5 2017-07-17 19:43:17 PDT
Konstantin Tokarev
Comment 6 2017-07-17 20:23:57 PDT
This change seems to break WinCairo bot WebFrame.cpp.obj : error LNK2019: unresolved external symbol "public: void __cdecl WebCore::DocumentMarkerController::removeMarkers(class WebCore::DocumentMarker::MarkerTypes)" (?removeMarkers@DocumentMarkerController@WebCore@@QEAAXVMarkerTypes@DocumentMarker@2@@Z) referenced in function "public: void __cdecl WebFrame::unmarkAllMisspellings(void)" (?unmarkAllMisspellings@WebFrame@@QEAAXXZ) https://build.webkit.org/builders/WinCairo%2064-Bit%20Release/builds/4428/steps/compile-webkit/logs/stdio
Darin Adler
Comment 7 2017-07-17 20:27:17 PDT
That looks like a build dependency error that we would get if we tried to link WebKitLegacy against WebCore and had not recompiled WebKitLegacy, rather than a mistake in this patch. Could force the WinCairo bot to do a clean build, or try to figure out how to fix the build system used by WinCairo to correctly understand this dependency.
Note You need to log in before you can comment on or make changes to this bug.