Hook up request and show for typing candidates in WK1
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Dec 2015 20:37:03 +0000 (20:37 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Dec 2015 20:37:03 +0000 (20:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151831
-and corresponding-
<rdar://problem/23751214>

Reviewed by Enrica Casucci.

Source/WebCore:

New SPI that is needed.
* WebCore.xcodeproj/project.pbxproj:
* platform/spi/mac/NSSpellCheckerSPI.h: Added.

Request candidates for editable content whenever selection changes.
* editing/Editor.cpp:
(WebCore::Editor::respondToChangedSelection):

Implement requestCandidatesForSelection on the EditorClient.
* loader/EmptyClients.h:
* page/EditorClient.h:
(WebCore::EditorClient::requestCandidatesForSelection):

Source/WebKit/mac:

Add member variables to WebEditorClient. One is a WeakPtrFactory for the
asynchronous handlers, and the other caches the VisibleSelection at the time
candidates were requested so that we can make sure the candidates are still
valid once we receive them.
* WebCoreSupport/WebEditorClient.h:
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::WebEditorClient):

Call [NSSpellChecker requestCandidatesForSelectedRange] with the appropriate
parameters.
(WebEditorClient::requestCandidatesForSelection):

Two helpers to compute information that we need for both of the handlers
below.
(candidateRangeForSelection):
(candidateWouldReplaceText):

In this handler, we just need to call [NSSpellChecker showCandidates] with
the appropriate parameters.
(WebEditorClient::handleRequestedCandidates):

Once a candidate is accepted, it should be inserted in the right way.
(WebEditorClient::handleAcceptedCandidate):

Source/WebKit2:

Empty client for now.
* WebProcess/WebCoreSupport/WebEditorClient.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@193645 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/editing/Editor.cpp
Source/WebCore/loader/EmptyClients.h
Source/WebCore/page/EditorClient.h
Source/WebCore/platform/spi/mac/NSSpellCheckerSPI.h [new file with mode: 0644]
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebEditorClient.h
Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h

index 5e96e7d..9359e6e 100644 (file)
@@ -1,3 +1,25 @@
+2015-12-07  Beth Dakin  <bdakin@apple.com>
+
+        Hook up request and show for typing candidates in WK1
+        https://bugs.webkit.org/show_bug.cgi?id=151831
+        -and corresponding-
+        <rdar://problem/23751214>
+
+        Reviewed by Enrica Casucci.
+
+        New SPI that is needed.
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/spi/mac/NSSpellCheckerSPI.h: Added.
+
+        Request candidates for editable content whenever selection changes.
+        * editing/Editor.cpp:
+        (WebCore::Editor::respondToChangedSelection):
+
+        Implement requestCandidatesForSelection on the EditorClient.
+        * loader/EmptyClients.h:
+        * page/EditorClient.h:
+        (WebCore::EditorClient::requestCandidatesForSelection):
+
 2015-12-07  Brady Eidson  <beidson@apple.com>
 
         Modern IDB: Fix "old versions" when upgrading databases.
index b1c1ddd..d805deb 100644 (file)
                933A14AA0B7D1D0900A53FFD /* DOMTextEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 933A14A90B7D1D0900A53FFD /* DOMTextEvent.mm */; };
                933A14B80B7D1D5200A53FFD /* JSTextEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 933A14B60B7D1D5200A53FFD /* JSTextEvent.cpp */; };
                933A14B90B7D1D5200A53FFD /* JSTextEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 933A14B70B7D1D5200A53FFD /* JSTextEvent.h */; };
