| #include <WebCore/EditorClient.h> |
| #include <WebCore/TextCheckerClient.h> |
| |
| #pragma once |
| |
| namespace WebKit { |
| |
| typedef std::function<void(bool)> InputFocusDelegate; |
| |
| class WebEditorClient final : public WebCore::EditorClient, public WebCore::TextCheckerClient { |
| public: |
| WebEditorClient(InputFocusDelegate delegate); |
| |
| private: |
| InputFocusDelegate m_inputFocusDelegate; |
| |
| bool shouldDeleteRange(WebCore::Range*) final; |
| bool smartInsertDeleteEnabled() final; |
| bool isSelectTrailingWhitespaceEnabled() final; |
| bool isContinuousSpellCheckingEnabled() final; |
| void toggleContinuousSpellChecking() final; |
| bool isGrammarCheckingEnabled() final; |
| void toggleGrammarChecking() final; |
| int spellCheckerDocumentTag() final; |
| |
| bool shouldBeginEditing(WebCore::Range*) final; |
| bool shouldEndEditing(WebCore::Range*) final; |
| bool shouldInsertNode(WebCore::Node*, WebCore::Range*, WebCore::EditorInsertAction) final; |
| bool shouldInsertText(const String&, WebCore::Range*, WebCore::EditorInsertAction) final; |
| bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting) final; |
| |
| bool shouldApplyStyle(WebCore::StyleProperties*, WebCore::Range*) final; |
| void didApplyStyle() final; |
| bool shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::Range*) final; |
| |
| void didBeginEditing() final; |
| void respondToChangedContents() final; |
| void respondToChangedSelection(WebCore::Frame*) final; |
| void didChangeSelectionAndUpdateLayout() final; |
| void updateEditorStateAfterLayoutIfEditabilityChanged() final; |
| void discardedComposition(WebCore::Frame*) final; |
| void didEndEditing() final; |
| void willWriteSelectionToPasteboard(WebCore::Range*) final; |
| void didWriteSelectionToPasteboard() final; |
| void getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer>>& pasteboardData) final; |
| |
| void registerUndoStep(PassRefPtr<WebCore::UndoStep>) final; |
| void registerRedoStep(PassRefPtr<WebCore::UndoStep>) final; |
| void clearUndoRedoOperations() final; |
| |
| bool canCopyCut(WebCore::Frame*, bool defaultValue) const final; |
| bool canPaste(WebCore::Frame*, bool defaultValue) const final; |
| bool canUndo() const final; |
| bool canRedo() const final; |
| |
| void undo() final; |
| void redo() final; |
| |
| void handleKeyboardEvent(WebCore::KeyboardEvent*) final; |
| void handleInputMethodKeydown(WebCore::KeyboardEvent*) final; |
| |
| void textFieldDidBeginEditing(WebCore::Element*) final; |
| void textFieldDidEndEditing(WebCore::Element*) final; |
| void textDidChangeInTextField(WebCore::Element*) final; |
| bool doTextFieldCommandFromEvent(WebCore::Element*, WebCore::KeyboardEvent*) final; |
| void textWillBeDeletedInTextField(WebCore::Element*) final; |
| void textDidChangeInTextArea(WebCore::Element*) final; |
| void overflowScrollPositionChanged() final; |
| |
| TextCheckerClient* textChecker() final { return this; } |
| |
| bool shouldEraseMarkersAfterChangeSelection(WebCore::TextCheckingType) const final; |
| void ignoreWordInSpellDocument(const String&) final; |
| void learnWord(const String&) final; |
| void checkSpellingOfString(StringView, int* misspellingLocation, int* misspellingLength) final; |
| String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord) final; |
| void checkGrammarOfString(StringView, Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) final; |
| |
| void updateSpellingUIWithGrammarString(const String&, const WebCore::GrammarDetail&) final; |
| void updateSpellingUIWithMisspelledWord(const String&) final; |
| void showSpellingUI(bool show) final; |
| bool spellingUIIsShowing() final; |
| void getGuessesForWord(const String& word, const String& context, const WebCore::VisibleSelection& currentSelection, Vector<String>& guesses) final; |
| void willSetInputMethodState() final; |
| void setInputMethodState(bool enabled) final; |
| void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>, const WebCore::VisibleSelection& currentSelection) final; |
| |
| bool supportsGlobalSelection() final; |
| }; |
| |
| } |