Title: [234801] trunk/Source
Revision
234801
Author
[email protected]
Date
2018-08-13 08:29:23 -0700 (Mon, 13 Aug 2018)

Log Message

Use OptionSet more in editing code
https://bugs.webkit.org/show_bug.cgi?id=188500

Reviewed by Wenson Hsieh.

Typesafe flags.

* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::moveParagraphs):
* editing/Editor.cpp:
(WebCore::TemporarySelectionChange::TemporarySelectionChange):
(WebCore::Editor::replaceSelectionWithFragment):
(WebCore::Editor::appliedEditing):
(WebCore::Editor::selectComposition):
(WebCore::Editor::changeSelectionAfterCommand):
(WebCore::Editor::respondToChangedSelection):
* editing/Editor.h:
(WebCore::TemporarySelectionChange::TemporarySelectionChange):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::moveWithoutValidationTo):
(WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance):
(WebCore::FrameSelection::setSelection):
(WebCore::FrameSelection::setSelectedRange):
* editing/FrameSelection.h:
(WebCore::FrameSelection::defaultSetSelectionOptions):
* editing/MoveSelectionCommand.cpp:
(WebCore::MoveSelectionCommand::doApply):
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::ReplaceSelectionCommand):
* editing/ReplaceSelectionCommand.h:
(WebCore::ReplaceSelectionCommand::create):
* editing/SetSelectionCommand.cpp:
(WebCore::SetSelectionCommand::SetSelectionCommand):
* editing/SetSelectionCommand.h:
(WebCore::SetSelectionCommand::create):
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
* page/DragController.cpp:
(WebCore::DragController::concludeEditDrag):
* page/TextIndicator.cpp:
(WebCore::TextIndicator::createWithRange):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (234800 => 234801)


--- trunk/Source/WebCore/ChangeLog	2018-08-13 14:48:10 UTC (rev 234800)
+++ trunk/Source/WebCore/ChangeLog	2018-08-13 15:29:23 UTC (rev 234801)
@@ -1,3 +1,47 @@
+2018-08-13  Antti Koivisto  <[email protected]>
+
+        Use OptionSet more in editing code
+        https://bugs.webkit.org/show_bug.cgi?id=188500
+
+        Reviewed by Wenson Hsieh.
+
+        Typesafe flags.
+
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::CompositeEditCommand::moveParagraphs):
+        * editing/Editor.cpp:
+        (WebCore::TemporarySelectionChange::TemporarySelectionChange):
+        (WebCore::Editor::replaceSelectionWithFragment):
+        (WebCore::Editor::appliedEditing):
+        (WebCore::Editor::selectComposition):
+        (WebCore::Editor::changeSelectionAfterCommand):
+        (WebCore::Editor::respondToChangedSelection):
+        * editing/Editor.h:
+        (WebCore::TemporarySelectionChange::TemporarySelectionChange):
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::moveWithoutValidationTo):
+        (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance):
+        (WebCore::FrameSelection::setSelection):
+        (WebCore::FrameSelection::setSelectedRange):
+        * editing/FrameSelection.h:
+        (WebCore::FrameSelection::defaultSetSelectionOptions):
+        * editing/MoveSelectionCommand.cpp:
+        (WebCore::MoveSelectionCommand::doApply):
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplaceSelectionCommand::ReplaceSelectionCommand):
+        * editing/ReplaceSelectionCommand.h:
+        (WebCore::ReplaceSelectionCommand::create):
+        * editing/SetSelectionCommand.cpp:
+        (WebCore::SetSelectionCommand::SetSelectionCommand):
+        * editing/SetSelectionCommand.h:
+        (WebCore::SetSelectionCommand::create):
+        * page/ContextMenuController.cpp:
+        (WebCore::ContextMenuController::contextMenuItemSelected):
+        * page/DragController.cpp:
+        (WebCore::DragController::concludeEditDrag):
+        * page/TextIndicator.cpp:
+        (WebCore::TextIndicator::createWithRange):
+
 2018-08-13  Zalan Bujtas  <[email protected]>
 
         [LFC][Floating] Add basic clearance support

Modified: trunk/Source/WebCore/editing/CompositeEditCommand.cpp (234800 => 234801)