+               933C7A751C0FBC440034FB97 /* NSSpellCheckerSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 933C7A741C0FBC440034FB97 /* NSSpellCheckerSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9343CB8112F25E510033C5EE /* TextCodecUTF8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9343CB7F12F25E510033C5EE /* TextCodecUTF8.cpp */; };
                9343CB8212F25E510033C5EE /* TextCodecUTF8.h in Headers */ = {isa = PBXBuildFile; fileRef = 9343CB8012F25E510033C5EE /* TextCodecUTF8.h */; };
                93442C9E0D2B335C00338FF9 /* HTMLTableRowsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 93442C9D0D2B335C00338FF9 /* HTMLTableRowsCollection.h */; };
                933A14A90B7D1D0900A53FFD /* DOMTextEvent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMTextEvent.mm; sourceTree = "<group>"; };
                933A14B60B7D1D5200A53FFD /* JSTextEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTextEvent.cpp; sourceTree = "<group>"; };
                933A14B70B7D1D5200A53FFD /* JSTextEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTextEvent.h; sourceTree = "<group>"; };
+               933C7A741C0FBC440034FB97 /* NSSpellCheckerSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSSpellCheckerSPI.h; sourceTree = "<group>"; };
                9343CB7F12F25E510033C5EE /* TextCodecUTF8.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextCodecUTF8.cpp; sourceTree = "<group>"; };
                9343CB8012F25E510033C5EE /* TextCodecUTF8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCodecUTF8.h; sourceTree = "<group>"; };
                93442C9D0D2B335C00338FF9 /* HTMLTableRowsCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLTableRowsCollection.h; sourceTree = "<group>"; };
                                F40EA8AA1B867D6500CE5581 /* NSScrollingInputFilterSPI.h */,
                                2DCB837719F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h */,
                                2DCB837819F99BBA00A7FBE4 /* NSSharingServiceSPI.h */,
+                               933C7A741C0FBC440034FB97 /* NSSpellCheckerSPI.h */,
                                2D77AC281BF2B9860072470A /* NSTextFinderSPI.h */,
                                2D77AC2C1BF2B9A00072470A /* NSViewSPI.h */,
                                2D0CF8161BCF5DE1007A4937 /* NSWindowSPI.h */,
                                83C1D430178D5AB500141E68 /* SVGPathSegLinetoHorizontalAbs.h in Headers */,
                                83C1D431178D5AB500141E68 /* SVGPathSegLinetoHorizontalRel.h in Headers */,
                                83C1D432178D5AB500141E68 /* SVGPathSegLinetoRel.h in Headers */,
+                               933C7A751C0FBC440034FB97 /* NSSpellCheckerSPI.h in Headers */,
                                B2227A7D0D00BF220071B782 /* SVGPathSegLinetoVertical.h in Headers */,
                                83C1D433178D5AB500141E68 /* SVGPathSegLinetoVerticalAbs.h in Headers */,
                                83C1D434178D5AB500141E68 /* SVGPathSegLinetoVerticalRel.h in Headers */,
index ca2b267..757ed83 100644 (file)
@@ -3264,6 +3264,11 @@ void Editor::respondToChangedSelection(const VisibleSelection&, FrameSelection::
     if (client())
         client()->respondToChangedSelection(&m_frame);
 
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+    if (client() && canEdit())
+        client()->requestCandidatesForSelection(m_frame.selection().selection());
+#endif
+
 #if ENABLE(TELEPHONE_NUMBER_DETECTION) && !PLATFORM(IOS)
     if (shouldDetectTelephoneNumbers())
         m_telephoneNumberDetectionUpdateTimer.startOneShot(0);
index eb944b2..1629ec5 100644 (file)
@@ -537,6 +537,10 @@ public:
     virtual void willSetInputMethodState() override { }
     virtual void setInputMethodState(bool) override { }
 
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+    virtual void requestCandidatesForSelection(const VisibleSelection&) override { }
+#endif
+
 private:
     EmptyTextCheckerClient m_textCheckerClient;
 };
index 3c53a53..eea62e2 100644 (file)
@@ -186,6 +186,10 @@ public:
     // Support for global selections, used on platforms like the X Window System that treat
     // selection as a type of clipboard.
     virtual bool supportsGlobalSelection() { return false; }
+
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+    virtual void requestCandidatesForSelection(const VisibleSelection&) = 0;
+#endif
 };
 
 }
