Title: [198547] trunk/Source
Revision
198547
Author
[email protected]
Date
2016-03-22 13:21:28 -0700 (Tue, 22 Mar 2016)

Log Message

Advanced spell checking should be guarded behind 
HAVE(ADVANCED_SPELL_CHECKING)
https://bugs.webkit.org/show_bug.cgi?id=155738

Reviewed by Geoff Garen.

Source/WebCore:

* config.h:
(WebCore::ScrollableArea::systemLanguageIsRTL):
* platform/spi/mac/NSSpellCheckerSPI.h:

Source/WebKit/mac:

* WebCoreSupport/WebEditorClient.mm:
(insertionPointFromCurrentSelection):
(WebEditorClient::checkTextOfParagraph):
(WebEditorClient::getGuessesForWord):
(WebEditorClient::requestCandidatesForSelection):
(WebEditorClient::handleRequestedCandidates):
(WebEditorClient::requestCheckingOfString):
* WebKitPrefix.h:
* WebView/WebHTMLView.mm:
(-[WebHTMLView insertText:]):

Source/WebKit2:

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::requestCandidatesForSelectionIfNeeded):
(WebKit::WebViewImpl::handleRequestedCandidates):
(WebKit::WebViewImpl::insertText):
* UIProcess/mac/TextCheckerMac.mm:
(WebKit::TextChecker::checkTextOfParagraph):
(WebKit::TextChecker::getGuessesForWord):
* config.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (198546 => 198547)


--- trunk/Source/WebCore/ChangeLog	2016-03-22 19:39:38 UTC (rev 198546)
+++ trunk/Source/WebCore/ChangeLog	2016-03-22 20:21:28 UTC (rev 198547)
@@ -1,3 +1,15 @@
+2016-03-22  Beth Dakin  <[email protected]>
+
+        Advanced spell checking should be guarded behind 
+        HAVE(ADVANCED_SPELL_CHECKING)
+        https://bugs.webkit.org/show_bug.cgi?id=155738
+
+        Reviewed by Geoff Garen.
+
+        * config.h:
+        (WebCore::ScrollableArea::systemLanguageIsRTL):
+        * platform/spi/mac/NSSpellCheckerSPI.h:
+
 2016-03-22  Nan Wang  <[email protected]>
 
         AX: Change "dialog" role description to "web dialog" so users can distinguish from native alerts

Modified: trunk/Source/WebCore/config.h (198546 => 198547)


--- trunk/Source/WebCore/config.h	2016-03-22 19:39:38 UTC (rev 198546)
+++ trunk/Source/WebCore/config.h	2016-03-22 20:21:28 UTC (rev 198547)
@@ -130,3 +130,6 @@
 
 #endif
 
+#if USE(APPLE_INTERNAL_SDK)
+#include <WebKitAdditions/WebKitAdditionsDefines.h>
+#endif

Modified: trunk/Source/WebCore/platform/spi/mac/NSSpellCheckerSPI.h (198546 => 198547)


--- trunk/Source/WebCore/platform/spi/mac/NSSpellCheckerSPI.h	2016-03-22 19:39:38 UTC (rev 198546)
+++ trunk/Source/WebCore/platform/spi/mac/NSSpellCheckerSPI.h	2016-03-22 20:21:28 UTC (rev 198547)
@@ -25,7 +25,7 @@
 #ifndef NSSpellCheckerSPI_h
 #define NSSpellCheckerSPI_h
 
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+#if HAVE(ADVANCED_SPELL_CHECKING)
 
 // FIXME: This header should include system headers when possible.
 
@@ -37,6 +37,6 @@
 + (BOOL)isAutomaticTextCompletionEnabled;
 @end
 
-#endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 102000
+#endif // HAVE(ADVANCED_SPELL_CHECKING)
 
 #endif // NSSpellCheckerSPI_h

Modified: trunk/Source/WebKit/mac/ChangeLog (198546 => 198547)