--- trunk/Source/WebCore/editing/CompositeEditCommand.cpp	2018-08-13 14:48:10 UTC (rev 234800)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.cpp	2018-08-13 15:29:23 UTC (rev 234801)
@@ -1489,7 +1489,7 @@
 
     setEndingSelection(VisibleSelection(destination, originalIsDirectional));
     ASSERT(endingSelection().isCaretOrRange());
-    ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::MovingParagraph;
+    OptionSet<ReplaceSelectionCommand::CommandOption> options { ReplaceSelectionCommand::SelectReplacement, ReplaceSelectionCommand::MovingParagraph };
     if (!preserveStyle)
         options |= ReplaceSelectionCommand::MatchStyle;
     applyCommandToComposite(ReplaceSelectionCommand::create(document(), WTFMove(fragment), options));

Modified: trunk/Source/WebCore/editing/Editor.cpp (234800 => 234801)


--- trunk/Source/WebCore/editing/Editor.cpp	2018-08-13 14:48:10 UTC (rev 234800)
+++ trunk/Source/WebCore/editing/Editor.cpp	2018-08-13 15:29:23 UTC (rev 234801)
@@ -190,7 +190,7 @@
 using namespace WTF;
 using namespace Unicode;
 
-TemporarySelectionChange::TemporarySelectionChange(Frame& frame, std::optional<VisibleSelection> temporarySelection, TemporarySelectionOptions options)
+TemporarySelectionChange::TemporarySelectionChange(Frame& frame, std::optional<VisibleSelection> temporarySelection, OptionSet<TemporarySelectionOption> options)
     : m_frame(frame)
     , m_options(options)
     , m_wasIgnoringSelectionChanges(frame.editor().ignoreSelectionChanges())
@@ -635,7 +635,7 @@
     if (AXObjectCache::accessibilityEnabled() && editingAction == EditActionPaste)
         replacedText = AccessibilityReplacedText(selection);
 
-    ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::PreventNesting | ReplaceSelectionCommand::SanitizeFragment;
+    OptionSet<ReplaceSelectionCommand::CommandOption> options { ReplaceSelectionCommand::PreventNesting, ReplaceSelectionCommand::SanitizeFragment };
     if (selectReplacement)
         options |= ReplaceSelectionCommand::SelectReplacement;
     if (smartReplace)
@@ -1073,7 +1073,9 @@
 
     if (command.isTopLevelCommand()) {
         // Don't clear the typing style with this selection change. We do those things elsewhere if necessary.
-        FrameSelection::SetSelectionOptions options = command.isDictationCommand() ? FrameSelection::DictationTriggered : 0;
+        OptionSet<FrameSelection::SetSelectionOption> options;
+        if (command.isDictationCommand())
+            options |= FrameSelection::DictationTriggered;
 
         changeSelectionAfterCommand(newSelection, options);
     }
@@ -1781,7 +1783,7 @@
     // See <http://bugs.webkit.org/show_bug.cgi?id=15781>
     VisibleSelection selection;
     selection.setWithoutValidation(range->startPosition(), range->endPosition());
-    m_frame.selection().setSelection(selection, 0);
+    m_frame.selection().setSelection(selection, { });
 }
 
 void Editor::confirmComposition()
@@ -2984,7 +2986,7 @@
 #if PLATFORM(IOS)
     // FIXME: Should suppress selection change notifications during a composition change <https://webkit.org/b/38830> 
     if (!ignore)
-        respondToChangedSelection(m_frame.selection().selection(), 0);
+        respondToChangedSelection(m_frame.selection().selection(), { });
 #endif
     if (!ignore && shouldRevealExistingSelection == RevealSelection::Yes)
         revealSelectionAfterEditingOperation(ScrollAlignment::alignToEdgeIfNeeded, RevealExtent);
@@ -3107,7 +3109,7 @@
     m_alternativeTextController->dismiss(ReasonForDismissingAlternativeTextIgnored);
 }
 
-void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection, FrameSelection::SetSelectionOptions options)
+void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection, OptionSet<FrameSelection::SetSelectionOption> options)
 {
     Ref<Frame> protection(m_frame);
 
@@ -3470,7 +3472,7 @@
 }
 #endif
 