diff --git a/Source/WebCore/platform/spi/mac/NSSpellCheckerSPI.h b/Source/WebCore/platform/spi/mac/NSSpellCheckerSPI.h
new file mode 100644 (file)
index 0000000..ba84d0d
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2015 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+#ifndef NSSpellCheckerSPI_h
+#define NSSpellCheckerSPI_h
+
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+
+// FIXME: This header should include system headers when possible.
+
+@interface NSSpellChecker ()
+- (NSInteger)requestCandidatesForSelectedRange:(NSRange)selectedRange inString:(NSString *)stringToCheck types:(NSTextCheckingTypes)checkingTypes options:(NSDictionary<NSString *, id> *)options inSpellDocumentWithTag:(NSInteger)tag completionHandler:(void (^)(NSInteger sequenceNumber, NSArray<NSTextCheckingResult *> *candidates))completionHandler;
+- (void)showCandidates:(NSArray<NSTextCheckingResult *> *)candidates forString:(NSString *)string inRect:(NSRect)rectOfTypedString view:(NSView *)view completionHandler:(void (^)(NSTextCheckingResult *acceptedCandidate))completionBlock;
+@end
+
+#endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 102000
+
+#endif // NSSpellCheckerSPI_h
index fa13c9a..33520d1 100644 (file)
@@ -1,3 +1,36 @@
+2015-12-07  Beth Dakin  <bdakin@apple.com>
+
+        Hook up request and show for typing candidates in WK1
+        https://bugs.webkit.org/show_bug.cgi?id=151831
+        -and corresponding-
+        <rdar://problem/23751214>
+
+        Reviewed by Enrica Casucci.
+
+        Add member variables to WebEditorClient. One is a WeakPtrFactory for the 
+        asynchronous handlers, and the other caches the VisibleSelection at the time 
+        candidates were requested so that we can make sure the candidates are still 
+        valid once we receive them.
+        * WebCoreSupport/WebEditorClient.h:
+        * WebCoreSupport/WebEditorClient.mm:
+        (WebEditorClient::WebEditorClient):
+
+        Call [NSSpellChecker requestCandidatesForSelectedRange] with the appropriate 
+        parameters.
+        (WebEditorClient::requestCandidatesForSelection):
+
+        Two helpers to compute information that we need for both of the handlers 
+        below.
+        (candidateRangeForSelection):
+        (candidateWouldReplaceText):
+
+        In this handler, we just need to call [NSSpellChecker showCandidates] with 
+        the appropriate parameters.
+        (WebEditorClient::handleRequestedCandidates):
+
+        Once a candidate is accepted, it should be inserted in the right way.
+        (WebEditorClient::handleAcceptedCandidate):
+
 2015-12-03  Jer Noble  <jer.noble@apple.com>
 
         Expose WebCore's InvisibleAutoplayNotPermitted setting to WebKit & WebKit2
index 46fd709..921f79b 100644 (file)
 
 #import <WebCore/EditorClient.h>
 #import <WebCore/TextCheckerClient.h>
+#import <WebCore/VisibleSelection.h>
 #import <wtf/Forward.h>
 #import <wtf/RetainPtr.h>
 #import <wtf/Vector.h>
+#import <wtf/WeakPtr.h>
 #import <wtf/text/StringView.h>
 
 #if PLATFORM(IOS)
@@ -167,6 +169,12 @@ private:
     virtual void setInputMethodState(bool enabled) override;
     virtual void requestCheckingOfString(PassRefPtr<WebCore::TextCheckingRequest>) override;
 
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+    virtual void requestCandidatesForSelection(const WebCore::VisibleSelection&) override;
+    void handleRequestedCandidates(NSInteger, NSArray<NSTextCheckingResult *> *);
+    void handleAcceptedCandidate(NSTextCheckingResult *);
+#endif
+
     void registerUndoOrRedoStep(PassRefPtr<WebCore::UndoStep>, bool isRedo);
 
     WebView *m_webView;
@@ -177,6 +185,10 @@ private:
     bool m_delayingContentChangeNotifications;
     bool m_hasDelayedContentChangeNotification;
 #endif
+
+    WebCore::VisibleSelection m_lastSelectionForRequestedCandidates;
+
+    WeakPtrFactory<WebEditorClient> m_weakPtrFactory;
 };
 
 #if PLATFORM(COCOA)
index b91ad9e..d92e6e9 100644 (file)
 #import <WebCore/ArchiveResource.h>
 #import <WebCore/Document.h>
 #import <WebCore/DocumentFragment.h>
