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) 46OBJC_CLASS NSAttributedString; 47OBJC_CLASS NSDictionary; 48#endif 49 50namespace WebCore { 51 52class AlternativeTextController; 53class ArchiveResource; 54class DataTransfer; 55class CompositeEditCommand; 56class DeleteButtonController; 57class EditCommand; 58class EditCommandComposition; 59class EditorClient; 60class EditorInternalCommand; 61class Frame; 62class HTMLElement; 63class HitTestResult; 64class KillRing; 65class Pasteboard; 66class SharedBuffer; 67class SimpleFontData; 68class SpellCheckRequest; 69class SpellChecker; 70class StyleProperties; 71class Text; 72class TextCheckerClient; 73class TextEvent; 74 75struct PasteboardPlainText; 76struct PasteboardURL; 77struct TextCheckingResult; 78 79struct 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 90enum EditorCommandSource { CommandFromMenuOrKeyBinding, CommandFromDOM, CommandFromDOMWithUserInterface }; 91enum EditorParagraphSeparator { EditorParagraphSeparatorIsDiv, EditorParagraphSeparatorIsP }; 92 93enum class MailBlockquoteHandling { 94 RespectBlockquote, 95 IgnoreBlockquote, 96}; 97 98class Editor { 99public: 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 const Vector<RefPtr<Range>>& detectedTelephoneNumberRanges() const { return m_detectedTelephoneNumberRanges; } 454#endif 455 456private: 457 class WebContentReader; 458 459 Document& document() const; 460 461 bool canDeleteRange(Range*) const; 462 bool canSmartReplaceWithPasteboard(Pasteboard&); 463 void pasteAsPlainTextWithPasteboard(Pasteboard&); 464 void pasteWithPasteboard(Pasteboard*, bool allowPlainText, MailBlockquoteHandling = MailBlockquoteHandling::RespectBlockquote); 465 String plainTextFromPasteboard(const PasteboardPlainText&); 466 467 void revealSelectionAfterEditingOperation(const ScrollAlignment& = ScrollAlignment::alignCenterIfNeeded, RevealExtentOption = DoNotRevealExtent); 468 void markMisspellingsOrBadGrammar(const VisibleSelection&, bool checkSpelling, RefPtr<Range>& firstMisspellingRange); 469 TextCheckingTypeMask resolveTextCheckingTypeMask(TextCheckingTypeMask); 470 471 String selectedText(TextIteratorBehavior) const; 472 473 void selectComposition(); 474 enum SetCompositionMode { ConfirmComposition, CancelComposition }; 475 void setComposition(const String&, SetCompositionMode); 476 477 void changeSelectionAfterCommand(const VisibleSelection& newSelection, FrameSelection::SetSelectionOptions); 478 479 enum EditorActionSpecifier { CutAction, CopyAction }; 480 void performCutOrCopy(EditorActionSpecifier); 481 482 void editorUIUpdateTimerFired(Timer<Editor>&); 483 484 Node* findEventTargetFromSelection() const; 485 486 bool unifiedTextCheckerEnabled() const; 487 488#if PLATFORM(COCOA) 489 PassRefPtr<SharedBuffer> selectionInWebArchiveFormat(); 490 PassRefPtr<Range> adjustedSelectionRange(); 491 PassRefPtr<DocumentFragment> createFragmentForImageResourceAndAddResource(PassRefPtr<ArchiveResource>); 492 PassRefPtr<DocumentFragment> createFragmentAndAddResources(NSAttributedString *); 493 void fillInUserVisibleForm(PasteboardURL&); 494#endif 495 496 Frame& m_frame; 497#if ENABLE(DELETION_UI) 498 std::unique_ptr<DeleteButtonController> m_deleteButtonController; 499#endif 500 RefPtr<CompositeEditCommand> m_lastEditCommand; 501 RefPtr<Text> m_compositionNode; 502 unsigned m_compositionStart; 503 unsigned m_compositionEnd; 504 Vector<CompositionUnderline> m_customCompositionUnderlines; 505 bool m_ignoreCompositionSelectionChange; 506 bool m_shouldStartNewKillRingSequence; 507 bool m_shouldStyleWithCSS; 508 const std::unique_ptr<KillRing> m_killRing; 509 const std::unique_ptr<SpellChecker> m_spellChecker; 510 const std::unique_ptr<AlternativeTextController> m_alternativeTextController; 511 VisibleSelection m_mark; 512 bool m_areMarkedTextMatchesHighlighted; 513 EditorParagraphSeparator m_defaultParagraphSeparator; 514 bool m_overwriteModeEnabled; 515 516 VisibleSelection m_oldSelectionForEditorUIUpdate; 517 Timer<Editor> m_editorUIUpdateTimer; 518 bool m_editorUIUpdateTimerShouldCheckSpellingAndGrammar; 519 bool m_editorUIUpdateTimerWasTriggeredByDictation; 520 521#if ENABLE(TELEPHONE_NUMBER_DETECTION) && !PLATFORM(IOS) 522 bool shouldDetectTelephoneNumbers(); 523 void scanSelectionForTelephoneNumbers(Timer<Editor>&); 524 void scanRangeForTelephoneNumbers(Range&, const StringView&, Vector<RefPtr<Range>>& markedRanges); 525 526 Timer<Editor> m_telephoneNumberDetectionUpdateTimer; 527 Vector<RefPtr<Range>> m_detectedTelephoneNumberRanges; 528#endif 529}; 530 531inline void Editor::setStartNewKillRingSequence(bool flag) 532{ 533 m_shouldStartNewKillRingSequence = flag; 534} 535 536inline const VisibleSelection& Editor::mark() const 537{ 538 return m_mark; 539} 540 541inline void Editor::setMark(const VisibleSelection& selection) 542{ 543 m_mark = selection; 544} 545 546inline bool Editor::markedTextMatchesAreHighlighted() const 547{ 548 return m_areMarkedTextMatchesHighlighted; 549} 550 551#if !ENABLE(DELETION_UI) 552 553inline PassRefPtr<Range> Editor::avoidIntersectionWithDeleteButtonController(const Range* range) const 554{ 555 return const_cast<Range*>(range); 556} 557 558inline VisibleSelection Editor::avoidIntersectionWithDeleteButtonController(const VisibleSelection& selection) const 559{ 560 return selection; 561} 562 563#endif 564 565} // namespace WebCore 566 567#endif // Editor_h 568