-void Editor::respondToChangedSelection(const VisibleSelection&, FrameSelection::SetSelectionOptions options)
+void Editor::respondToChangedSelection(const VisibleSelection&, OptionSet<FrameSelection::SetSelectionOption> options)
 {
 #if PLATFORM(IOS)
     // FIXME: Should suppress selection change notifications during a composition change <https://webkit.org/b/38830> 
@@ -3492,9 +3494,8 @@
         return;
 
     // Don't check spelling and grammar if the change of selection is triggered by spelling correction itself.
-    m_editorUIUpdateTimerShouldCheckSpellingAndGrammar = options & FrameSelection::CloseTyping
-        && !(options & FrameSelection::SpellCorrectionTriggered);
-    m_editorUIUpdateTimerWasTriggeredByDictation = options & FrameSelection::DictationTriggered;
+    m_editorUIUpdateTimerShouldCheckSpellingAndGrammar = options.contains(FrameSelection::CloseTyping) && !options.contains(FrameSelection::SpellCorrectionTriggered);
+    m_editorUIUpdateTimerWasTriggeredByDictation = options.contains(FrameSelection::DictationTriggered);
     scheduleEditorUIUpdate();
 }
 

Modified: trunk/Source/WebCore/editing/Editor.h (234800 => 234801)


--- trunk/Source/WebCore/editing/Editor.h	2018-08-13 14:48:10 UTC (rev 234800)
+++ trunk/Source/WebCore/editing/Editor.h	2018-08-13 15:29:23 UTC (rev 234801)
@@ -99,9 +99,6 @@
 #endif
 
 enum TemporarySelectionOption : uint8_t {
-    // By default, no additional options are enabled.
-    TemporarySelectionOptionDefault = 0,
-
     // Scroll to reveal the selection.
     TemporarySelectionOptionRevealSelection = 1 << 0,
 
@@ -112,16 +109,14 @@
     TemporarySelectionOptionEnableAppearanceUpdates = 1 << 2
 };
 
-using TemporarySelectionOptions = uint8_t;
-
 class TemporarySelectionChange {
 public:
-    TemporarySelectionChange(Frame&, std::optional<VisibleSelection> = std::nullopt, TemporarySelectionOptions = TemporarySelectionOptionDefault);
+    TemporarySelectionChange(Frame&, std::optional<VisibleSelection> = std::nullopt, OptionSet<TemporarySelectionOption> = { });
     ~TemporarySelectionChange();
 
 private:
     Ref<Frame> m_frame;
-    TemporarySelectionOptions m_options;
+    OptionSet<TemporarySelectionOption> m_options;
     bool m_wasIgnoringSelectionChanges;
 #if PLATFORM(IOS)
     bool m_appearanceUpdatesWereEnabled;
@@ -414,7 +409,7 @@
     WEBCORE_EXPORT IntRect firstRectForRange(Range*) const;
 
     void selectionWillChange();
-    void respondToChangedSelection(const VisibleSelection& oldSelection, FrameSelection::SetSelectionOptions);
+    void respondToChangedSelection(const VisibleSelection& oldSelection, OptionSet<FrameSelection::SetSelectionOption>);
     WEBCORE_EXPORT void updateEditorUINowIfScheduled();
     bool shouldChangeSelection(const VisibleSelection& oldSelection, const VisibleSelection& newSelection, EAffinity, bool stillSelecting) const;
     WEBCORE_EXPORT unsigned countMatchesForText(const String&, Range*, FindOptions, unsigned limit, bool markMatches, Vector<RefPtr<Range>>*);
@@ -541,7 +536,7 @@
     enum SetCompositionMode { ConfirmComposition, CancelComposition };
     void setComposition(const String&, SetCompositionMode);
 
-    void changeSelectionAfterCommand(const VisibleSelection& newSelection, FrameSelection::SetSelectionOptions);
+    void changeSelectionAfterCommand(const VisibleSelection& newSelection, OptionSet<FrameSelection::SetSelectionOption>);
 
     enum EditorActionSpecifier { CutAction, CopyAction };
     void performCutOrCopy(EditorActionSpecifier);

Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (234800 => 234801)


--- trunk/Source/WebCore/editing/FrameSelection.cpp	2018-08-13 14:48:10 UTC (rev 234800)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp	2018-08-13 15:29:23 UTC (rev 234801)
@@ -185,7 +185,7 @@
     newSelection.setWithoutValidation(base, extent);
     newSelection.setIsDirectional(selectionHasDirection);
     AXTextStateChangeIntent newIntent = intent.type == AXTextStateChangeTypeUnknown ? AXTextStateChangeIntent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown, false }) : intent;