+#import <WebCore/Editor.h>
+#import <WebCore/FloatQuad.h>
+#import <WebCore/Frame.h>
+#import <WebCore/FrameView.h>
 #import <WebCore/HTMLInputElement.h>
 #import <WebCore/HTMLNames.h>
 #import <WebCore/HTMLTextAreaElement.h>
 #import <WebCore/KeyboardEvent.h>
 #import <WebCore/LegacyWebArchive.h>
+#import <WebCore/NSSpellCheckerSPI.h>
 #import <WebCore/Page.h>
 #import <WebCore/PlatformKeyboardEvent.h>
 #import <WebCore/Settings.h>
 #import <WebCore/SpellChecker.h>
 #import <WebCore/StyleProperties.h>
+#import <WebCore/TextIterator.h>
 #import <WebCore/UndoStep.h>
 #import <WebCore/UserTypingGestureIndicator.h>
+#import <WebCore/VisibleUnits.h>
 #import <WebCore/WebCoreObjCExtras.h>
 #import <runtime/InitializeThreading.h>
 #import <wtf/MainThread.h>
@@ -189,6 +196,7 @@ WebEditorClient::WebEditorClient(WebView *webView)
     , m_delayingContentChangeNotifications(0)
     , m_hasDelayedContentChangeNotification(0)
 #endif
+    , m_weakPtrFactory(this)
 {
 }
 