--- trunk/Source/WebKit/mac/ChangeLog	2016-03-22 19:39:38 UTC (rev 198546)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-03-22 20:21:28 UTC (rev 198547)
@@ -1,3 +1,22 @@
+2016-03-22  Beth Dakin  <[email protected]>
+
+        Advanced spell checking should be guarded behind 
+        HAVE(ADVANCED_SPELL_CHECKING)
+        https://bugs.webkit.org/show_bug.cgi?id=155738
+
+        Reviewed by Geoff Garen.
+
+        * WebCoreSupport/WebEditorClient.mm:
+        (insertionPointFromCurrentSelection):
+        (WebEditorClient::checkTextOfParagraph):
+        (WebEditorClient::getGuessesForWord):
+        (WebEditorClient::requestCandidatesForSelection):
+        (WebEditorClient::handleRequestedCandidates):
+        (WebEditorClient::requestCheckingOfString):
+        * WebKitPrefix.h:
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView insertText:]):
+
 2016-03-20  Dan Bernstein  <[email protected]>
 
         [Mac] Determine TARGET_MAC_OS_X_VERSION_MAJOR from MACOSX_DEPLOYMENT_TARGET rather than from MAC_OS_X_VERSION_MAJOR

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm (198546 => 198547)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm	2016-03-22 19:39:38 UTC (rev 198546)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm	2016-03-22 20:21:28 UTC (rev 198547)
@@ -1050,7 +1050,7 @@
     return results;
 }
 
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+#if HAVE(ADVANCED_SPELL_CHECKING)
 static int insertionPointFromCurrentSelection(const VisibleSelection& currentSelection)
 {
     VisiblePosition selectionStart = currentSelection.visibleStart();
@@ -1062,7 +1062,7 @@
 Vector<TextCheckingResult> WebEditorClient::checkTextOfParagraph(StringView string, TextCheckingTypeMask checkingTypes, const VisibleSelection& currentSelection)
 {
     NSDictionary *options = nil;
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+#if HAVE(ADVANCED_SPELL_CHECKING)
     options = @{ NSTextCheckingInsertionPointKey :  [NSNumber numberWithUnsignedInteger:insertionPointFromCurrentSelection(currentSelection)] };
 #endif
     return core([[NSSpellChecker sharedSpellChecker] checkString:string.createNSStringWithoutCopying().get() range:NSMakeRange(0, string.length()) types:(checkingTypes | NSTextCheckingTypeOrthography) options:options inSpellDocumentWithTag:spellCheckerDocumentTag() orthography:NULL wordCount:NULL], checkingTypes);
@@ -1108,7 +1108,7 @@
     NSOrthography* orthography = nil;
     NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker];
     NSDictionary *options = nil;
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+#if HAVE(ADVANCED_SPELL_CHECKING)
     options = @{ NSTextCheckingInsertionPointKey :  [NSNumber numberWithUnsignedInteger:insertionPointFromCurrentSelection(currentSelection)] };
 #endif
     if (context.length()) {
@@ -1145,6 +1145,7 @@
 
     m_lastSelectionForRequestedCandidates = selection;
 
+#if HAVE(ADVANCED_SPELL_CHECKING)
     VisiblePosition selectionStart = selection.visibleStart();
     VisiblePosition selectionEnd = selection.visibleEnd();
     VisiblePosition paragraphStart = startOfParagraph(selectionStart);
@@ -1164,6 +1165,7 @@
             weakEditor->handleRequestedCandidates(sequenceNumber, candidates);
         });
     }];
+#endif // HAVE(ADVANCED_SPELL_CHECKING)
 }
 
 void WebEditorClient::handleRequestedCandidates(NSInteger sequenceNumber, NSArray<NSTextCheckingResult *> *candidates)