-    SetSelectionOptions options = defaultSetSelectionOptions();
+    auto options = defaultSetSelectionOptions();
     if (!shouldSetFocus)
         options |= DoNotSetFocus;
     switch (revealMode) {
@@ -291,10 +291,10 @@
     setSelection(newSelection, defaultSetSelectionOptions() | FireSelectEvent, intent, AlignCursorOnScrollIfNeeded, granularity);
 }
 
-bool FrameSelection::setSelectionWithoutUpdatingAppearance(const VisibleSelection& newSelectionPossiblyWithoutDirection, SetSelectionOptions options, CursorAlignOnScroll align, TextGranularity granularity)
+bool FrameSelection::setSelectionWithoutUpdatingAppearance(const VisibleSelection& newSelectionPossiblyWithoutDirection, OptionSet<SetSelectionOption> options, CursorAlignOnScroll align, TextGranularity granularity)
 {
-    bool closeTyping = options & CloseTyping;
-    bool shouldClearTypingStyle = options & ClearTypingStyle;
+    bool closeTyping = options.contains(CloseTyping);
+    bool shouldClearTypingStyle = options.contains(ClearTypingStyle);
 
     VisibleSelection newSelection = newSelectionPossiblyWithoutDirection;
     if (shouldAlwaysUseDirectionalSelection(m_frame))
@@ -338,7 +338,7 @@
 
     // Selection offsets should increase when LF is inserted before the caret in InsertLineBreakCommand. See <https://webkit.org/b/56061>.
     if (HTMLTextFormControlElement* textControl = enclosingTextFormControl(newSelection.start()))
-        textControl->selectionChanged(options & FireSelectEvent);
+        textControl->selectionChanged(options.contains(FireSelectEvent));
 
     if (!didMutateSelection)
         return false;
@@ -358,7 +358,7 @@
     return true;
 }
 
-void FrameSelection::setSelection(const VisibleSelection& selection, SetSelectionOptions options, AXTextStateChangeIntent intent, CursorAlignOnScroll align, TextGranularity granularity)
+void FrameSelection::setSelection(const VisibleSelection& selection, OptionSet<SetSelectionOption> options, AXTextStateChangeIntent intent, CursorAlignOnScroll align, TextGranularity granularity)
 {
     RefPtr<Frame> protectedFrame(m_frame);
     if (!setSelectionWithoutUpdatingAppearance(selection, options, align, granularity))
@@ -1993,15 +1993,22 @@
         return false;
 #endif
 
+    OptionSet<SetSelectionOption> selectionOptions {  ClearTypingStyle };
+    if (closeTyping)
+        selectionOptions |= CloseTyping;
+
     if (userTriggered == UserTriggered) {
         FrameSelection trialFrameSelection;
-        trialFrameSelection.setSelection(newSelection, ClearTypingStyle | (closeTyping ? CloseTyping : 0));
 
+        trialFrameSelection.setSelection(newSelection, selectionOptions);
+
         if (!shouldChangeSelection(trialFrameSelection.selection()))
             return false;
+
+        selectionOptions |= IsUserTriggered;
     }
 
-    setSelection(newSelection, ClearTypingStyle | (closeTyping ? CloseTyping : 0) | (userTriggered == UserTriggered ? IsUserTriggered : 0));
+    setSelection(newSelection, selectionOptions);
     return true;
 }
 
@@ -2690,7 +2697,8 @@
     resultRange->setStart(node, location);
     resultRange->setEnd(node, location + length);
     VisibleSelection selection = VisibleSelection(*resultRange, SEL_DEFAULT_AFFINITY);
-    setSelection(selection, true);
+    // FIXME: The second argument was "true" which implicitly converted to option "FireSelectEvent". Is this correct?
+    setSelection(selection, { FireSelectEvent });
 }
 
 VisibleSelection FrameSelection::wordSelectionContainingCaretSelection(const VisibleSelection& selection)

Modified: trunk/Source/WebCore/editing/FrameSelection.h (234800 => 234801)


--- trunk/Source/WebCore/editing/FrameSelection.h	2018-08-13 14:48:10 UTC (rev 234800)
+++ trunk/Source/WebCore/editing/FrameSelection.h	2018-08-13 15:29:23 UTC (rev 234801)
@@ -129,10 +129,12 @@
         RevealSelection = 1 << 7,
         RevealSelectionUpToMainFrame = 1 << 8,
     };
