a0b2ed31d9b892cfc80ef7e40b0e1dc023a91262
[WebKit-https.git] / Source / WebCore / editing / Editor.h
1 /*
2  * Copyright (C) 2006, 2007, 2008, 2013, 2014 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24  */
25
26 #ifndef Editor_h
27 #define Editor_h
28
29 #include "Color.h"
30 #include "DataTransferAccessPolicy.h"
31 #include "DictationAlternative.h"
32 #include "DocumentMarker.h"
33 #include "EditAction.h"
34 #include "EditingBehavior.h"
35 #include "EditingStyle.h"
36 #include "EditorInsertAction.h"
37 #include "FindOptions.h"
38 #include "FrameSelection.h"
39 #include "TextChecking.h"
40 #include "TextIteratorBehavior.h"
41 #include "VisibleSelection.h"
42 #include "WritingDirection.h"
43 #include <memory>
44
45 #if PLATFORM(COCOA)
46 OBJC_CLASS NSAttributedString;
47 OBJC_CLASS NSDictionary;
48 #endif
49
50 namespace WebCore {
51
52 class AlternativeTextController;
53 class ArchiveResource;
54 class DataTransfer;
55 class CompositeEditCommand;
56 class DeleteButtonController;
57 class EditCommand;
58 class EditCommandComposition;
59 class EditorClient;
60 class EditorInternalCommand;
61 class Frame;
62 class HTMLElement;
63 class HitTestResult;
64 class KillRing;
65 class Pasteboard;
66 class SharedBuffer;
67 class SimpleFontData;
68 class SpellCheckRequest;
69 class SpellChecker;
70 class StyleProperties;
71 class Text;
72 class TextCheckerClient;
73 class TextEvent;
74
75 struct PasteboardPlainText;
76 struct PasteboardURL;
77 struct TextCheckingResult;
78
79 struct CompositionUnderline {
80     CompositionUnderline() 
81         : startOffset(0), endOffset(0), thick(false) { }
82     CompositionUnderline(unsigned s, unsigned e, const Color& c, bool t) 
83         : startOffset(s), endOffset(e), color(c), thick(t) { }
84     unsigned startOffset;
85     unsigned endOffset;
86     Color color;
87     bool thick;
88 };
89
90 enum EditorCommandSource { CommandFromMenuOrKeyBinding, CommandFromDOM, CommandFromDOMWithUserInterface };
91 enum EditorParagraphSeparator { EditorParagraphSeparatorIsDiv, EditorParagraphSeparatorIsP };
92
93 enum class MailBlockquoteHandling {
94     RespectBlockquote,
95     IgnoreBlockquote,
96 };
97
98 class Editor {
99 public:
100     explicit Editor(Frame&);
101     ~Editor();
102
103     EditorClient* client() const;
104     TextCheckerClient* textChecker() const;
105
106     CompositeEditCommand* lastEditCommand() { return m_lastEditCommand.get(); }
107
108     void handleKeyboardEvent(KeyboardEvent*);
109     void handleInputMethodKeydown(KeyboardEvent*);
110     bool handleTextEvent(TextEvent*);
111
112     bool canEdit() const;
113     bool canEditRichly() const;
114
115     bool canDHTMLCut();
116     bool canDHTMLCopy();
117     bool canDHTMLPaste();
118     bool tryDHTMLCopy();
119     bool tryDHTMLCut();
120     bool tryDHTMLPaste();
121
122     bool canCut() const;
123     bool canCopy() const;
124     bool canPaste() const;
125     bool canDelete() const;
126     bool canSmartCopyOrDelete();
127
128     void cut();
129     void copy();
130     void paste();
131     void paste(Pasteboard&);
132     void pasteAsPlainText();
133     void performDelete();
134
135     void copyURL(const URL&, const String& title);
136     void copyURL(const URL&, const String& title, Pasteboard&);
137 #if !PLATFORM(IOS)
138     void copyImage(const HitTestResult&);
139 #endif
140
141     String readPlainTextFromPasteboard(Pasteboard&);
142
143     void indent();
144     void outdent();
145     void transpose();
146
147     bool shouldInsertFragment(PassRefPtr<DocumentFragment>, PassRefPtr<Range>, EditorInsertAction);
148     bool shouldInsertText(const String&, Range*, EditorInsertAction) const;
149     bool shouldDeleteRange(Range*) const;
150     bool shouldApplyStyle(StyleProperties*, Range*);
151
152     void respondToChangedContents(const VisibleSelection& endingSelection);
153
154     bool selectionStartHasStyle(CSSPropertyID, const String& value) const;
155     TriState selectionHasStyle(CSSPropertyID, const String& value) const;
156     String selectionStartCSSPropertyValue(CSSPropertyID);
157     
158     TriState selectionUnorderedListState() const;
159     TriState selectionOrderedListState() const;
160     PassRefPtr<Node> insertOrderedList();
161     PassRefPtr<Node> insertUnorderedList();
162     bool canIncreaseSelectionListLevel();
163     bool canDecreaseSelectionListLevel();
164     PassRefPtr<Node> increaseSelectionListLevel();
165     PassRefPtr<Node> increaseSelectionListLevelOrdered();
166     PassRefPtr<Node> increaseSelectionListLevelUnordered();
167     void decreaseSelectionListLevel();
168    
169     void removeFormattingAndStyle();
170
171     void clearLastEditCommand();
172 #if PLATFORM(IOS)
173     void ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping();
174 #endif
175
176     bool deleteWithDirection(SelectionDirection, TextGranularity, bool killRing, bool isTypingAction);
177     void deleteSelectionWithSmartDelete(bool smartDelete);
178 #if PLATFORM(IOS)
179     void clearText();
180     void removeUnchangeableStyles();
181 #endif
182     
183     bool dispatchCPPEvent(const AtomicString&, DataTransferAccessPolicy);
184     
185     void applyStyle(StyleProperties*, EditAction = EditActionUnspecified);
186     void applyParagraphStyle(StyleProperties*, EditAction = EditActionUnspecified);
187     void applyStyleToSelection(StyleProperties*, EditAction);
188     void applyParagraphStyleToSelection(StyleProperties*, EditAction);
189
190     void appliedEditing(PassRefPtr<CompositeEditCommand>);
191     void unappliedEditing(PassRefPtr<EditCommandComposition>);
192     void reappliedEditing(PassRefPtr<EditCommandComposition>);
193     void unappliedSpellCorrection(const VisibleSelection& selectionOfCorrected, const String& corrected, const String& correction);
194
195     void setShouldStyleWithCSS(bool flag) { m_shouldStyleWithCSS = flag; }
196     bool shouldStyleWithCSS() const { return m_shouldStyleWithCSS; }
197
198     class Command {
199     public:
200         Command();
201         Command(const EditorInternalCommand*, EditorCommandSource, PassRefPtr<Frame>);
202
203         bool execute(const String& parameter = String(), Event* triggeringEvent = 0) const;
204         bool execute(Event* triggeringEvent) const;
205
206         bool isSupported() const;
207         bool isEnabled(Event* triggeringEvent = 0) const;
208
209         TriState state(Event* triggeringEvent = 0) const;
210         String value(Event* triggeringEvent = 0) const;
211
212         bool isTextInsertion() const;
213
214     private:
215         const EditorInternalCommand* m_command;
216         EditorCommandSource m_source;
217         RefPtr<Frame> m_frame;
218     };
219     Command command(const String& commandName); // Command source is CommandFromMenuOrKeyBinding.
220     Command command(const String& commandName, EditorCommandSource);
221     static bool commandIsSupportedFromMenuOrKeyBinding(const String& commandName); // Works without a frame.
222
223     bool insertText(const String&, Event* triggeringEvent);
224     bool insertTextForConfirmedComposition(const String& text);
225     bool insertDictatedText(const String&, const Vector<DictationAlternative>& dictationAlternatives, Event* triggeringEvent);
226     bool insertTextWithoutSendingTextEvent(const String&, bool selectInsertedText, TextEvent* triggeringEvent);
227     bool insertLineBreak();
228     bool insertParagraphSeparator();
229
230     bool isContinuousSpellCheckingEnabled() const;
231     void toggleContinuousSpellChecking();
232     bool isGrammarCheckingEnabled();
233     void toggleGrammarChecking();
234     void ignoreSpelling();
235     void learnSpelling();
236     int spellCheckerDocumentTag();
237     bool isSelectionUngrammatical();
238     String misspelledSelectionString() const;
239     String misspelledWordAtCaretOrRange(Node* clickedNode) const;
240     Vector<String> guessesForMisspelledWord(const String&) const;
241     Vector<String> guessesForMisspelledOrUngrammatical(bool& misspelled, bool& ungrammatical);
242     bool isSpellCheckingEnabledInFocusedNode() const;
243     bool isSpellCheckingEnabledFor(Node*) const;
244     void markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, const VisibleSelection& selectionAfterTyping, bool doReplacement);
245     void markMisspellings(const VisibleSelection&, RefPtr<Range>& firstMisspellingRange);
246     void markBadGrammar(const VisibleSelection&);
247     void markMisspellingsAndBadGrammar(const VisibleSelection& spellingSelection, bool markGrammar, const VisibleSelection& grammarSelection);
248     void markAndReplaceFor(PassRefPtr<SpellCheckRequest>, const Vector<TextCheckingResult>&);
249
250     bool isOverwriteModeEnabled() const { return m_overwriteModeEnabled; }
251     void toggleOverwriteModeEnabled();
252
253     void markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask, Range* spellingRange, Range* grammarRange);
254 #if PLATFORM(IOS)
255     NO_RETURN_DUE_TO_ASSERT
256 #endif
257     void changeBackToReplacedString(const String& replacedString);
258
259 #if !PLATFORM(IOS)
260     void advanceToNextMisspelling(bool startBeforeSelection = false);
261 #endif // !PLATFORM(IOS)
262     void showSpellingGuessPanel();
263     bool spellingPanelIsShowing();
264
265     bool shouldBeginEditing(Range*);
266     bool shouldEndEditing(Range*);
267
268     void clearUndoRedoOperations();
269     bool canUndo();
270     void undo();
271     bool canRedo();
272     void redo();
273
274     void didBeginEditing();
275     void didEndEditing();
276     void willWriteSelectionToPasteboard(PassRefPtr<Range>);
277     void didWriteSelectionToPasteboard();
278
279     void showFontPanel();
280     void showStylesPanel();
281     void showColorPanel();
282     void toggleBold();
283     void toggleUnderline();
284     void setBaseWritingDirection(WritingDirection);
285
286     // smartInsertDeleteEnabled and selectTrailingWhitespaceEnabled are 
287     // mutually exclusive, meaning that enabling one will disable the other.
288     bool smartInsertDeleteEnabled();
289     bool isSelectTrailingWhitespaceEnabled();
290     
291     bool hasBidiSelection() const;
292
293     // international text input composition
294     bool hasComposition() const { return m_compositionNode; }
295     void setComposition(const String&, const Vector<CompositionUnderline>&, unsigned selectionStart, unsigned selectionEnd);
296     void confirmComposition();
297     void confirmComposition(const String&); // if no existing composition, replaces selection
298     void cancelComposition();
299     bool cancelCompositionIfSelectionIsInvalid();
300     PassRefPtr<Range> compositionRange() const;
301     bool getCompositionSelection(unsigned& selectionStart, unsigned& selectionEnd) const;
302
303     // getting international text input composition state (for use by InlineTextBox)
304     Text* compositionNode() const { return m_compositionNode.get(); }
305     unsigned compositionStart() const { return m_compositionStart; }
306     unsigned compositionEnd() const { return m_compositionEnd; }
307     bool compositionUsesCustomUnderlines() const { return !m_customCompositionUnderlines.isEmpty(); }
308     const Vector<CompositionUnderline>& customCompositionUnderlines() const { return m_customCompositionUnderlines; }
309
310     void setIgnoreCompositionSelectionChange(bool);
311     bool ignoreCompositionSelectionChange() const { return m_ignoreCompositionSelectionChange; }
312
313     void setStartNewKillRingSequence(bool);
314
315     PassRefPtr<Range> rangeForPoint(const IntPoint& windowPoint);
316
317     void clear();
318
319     VisibleSelection selectionForCommand(Event*);
320
321     KillRing& killRing() const { return *m_killRing; }
322     SpellChecker& spellChecker() const { return *m_spellChecker; }
323
324     EditingBehavior behavior() const;
325
326     PassRefPtr<Range> selectedRange();
327
328 #if PLATFORM(IOS)
329     void confirmMarkedText();
330     void setTextAsChildOfElement(const String&, Element*);
331     void setTextAlignmentForChangedBaseWritingDirection(WritingDirection);
332     void insertDictationPhrases(PassOwnPtr<Vector<Vector<String> > > dictationPhrases, RetainPtr<id> metadata);
333     void setDictationPhrasesAsChildOfElement(PassOwnPtr<Vector<Vector<String> > > dictationPhrases, RetainPtr<id> metadata, Element* element);
334 #endif
335     
336     void addToKillRing(Range*, bool prepend);
337
338     void startAlternativeTextUITimer();
339     // If user confirmed a correction in the correction panel, correction has non-zero length, otherwise it means that user has dismissed the panel.
340     void handleAlternativeTextUIResult(const String& correction);
341     void dismissCorrectionPanelAsIgnored();
342
343     void pasteAsFragment(PassRefPtr<DocumentFragment>, bool smartReplace, bool matchStyle, MailBlockquoteHandling = MailBlockquoteHandling::RespectBlockquote);
344     void pasteAsPlainText(const String&, bool smartReplace);
345
346     // This is only called on the mac where paste is implemented primarily at the WebKit level.
347     void pasteAsPlainTextBypassingDHTML();
348  
349     void clearMisspellingsAndBadGrammar(const VisibleSelection&);
350     void markMisspellingsAndBadGrammar(const VisibleSelection&);
351
352     Node* findEventTargetFrom(const VisibleSelection& selection) const;
353
354     String selectedText() const;
355     String selectedTextForDataTransfer() const;
356     bool findString(const String&, FindOptions);
357
358     PassRefPtr<Range> rangeOfString(const String&, Range*, FindOptions);
359     PassRefPtr<Range> findStringAndScrollToVisible(const String&, Range*, FindOptions);
360
361     const VisibleSelection& mark() const; // Mark, to be used as emacs uses it.
362     void setMark(const VisibleSelection&);
363
364     void computeAndSetTypingStyle(StyleProperties* , EditAction = EditActionUnspecified);
365     void applyEditingStyleToBodyElement() const;
366     void applyEditingStyleToElement(Element*) const;
367
368     IntRect firstRectForRange(Range*) const;
369
370     void respondToChangedSelection(const VisibleSelection& oldSelection, FrameSelection::SetSelectionOptions);
371     void updateEditorUINowIfScheduled();
372     bool shouldChangeSelection(const VisibleSelection& oldSelection, const VisibleSelection& newSelection, EAffinity, bool stillSelecting) const;
373     unsigned countMatchesForText(const String&, Range*, FindOptions, unsigned limit, bool markMatches, Vector<RefPtr<Range>>*);
374     bool markedTextMatchesAreHighlighted() const;
375     void setMarkedTextMatchesAreHighlighted(bool);
376
377     void textFieldDidBeginEditing(Element*);
378     void textFieldDidEndEditing(Element*);
379     void textDidChangeInTextField(Element*);
380     bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*);
381     void textWillBeDeletedInTextField(Element* input);
382     void textDidChangeInTextArea(Element*);
383     WritingDirection baseWritingDirectionForSelectionStart() const;
384
385     void replaceSelectionWithFragment(PassRefPtr<DocumentFragment>, bool selectReplacement, bool smartReplace, bool matchStyle, MailBlockquoteHandling = MailBlockquoteHandling::RespectBlockquote);
386     void replaceSelectionWithText(const String&, bool selectReplacement, bool smartReplace);
387     bool selectionStartHasMarkerFor(DocumentMarker::MarkerType, int from, int length) const;
388     void updateMarkersForWordsAffectedByEditing(bool onlyHandleWordsContainingSelection);
389     void deletedAutocorrectionAtPosition(const Position&, const String& originalString);
390     
391     void simplifyMarkup(Node* startNode, Node* endNode);
392
393     void deviceScaleFactorChanged();
394
395     EditorParagraphSeparator defaultParagraphSeparator() const { return m_defaultParagraphSeparator; }
396     void setDefaultParagraphSeparator(EditorParagraphSeparator separator) { m_defaultParagraphSeparator = separator; }
397     Vector<String> dictationAlternativesForMarker(const DocumentMarker*);
398     void applyDictationAlternativelternative(const String& alternativeString);
399
400     PassRefPtr<Range> avoidIntersectionWithDeleteButtonController(const Range*) const;
401     VisibleSelection avoidIntersectionWithDeleteButtonController(const VisibleSelection&) const;
402
403 #if USE(APPKIT)
404     void uppercaseWord();
405     void lowercaseWord();
406     void capitalizeWord();
407 #endif
408
409 #if USE(AUTOMATIC_TEXT_REPLACEMENT)
410     void showSubstitutionsPanel();
411     bool substitutionsPanelIsShowing();
412     void toggleSmartInsertDelete();
413     bool isAutomaticQuoteSubstitutionEnabled();
414     void toggleAutomaticQuoteSubstitution();
415     bool isAutomaticLinkDetectionEnabled();
416     void toggleAutomaticLinkDetection();
417     bool isAutomaticDashSubstitutionEnabled();
418     void toggleAutomaticDashSubstitution();
419     bool isAutomaticTextReplacementEnabled();
420     void toggleAutomaticTextReplacement();
421     bool isAutomaticSpellingCorrectionEnabled();
422     void toggleAutomaticSpellingCorrection();
423 #endif
424
425 #if ENABLE(DELETION_UI)
426     DeleteButtonController& deleteButtonController() const { return *m_deleteButtonController; }
427 #endif
428
429 #if PLATFORM(COCOA)
430     static RenderStyle* styleForSelectionStart(Frame* , Node *&nodeToRemove);
431     bool insertParagraphSeparatorInQuotedContent();
432     const SimpleFontData* fontForSelection(bool&) const;
433     NSDictionary* fontAttributesForSelectionStart() const;
434     String stringSelectionForPasteboard();
435     String stringSelectionForPasteboardWithImageAltText();
436     PassRefPtr<DocumentFragment> webContentFromPasteboard(Pasteboard&, Range& context, bool allowPlainText, bool& chosePlainText);
437 #if !PLATFORM(IOS)
438     bool canCopyExcludingStandaloneImages();
439     void takeFindStringFromSelection();
440     void readSelectionFromPasteboard(const String& pasteboardName, MailBlockquoteHandling = MailBlockquoteHandling::RespectBlockquote);
441     void replaceNodeFromPasteboard(Node*, const String& pasteboardName);
442     PassRefPtr<SharedBuffer> dataSelectionForPasteboard(const String& pasteboardName);
443 #endif // !PLATFORM(IOS)
444 #endif
445
446 #if PLATFORM(COCOA) || PLATFORM(EFL)
447     void writeSelectionToPasteboard(Pasteboard&);
448     void writeImageToPasteboard(Pasteboard&, Element& imageElement, const URL&, const String& title);
449 #endif
450
451 #if ENABLE(TELEPHONE_NUMBER_DETECTION) && !PLATFORM(IOS)
452     void scanSelectionForTelephoneNumbers();
453 #endif
454
455 private:
456     class WebContentReader;
457
458     Document& document() const;
459
460     bool canDeleteRange(Range*) const;
461     bool canSmartReplaceWithPasteboard(Pasteboard&);
462     void pasteAsPlainTextWithPasteboard(Pasteboard&);
463     void pasteWithPasteboard(Pasteboard*, bool allowPlainText, MailBlockquoteHandling = MailBlockquoteHandling::RespectBlockquote);
464     String plainTextFromPasteboard(const PasteboardPlainText&);
465
466     void revealSelectionAfterEditingOperation(const ScrollAlignment& = ScrollAlignment::alignCenterIfNeeded, RevealExtentOption = DoNotRevealExtent);
467     void markMisspellingsOrBadGrammar(const VisibleSelection&, bool checkSpelling, RefPtr<Range>& firstMisspellingRange);
468     TextCheckingTypeMask resolveTextCheckingTypeMask(TextCheckingTypeMask);
469
470     String selectedText(TextIteratorBehavior) const;
471
472     void selectComposition();
473     enum SetCompositionMode { ConfirmComposition, CancelComposition };
474     void setComposition(const String&, SetCompositionMode);
475
476     void changeSelectionAfterCommand(const VisibleSelection& newSelection, FrameSelection::SetSelectionOptions);
477
478     enum EditorActionSpecifier { CutAction, CopyAction };
479     void performCutOrCopy(EditorActionSpecifier);
480
481     void editorUIUpdateTimerFired(Timer<Editor>&);
482
483     Node* findEventTargetFromSelection() const;
484
485     bool unifiedTextCheckerEnabled() const;
486
487 #if PLATFORM(COCOA)
488     PassRefPtr<SharedBuffer> selectionInWebArchiveFormat();
489     PassRefPtr<Range> adjustedSelectionRange();
490     PassRefPtr<DocumentFragment> createFragmentForImageResourceAndAddResource(PassRefPtr<ArchiveResource>);
491     PassRefPtr<DocumentFragment> createFragmentAndAddResources(NSAttributedString *);
492     void fillInUserVisibleForm(PasteboardURL&);
493 #endif
494
495     Frame& m_frame;
496 #if ENABLE(DELETION_UI)
497     std::unique_ptr<DeleteButtonController> m_deleteButtonController;
498 #endif
499     RefPtr<CompositeEditCommand> m_lastEditCommand;
500     RefPtr<Text> m_compositionNode;
501     unsigned m_compositionStart;
502     unsigned m_compositionEnd;
503     Vector<CompositionUnderline> m_customCompositionUnderlines;
504     bool m_ignoreCompositionSelectionChange;
505     bool m_shouldStartNewKillRingSequence;
506     bool m_shouldStyleWithCSS;
507     const std::unique_ptr<KillRing> m_killRing;
508     const std::unique_ptr<SpellChecker> m_spellChecker;
509     const std::unique_ptr<AlternativeTextController> m_alternativeTextController;
510     VisibleSelection m_mark;
511     bool m_areMarkedTextMatchesHighlighted;
512     EditorParagraphSeparator m_defaultParagraphSeparator;
513     bool m_overwriteModeEnabled;
514
515     VisibleSelection m_oldSelectionForEditorUIUpdate;
516     Timer<Editor> m_editorUIUpdateTimer;
517     bool m_editorUIUpdateTimerShouldCheckSpellingAndGrammar;
518     bool m_editorUIUpdateTimerWasTriggeredByDictation;
519
520 #if ENABLE(TELEPHONE_NUMBER_DETECTION) && !PLATFORM(IOS)
521     bool shouldDetectTelephoneNumbers();
522     void scanSelectionForTelephoneNumbers(Timer<Editor>&);
523     void scanRangeForTelephoneNumbers(Range&, const StringView&, Vector<RefPtr<Range>>& markedRanges);
524     void clearDataDetectedTelephoneNumbers();
525
526     Timer<Editor> m_telephoneNumberDetectionUpdateTimer;
527 #endif
528 };
529
530 inline void Editor::setStartNewKillRingSequence(bool flag)
531 {
532     m_shouldStartNewKillRingSequence = flag;
533 }
534
535 inline const VisibleSelection& Editor::mark() const
536 {
537     return m_mark;
538 }
539
540 inline void Editor::setMark(const VisibleSelection& selection)
541 {
542     m_mark = selection;
543 }
544
545 inline bool Editor::markedTextMatchesAreHighlighted() const
546 {
547     return m_areMarkedTextMatchesHighlighted;
548 }
549
550 #if !ENABLE(DELETION_UI)
551
552 inline PassRefPtr<Range> Editor::avoidIntersectionWithDeleteButtonController(const Range* range) const
553 {
554     return const_cast<Range*>(range);
555 }
556
557 inline VisibleSelection Editor::avoidIntersectionWithDeleteButtonController(const VisibleSelection& selection) const
558 {
559     return selection;
560 }
561
562 #endif
563
564 } // namespace WebCore
565
566 #endif // Editor_h