@@ -1103,6 +1111,114 @@ void WebEditorClient::setInputMethodState(bool)
 {
 }
 
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+void WebEditorClient::requestCandidatesForSelection(const VisibleSelection& selection)
+{
+    RefPtr<Range> selectedRange = selection.toNormalizedRange();
+    if (!selectedRange)
+        return;
+
+    m_lastSelectionForRequestedCandidates = selection;
+
+    VisiblePosition selectionStart = selection.visibleStart();
+    VisiblePosition selectionEnd = selection.visibleEnd();
+
+    // Use the surrounding paragraphs of text as context.
+    VisiblePosition paragraphStart = startOfParagraph(selectionStart);
+    VisiblePosition paragraphEnd = endOfParagraph(selectionEnd);
+
+    int lengthToSelectionStart = TextIterator::rangeLength(makeRange(paragraphStart, selectionStart).get());
+    int lengthToSelectionEnd = TextIterator::rangeLength(makeRange(paragraphStart, selectionEnd).get());
+    NSRange rangeForCandidates = NSMakeRange(lengthToSelectionStart, lengthToSelectionEnd - lengthToSelectionStart);
+
+    String fullPlainTextStringOfParagraph = plainText(makeRange(paragraphStart, paragraphEnd).get());
+
+    NSTextCheckingTypes checkingTypes = NSTextCheckingTypeSpelling | NSTextCheckingTypeReplacement | NSTextCheckingTypeCorrection;
+    auto weakEditor = m_weakPtrFactory.createWeakPtr();
+    [[NSSpellChecker sharedSpellChecker] requestCandidatesForSelectedRange:rangeForCandidates inString:fullPlainTextStringOfParagraph types:checkingTypes options:nil inSpellDocumentWithTag:spellCheckerDocumentTag() completionHandler:[weakEditor](NSInteger sequenceNumber, NSArray<NSTextCheckingResult *> *candidates) {
+        dispatch_async(dispatch_get_main_queue(), ^{
+            if (!weakEditor)
+                return;
+            weakEditor->handleRequestedCandidates(sequenceNumber, candidates);
+        });
+    }];
+}
+
+static RefPtr<Range> candidateRangeForSelection(const VisibleSelection& selection, Frame* frame)
+{
+    return selection.isCaret() ? wordRangeFromPosition(selection.start()) : frame->selection().toNormalizedRange();
+}
+
+static bool candidateWouldReplaceText(const VisibleSelection& selection)
+{
+    // If the character behind the caret in the current selection is anything but a space or a newline then we should
+    // replace the whole current word with the candidate.
+    UChar32 characterAfterSelection, characterBeforeSelection, twoCharacterBeforeSelection = 0;
+    charactersAroundPosition(selection.visibleStart(), characterAfterSelection, characterBeforeSelection, twoCharacterBeforeSelection);
+    return !(characterBeforeSelection == '\0' || characterBeforeSelection == '\n' || characterBeforeSelection == ' ');
+}
+
+void WebEditorClient::handleRequestedCandidates(NSInteger sequenceNumber, NSArray<NSTextCheckingResult *> *candidates)
+{
+    Frame* frame = core([m_webView _selectedOrMainFrame]);
+    if (!frame)
+        return;
+
+    const VisibleSelection& selection = frame->selection().selection();
+    if (selection != m_lastSelectionForRequestedCandidates)
+        return;
+
+    RefPtr<Range> rangeForCurrentlyTypedString = candidateRangeForSelection(selection, frame);
+    NSString *currentlyTypedString;
+    if (rangeForCurrentlyTypedString && candidateWouldReplaceText(selection))
+        currentlyTypedString = plainText(rangeForCurrentlyTypedString.get());
+    else
+        currentlyTypedString = @"";
+
+    RefPtr<Range> selectedRange = frame->selection().selection().toNormalizedRange();
+    if (!selectedRange)
+        return;
+
+    IntRect rectForSelectionCandidates;
+    Vector<FloatQuad> quads;
+    selectedRange->absoluteTextQuads(quads);
+    if (!quads.isEmpty())
+        rectForSelectionCandidates = frame->view()->contentsToWindow(quads[0].enclosingBoundingBox());
+
+    auto weakEditor = m_weakPtrFactory.createWeakPtr();
+    [[NSSpellChecker sharedSpellChecker] showCandidates:candidates forString:currentlyTypedString inRect:rectForSelectionCandidates view:m_webView completionHandler:[weakEditor](NSTextCheckingResult *acceptedCandidate) {
+        dispatch_async(dispatch_get_main_queue(), ^{
+            if (!weakEditor)
+                return;
+            weakEditor->handleAcceptedCandidate(acceptedCandidate);
+        });
+    }];
+
+}
+
+void WebEditorClient::handleAcceptedCandidate(NSTextCheckingResult *acceptedCandidate)
+{
+    Frame* frame = core([m_webView _selectedOrMainFrame]);
+    if (!frame)
+        return;
+
+    const VisibleSelection& selection = frame->selection().selection();
+    if (selection != m_lastSelectionForRequestedCandidates)
+        return;
+
+    RefPtr<Range> candidateRange = candidateRangeForSelection(selection, frame);
+
+    frame->editor().setIgnoreCompositionSelectionChange(true);
+
+    if (candidateWouldReplaceText(selection))
+        frame->selection().setSelectedRange(candidateRange.get(), UPSTREAM, true);
+
+    frame->editor().insertText(acceptedCandidate.replacementString, 0);
+    frame->editor().insertText(String(" "), 0);
+    frame->editor().setIgnoreCompositionSelectionChange(false);
+}
+#endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+
 #if !PLATFORM(IOS)
 @interface WebEditorSpellCheckResponder : NSObject
 {
index f7ee9ac..7c6f191 100644 (file)
@@ -1,3 +1,15 @@
+2015-12-07  Beth Dakin  <bdakin@apple.com>
+
+        Hook up request and show for typing candidates in WK1
+        https://bugs.webkit.org/show_bug.cgi?id=151831
+        -and corresponding-
+        <rdar://problem/23751214>
+
+        Reviewed by Enrica Casucci.
+
+        Empty client for now.
+        * WebProcess/WebCoreSupport/WebEditorClient.h:
+
 2015-12-07  Philippe Normand  <pnormand@igalia.com>
 
         [GTK][Mac] socketpair assertion failure
index 395347a..71c24f8 100644 (file)
@@ -149,6 +149,11 @@ private:
     virtual void willSetInputMethodState() override;
     virtual void setInputMethodState(bool enabled) override;
     virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>) override;
+
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+    virtual void requestCandidatesForSelection(const WebCore::VisibleSelection&) override { }
+#endif
+
 #if PLATFORM(GTK)
     virtual bool shouldShowUnicodeMenu() override;
 #endif