-    typedef unsigned SetSelectionOptions; // Union of values in SetSelectionOption and EUserTriggered
-    static inline SetSelectionOptions defaultSetSelectionOptions(EUserTriggered userTriggered = NotUserTriggered)
+    static constexpr OptionSet<SetSelectionOption> defaultSetSelectionOptions(EUserTriggered userTriggered = NotUserTriggered)
     {
-        return CloseTyping | ClearTypingStyle | (userTriggered ? (RevealSelection | FireSelectEvent | IsUserTriggered) : 0);
+        OptionSet<SetSelectionOption> options { CloseTyping, ClearTypingStyle };
+        if (userTriggered == UserTriggered)
+            options |= { RevealSelection, FireSelectEvent, IsUserTriggered };
+        return options;
     }
 
     WEBCORE_EXPORT explicit FrameSelection(Frame* = nullptr);
@@ -147,7 +149,7 @@
     void moveWithoutValidationTo(const Position&, const Position&, bool selectionHasDirection, bool shouldSetFocus, SelectionRevealMode, const AXTextStateChangeIntent& = AXTextStateChangeIntent());
 
     const VisibleSelection& selection() const { return m_selection; }
-    WEBCORE_EXPORT void setSelection(const VisibleSelection&, SetSelectionOptions = defaultSetSelectionOptions(), AXTextStateChangeIntent = AXTextStateChangeIntent(), CursorAlignOnScroll = AlignCursorOnScrollIfNeeded, TextGranularity = CharacterGranularity);
+    WEBCORE_EXPORT void setSelection(const VisibleSelection&, OptionSet<SetSelectionOption> = defaultSetSelectionOptions(), AXTextStateChangeIntent = AXTextStateChangeIntent(), CursorAlignOnScroll = AlignCursorOnScrollIfNeeded, TextGranularity = CharacterGranularity);
     WEBCORE_EXPORT bool setSelectedRange(Range*, EAffinity, bool closeTyping, EUserTriggered = NotUserTriggered);
     WEBCORE_EXPORT void selectAll();
     WEBCORE_EXPORT void clear();
@@ -282,7 +284,7 @@
     void updateAndRevealSelection(const AXTextStateChangeIntent&);
     void updateDataDetectorsForSelection();
 
-    bool setSelectionWithoutUpdatingAppearance(const VisibleSelection&, SetSelectionOptions, CursorAlignOnScroll, TextGranularity);
+    bool setSelectionWithoutUpdatingAppearance(const VisibleSelection&, OptionSet<SetSelectionOption>, CursorAlignOnScroll, TextGranularity);
 
     void respondToNodeModification(Node&, bool baseRemoved, bool extentRemoved, bool startRemoved, bool endRemoved);
     TextDirection directionOfEnclosingBlock();

Modified: trunk/Source/WebCore/editing/MoveSelectionCommand.cpp (234800 => 234801)


--- trunk/Source/WebCore/editing/MoveSelectionCommand.cpp	2018-08-13 14:48:10 UTC (rev 234800)
+++ trunk/Source/WebCore/editing/MoveSelectionCommand.cpp	2018-08-13 15:29:23 UTC (rev 234801)
@@ -82,7 +82,7 @@
         // Document was modified out from under us.
         return;
     }
-    ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::PreventNesting;
+    OptionSet<ReplaceSelectionCommand::CommandOption> options { ReplaceSelectionCommand::SelectReplacement, ReplaceSelectionCommand::PreventNesting };
     if (m_smartInsert)
         options |= ReplaceSelectionCommand::SmartReplace;
 

Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp (234800 => 234801)


--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp	2018-08-13 14:48:10 UTC (rev 234800)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp	2018-08-13 15:29:23 UTC (rev 234801)
@@ -377,7 +377,7 @@
         m_lastNodeInserted = newNode;
 }
 
-ReplaceSelectionCommand::ReplaceSelectionCommand(Document& document, RefPtr<DocumentFragment>&& fragment, CommandOptions options, EditAction editAction)
+ReplaceSelectionCommand::ReplaceSelectionCommand(Document& document, RefPtr<DocumentFragment>&& fragment, OptionSet<CommandOption> options, EditAction editAction)
     : CompositeEditCommand(document, editAction)
     , m_selectReplacement(options & SelectReplacement)
     , m_smartReplace(options & SmartReplace)

Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.h (234800 => 234801)