@@ -1296,7 +1298,7 @@
     NSRange range = NSMakeRange(0, m_textCheckingRequest->data().text().length());
     NSRunLoop* currentLoop = [NSRunLoop currentRunLoop];
     NSDictionary *options = nil;
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+#if HAVE(ADVANCED_SPELL_CHECKING)
     options = @{ NSTextCheckingInsertionPointKey :  [NSNumber numberWithUnsignedInteger:insertionPointFromCurrentSelection(currentSelection)] };
 #endif
     [[NSSpellChecker sharedSpellChecker] requestCheckingOfString:m_textCheckingRequest->data().text() range:range types:NSTextCheckingAllSystemTypes options:options inSpellDocumentWithTag:0 completionHandler:^(NSInteger, NSArray* results, NSOrthography*, NSInteger) {

Modified: trunk/Source/WebKit/mac/WebKitPrefix.h (198546 => 198547)


--- trunk/Source/WebKit/mac/WebKitPrefix.h	2016-03-22 19:39:38 UTC (rev 198546)
+++ trunk/Source/WebKit/mac/WebKitPrefix.h	2016-03-22 20:21:28 UTC (rev 198547)
@@ -92,3 +92,7 @@
 #endif
 
 #include <wtf/DisallowCType.h>
+
+#if USE(APPLE_INTERNAL_SDK)
+#include <WebKitAdditions/WebKitAdditionsDefines.h>
+#endif

Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (198546 => 198547)


--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2016-03-22 19:39:38 UTC (rev 198546)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2016-03-22 20:21:28 UTC (rev 198547)
@@ -7145,7 +7145,7 @@
         return;
 
     BOOL needToRemoveSoftSpace = NO;
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+#if HAVE(ADVANCED_SPELL_CHECKING)
     if (_private->softSpaceRange.location != NSNotFound && (replacementRange.location == NSMaxRange(_private->softSpaceRange) || replacementRange.location == NSNotFound) && !replacementRange.length && [[NSSpellChecker sharedSpellChecker] deletesAutospaceBeforeString:text language:nil]) {
         replacementRange = _private->softSpaceRange;
         needToRemoveSoftSpace = YES;

Modified: trunk/Source/WebKit2/ChangeLog (198546 => 198547)


--- trunk/Source/WebKit2/ChangeLog	2016-03-22 19:39:38 UTC (rev 198546)
+++ trunk/Source/WebKit2/ChangeLog	2016-03-22 20:21:28 UTC (rev 198547)
@@ -1,3 +1,20 @@
+2016-03-22  Beth Dakin  <[email protected]>
+
+        Advanced spell checking should be guarded behind 
+        HAVE(ADVANCED_SPELL_CHECKING)
+        https://bugs.webkit.org/show_bug.cgi?id=155738
+
+        Reviewed by Geoff Garen.
+
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::requestCandidatesForSelectionIfNeeded):
+        (WebKit::WebViewImpl::handleRequestedCandidates):
+        (WebKit::WebViewImpl::insertText):
+        * UIProcess/mac/TextCheckerMac.mm:
+        (WebKit::TextChecker::checkTextOfParagraph):
+        (WebKit::TextChecker::getGuessesForWord):
+        * config.h:
+
 2016-03-22  Chris Dumez  <[email protected]>
 
         Add a setting to let the client toggle support for network cache speculative validation

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm (198546 => 198547)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm	2016-03-22 19:39:38 UTC (rev 198546)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm	2016-03-22 20:21:28 UTC (rev 198547)
@@ -2146,6 +2146,7 @@
     auto& postLayoutData = editorState.postLayoutData();
     m_lastStringForCandidateRequest = postLayoutData.stringForCandidateRequest;
 
+#if HAVE(ADVANCED_SPELL_CHECKING)
     NSRange rangeForCandidates = NSMakeRange(postLayoutData.candidateRequestStartPosition, postLayoutData.selectedTextLength);
     NSTextCheckingTypes checkingTypes = NSTextCheckingTypeSpelling | NSTextCheckingTypeReplacement | NSTextCheckingTypeCorrection;
     auto weakThis = createWeakPtr();
@@ -2156,6 +2157,7 @@
             weakThis->handleRequestedCandidates(sequenceNumber, candidates);
         });
     }];
+#endif // HAVE(ADVANCED_SPELL_CHECKING)
 }
 
 void WebViewImpl::handleRequestedCandidates(NSInteger sequenceNumber, NSArray<NSTextCheckingResult *> *candidates)
@@ -3515,7 +3517,7 @@
         text = string;
 
     BOOL needToRemoveSoftSpace = NO;
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+#if HAVE(ADVANCED_SPELL_CHECKING)
     if (m_softSpaceRange.location != NSNotFound && (replacementRange.location == NSMaxRange(m_softSpaceRange) || replacementRange.location == NSNotFound) && replacementRange.length == 0 && [[NSSpellChecker sharedSpellChecker] deletesAutospaceBeforeString:text language:nil]) {
         replacementRange = m_softSpaceRange;
         needToRemoveSoftSpace = YES;

Modified: trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm (198546 => 198547)


--- trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm	2016-03-22 19:39:38 UTC (rev 198546)
+++ trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm	2016-03-22 20:21:28 UTC (rev 198547)
@@ -297,7 +297,7 @@
 
     RetainPtr<NSString> textString = text.createNSStringWithoutCopying();
     NSDictionary *options = nil;
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+#if HAVE(ADVANCED_SPELL_CHECKING)
     options = @{ NSTextCheckingInsertionPointKey :  [NSNumber numberWithUnsignedInteger:insertionPoint] };
 #endif
     NSArray *incomingResults = [[NSSpellChecker sharedSpellChecker] checkString:textString.get()
@@ -436,7 +436,7 @@
     NSOrthography* orthography = nil;
     NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker];
     NSDictionary *options = nil;
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+#if HAVE(ADVANCED_SPELL_CHECKING)
     options = @{ NSTextCheckingInsertionPointKey :  [NSNumber numberWithUnsignedInteger:insertionPoint] };
 #endif
     if (context.length()) {

Modified: trunk/Source/WebKit2/config.h (198546 => 198547)


--- trunk/Source/WebKit2/config.h	2016-03-22 19:39:38 UTC (rev 198546)
+++ trunk/Source/WebKit2/config.h	2016-03-22 20:21:28 UTC (rev 198547)
@@ -129,3 +129,7 @@
 #define HAVE_LINK_PREVIEW 0
 #endif
 #endif
+
+#if USE(APPLE_INTERNAL_SDK)
+#include <WebKitAdditions/WebKitAdditionsDefines.h>
+#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to