--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.h	2018-08-13 14:48:10 UTC (rev 234800)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.h	2018-08-13 15:29:23 UTC (rev 234801)
@@ -45,9 +45,7 @@
         IgnoreMailBlockquote = 1 << 6,
     };
 
-    typedef unsigned CommandOptions;
-
-    static Ref<ReplaceSelectionCommand> create(Document& document, RefPtr<DocumentFragment>&& fragment, CommandOptions options, EditAction editingAction = EditActionInsert)
+    static Ref<ReplaceSelectionCommand> create(Document& document, RefPtr<DocumentFragment>&& fragment, OptionSet<CommandOption> options, EditAction editingAction = EditActionInsert)
     {
         return adoptRef(*new ReplaceSelectionCommand(document, WTFMove(fragment), options, editingAction));
     }
@@ -55,7 +53,7 @@
     VisibleSelection visibleSelectionForInsertedText() const { return m_visibleSelectionForInsertedText; }
 
 private:
-    ReplaceSelectionCommand(Document&, RefPtr<DocumentFragment>&&, CommandOptions, EditAction);
+    ReplaceSelectionCommand(Document&, RefPtr<DocumentFragment>&&, OptionSet<CommandOption>, EditAction);
 
     String inputEventData() const final;
     RefPtr<DataTransfer> inputEventDataTransfer() const final;

Modified: trunk/Source/WebCore/editing/SetSelectionCommand.cpp (234800 => 234801)


--- trunk/Source/WebCore/editing/SetSelectionCommand.cpp	2018-08-13 14:48:10 UTC (rev 234800)
+++ trunk/Source/WebCore/editing/SetSelectionCommand.cpp	2018-08-13 15:29:23 UTC (rev 234801)
@@ -31,7 +31,7 @@
 
 namespace WebCore {
 
-SetSelectionCommand::SetSelectionCommand(const VisibleSelection& selection, FrameSelection::SetSelectionOptions options)
+SetSelectionCommand::SetSelectionCommand(const VisibleSelection& selection, OptionSet<FrameSelection::SetSelectionOption> options)
     : SimpleEditCommand(selection.base().anchorNode()->document())
     , m_options(options)
     , m_selectionToSet(selection)

Modified: trunk/Source/WebCore/editing/SetSelectionCommand.h (234800 => 234801)


--- trunk/Source/WebCore/editing/SetSelectionCommand.h	2018-08-13 14:48:10 UTC (rev 234800)
+++ trunk/Source/WebCore/editing/SetSelectionCommand.h	2018-08-13 15:29:23 UTC (rev 234801)
@@ -32,13 +32,13 @@
 
 class SetSelectionCommand : public SimpleEditCommand {
 public:
-    static Ref<SetSelectionCommand> create(const VisibleSelection& selection, FrameSelection::SetSelectionOptions options)
+    static Ref<SetSelectionCommand> create(const VisibleSelection& selection, OptionSet<FrameSelection::SetSelectionOption> options)
     {
         return adoptRef(*new SetSelectionCommand(selection, options));
     }
 
 private:
-    SetSelectionCommand(const VisibleSelection&, FrameSelection::SetSelectionOptions);
+    SetSelectionCommand(const VisibleSelection&, OptionSet<FrameSelection::SetSelectionOption>);
 
     void doApply() override;
     void doUnapply() override;
@@ -47,7 +47,7 @@
     void getNodesInCommand(HashSet<Node*>&) override { }
 #endif
 
-    FrameSelection::SetSelectionOptions m_options;
+    OptionSet<FrameSelection::SetSelectionOption> m_options;
     VisibleSelection m_selectionToSet;
 };
 

Modified: trunk/Source/WebCore/page/ContextMenuController.cpp (234800 => 234801)


--- trunk/Source/WebCore/page/ContextMenuController.cpp	2018-08-13 14:48:10 UTC (rev 234800)
+++ trunk/Source/WebCore/page/ContextMenuController.cpp	2018-08-13 15:29:23 UTC (rev 234801)
@@ -360,7 +360,7 @@
     case ContextMenuItemTagSpellingGuess: {
         VisibleSelection selection = frame->selection().selection();
         if (frame->editor().shouldInsertText(title, selection.toNormalizedRange().get(), EditorInsertAction::Pasted)) {
-            ReplaceSelectionCommand::CommandOptions replaceOptions = ReplaceSelectionCommand::MatchStyle | ReplaceSelectionCommand::PreventNesting;
+            OptionSet<ReplaceSelectionCommand::CommandOption> replaceOptions { ReplaceSelectionCommand::MatchStyle, ReplaceSelectionCommand::PreventNesting };
 
             if (frame->editor().behavior().shouldAllowSpellingSuggestionsWithoutSelection()) {
                 ASSERT(selection.isCaretOrRange());

Modified: trunk/Source/WebCore/page/DragController.cpp (234800 => 234801)


--- trunk/Source/WebCore/page/DragController.cpp	2018-08-13 14:48:10 UTC (rev 234800)
+++ trunk/Source/WebCore/page/DragController.cpp	2018-08-13 15:29:23 UTC (rev 234801)
@@ -595,7 +595,7 @@
             MoveSelectionCommand::create(fragment.releaseNonNull(), dragCaret.base(), smartInsert, smartDelete)->apply();
         } else {
             if (setSelectionToDragCaret(innerFrame.get(), dragCaret, range, point)) {
-                ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::PreventNesting;
+                OptionSet<ReplaceSelectionCommand::CommandOption> options { ReplaceSelectionCommand::SelectReplacement, ReplaceSelectionCommand::PreventNesting };
                 if (dragData.canSmartReplace())
                     options |= ReplaceSelectionCommand::SmartReplace;
                 if (chosePlainText)
@@ -617,7 +617,7 @@
             return true;
 
         if (setSelectionToDragCaret(innerFrame.get(), dragCaret, range, point))
-            ReplaceSelectionCommand::create(*m_documentUnderMouse, fragment.get(), ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::MatchStyle | ReplaceSelectionCommand::PreventNesting, EditActionInsertFromDrop)->apply();
+            ReplaceSelectionCommand::create(*m_documentUnderMouse, fragment.get(), { ReplaceSelectionCommand::SelectReplacement, ReplaceSelectionCommand::MatchStyle, ReplaceSelectionCommand::PreventNesting }, EditActionInsertFromDrop)->apply();
     }
 
     if (rootEditableElement) {

Modified: trunk/Source/WebCore/page/TextIndicator.cpp (234800 => 234801)


--- trunk/Source/WebCore/page/TextIndicator.cpp	2018-08-13 14:48:10 UTC (rev 234800)
+++ trunk/Source/WebCore/page/TextIndicator.cpp	2018-08-13 15:29:23 UTC (rev 234801)
@@ -78,7 +78,7 @@
     Ref<Frame> protector(*frame);
 
     VisibleSelection oldSelection = frame->selection().selection();
-    TemporarySelectionOptions temporarySelectionOptions = TemporarySelectionOptionDefault;
+    OptionSet<TemporarySelectionOption> temporarySelectionOptions;
 #if PLATFORM(IOS)
     temporarySelectionOptions |= TemporarySelectionOptionIgnoreSelectionChanges;
     temporarySelectionOptions |= TemporarySelectionOptionEnableAppearanceUpdates;

Modified: trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebFrameIOS.mm (234800 => 234801)


--- trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebFrameIOS.mm	2018-08-13 14:48:10 UTC (rev 234800)
+++ trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebFrameIOS.mm	2018-08-13 15:29:23 UTC (rev 234801)
@@ -643,7 +643,7 @@
             break;
     }
     FrameSelection& frameSelection = _private->coreFrame->selection();
-    frameSelection.setSelection(frameSelection.selection(), wcGranularity);
+    frameSelection.setSelection(frameSelection.selection(), { }, { }, { }, wcGranularity);
 }
 
 static inline bool isAlphaNumericCharacter(UChar32 c)

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm (234800 => 234801)


--- trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm	2018-08-13 14:48:10 UTC (rev 234800)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm	2018-08-13 15:29:23 UTC (rev 234801)
@@ -1247,7 +1247,7 @@
     RefPtr<Range> domRange = [self _convertToDOMRange:range];
     if (domRange) {
         const VisibleSelection& newSelection = VisibleSelection(*domRange, SEL_DEFAULT_AFFINITY);
-        _private->coreFrame->selection().setSelection(newSelection, 0);
+        _private->coreFrame->selection().setSelection(newSelection, { });
         
         _private->coreFrame->editor().ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping();
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to