Title: [240181] trunk/Source
Revision
240181
Author
timothy_hor...@apple.com
Date
2019-01-18 15:15:56 -0800 (Fri, 18 Jan 2019)

Log Message

Get rid of ADVANCED_SPELL_CHECKING
https://bugs.webkit.org/show_bug.cgi?id=193592

Reviewed by Wenson Hsieh.

Source/WebCore/PAL:

* pal/spi/mac/NSSpellCheckerSPI.h:
It's always true on macOS, and all but one use of it is already inside PLATFORM(MAC)

Source/WebKit:

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

Source/WebKitLegacy/mac:

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

Source/WTF:

* wtf/Platform.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (240180 => 240181)


--- trunk/Source/WTF/ChangeLog	2019-01-18 23:09:38 UTC (rev 240180)
+++ trunk/Source/WTF/ChangeLog	2019-01-18 23:15:56 UTC (rev 240181)
@@ -1,3 +1,12 @@
+2019-01-18  Tim Horton  <timothy_hor...@apple.com>
+
+        Get rid of ADVANCED_SPELL_CHECKING
+        https://bugs.webkit.org/show_bug.cgi?id=193592
+
+        Reviewed by Wenson Hsieh.
+
+        * wtf/Platform.h:
+
 2019-01-18  Jer Noble  <jer.no...@apple.com>
 
         SDK_VARIANT build destinations should be separate from non-SDK_VARIANT builds

Modified: trunk/Source/WTF/wtf/Platform.h (240180 => 240181)


--- trunk/Source/WTF/wtf/Platform.h	2019-01-18 23:09:38 UTC (rev 240180)
+++ trunk/Source/WTF/wtf/Platform.h	2019-01-18 23:15:56 UTC (rev 240181)
@@ -1340,7 +1340,6 @@
 
 #if PLATFORM(MAC)
 #define HAVE_TOUCH_BAR 1
-#define HAVE_ADVANCED_SPELL_CHECKING 1
 #define USE_DICTATION_ALTERNATIVES 1
 
 #if defined(__LP64__)

Modified: trunk/Source/WebCore/PAL/ChangeLog (240180 => 240181)


--- trunk/Source/WebCore/PAL/ChangeLog	2019-01-18 23:09:38 UTC (rev 240180)
+++ trunk/Source/WebCore/PAL/ChangeLog	2019-01-18 23:15:56 UTC (rev 240181)
@@ -1,3 +1,13 @@
+2019-01-18  Tim Horton  <timothy_hor...@apple.com>
+
+        Get rid of ADVANCED_SPELL_CHECKING
+        https://bugs.webkit.org/show_bug.cgi?id=193592
+
+        Reviewed by Wenson Hsieh.
+
+        * pal/spi/mac/NSSpellCheckerSPI.h:
+        It's always true on macOS, and all but one use of it is already inside PLATFORM(MAC)
+
 2019-01-18  Jer Noble  <jer.no...@apple.com>
 
         SDK_VARIANT build destinations should be separate from non-SDK_VARIANT builds

Modified: trunk/Source/WebCore/PAL/pal/spi/mac/NSSpellCheckerSPI.h (240180 => 240181)


--- trunk/Source/WebCore/PAL/pal/spi/mac/NSSpellCheckerSPI.h	2019-01-18 23:09:38 UTC (rev 240180)
+++ trunk/Source/WebCore/PAL/pal/spi/mac/NSSpellCheckerSPI.h	2019-01-18 23:15:56 UTC (rev 240181)
@@ -31,18 +31,12 @@
 
 #else
 
-#if HAVE(ADVANCED_SPELL_CHECKING)
 extern NSString *NSTextCheckingInsertionPointKey;
-#endif
-
 extern NSString *NSTextCheckingSuppressInitialCapitalizationKey;
 
 @interface NSSpellChecker ()
 
-#if HAVE(ADVANCED_SPELL_CHECKING)
 - (BOOL)deletesAutospaceBeforeString:(NSString *)string language:(NSString *)language;
-#endif
-
 - (void)_preflightChosenSpellServer;
 
 @end

Modified: trunk/Source/WebKit/ChangeLog (240180 => 240181)


--- trunk/Source/WebKit/ChangeLog	2019-01-18 23:09:38 UTC (rev 240180)
+++ trunk/Source/WebKit/ChangeLog	2019-01-18 23:15:56 UTC (rev 240181)
@@ -1,3 +1,17 @@
+2019-01-18  Tim Horton  <timothy_hor...@apple.com>
+
+        Get rid of ADVANCED_SPELL_CHECKING
+        https://bugs.webkit.org/show_bug.cgi?id=193592
+
+        Reviewed by Wenson Hsieh.
+
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::requestCandidatesForSelectionIfNeeded):
+        (WebKit::WebViewImpl::insertText):
+        * UIProcess/mac/TextCheckerMac.mm:
+        (WebKit::TextChecker::checkTextOfParagraph):
+        (WebKit::TextChecker::getGuessesForWord):
+
 2019-01-18  Chris Dumez  <cdu...@apple.com>
 
         Regression(PSON) Content blockers are sometimes lost on back navigation cross-site

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (240180 => 240181)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2019-01-18 23:09:38 UTC (rev 240180)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2019-01-18 23:15:56 UTC (rev 240181)
@@ -3229,7 +3229,6 @@
     auto& postLayoutData = editorState.postLayoutData();
     m_lastStringForCandidateRequest = postLayoutData.stringForCandidateRequest;
 
-#if HAVE(ADVANCED_SPELL_CHECKING)
     NSRange selectedRange = NSMakeRange(postLayoutData.candidateRequestStartPosition, postLayoutData.selectedTextLength);
     NSTextCheckingTypes checkingTypes = NSTextCheckingTypeSpelling | NSTextCheckingTypeReplacement | NSTextCheckingTypeCorrection;
     auto weakThis = makeWeakPtr(*this);
@@ -3240,7 +3239,6 @@
             weakThis->handleRequestedCandidates(sequenceNumber, candidates);
         });
     }];
-#endif // HAVE(ADVANCED_SPELL_CHECKING)
 }
 
 void WebViewImpl::handleRequestedCandidates(NSInteger sequenceNumber, NSArray<NSTextCheckingResult *> *candidates)
@@ -4756,12 +4754,10 @@
         text = string;
 
     m_isTextInsertionReplacingSoftSpace = false;
-#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;
         m_isTextInsertionReplacingSoftSpace = true;
     }
-#endif
     m_softSpaceRange = NSMakeRange(NSNotFound, 0);
 
     // insertText can be called for several reasons:

Modified: trunk/Source/WebKit/UIProcess/mac/TextCheckerMac.mm (240180 => 240181)


--- trunk/Source/WebKit/UIProcess/mac/TextCheckerMac.mm	2019-01-18 23:09:38 UTC (rev 240180)
+++ trunk/Source/WebKit/UIProcess/mac/TextCheckerMac.mm	2019-01-18 23:15:56 UTC (rev 240181)
@@ -321,15 +321,10 @@
     Vector<TextCheckingResult> results;
 
     RetainPtr<NSString> textString = text.createNSStringWithoutCopying();
-    NSDictionary *options = nil;
-#if HAVE(ADVANCED_SPELL_CHECKING)
-    options = @{
+    NSDictionary *options = @{
         NSTextCheckingInsertionPointKey : @(insertionPoint),
         NSTextCheckingSuppressInitialCapitalizationKey : @(!initialCapitalizationEnabled)
     };
-#else
-    options = @{ NSTextCheckingSuppressInitialCapitalizationKey : @(!initialCapitalizationEnabled) };
-#endif
     NSArray *incomingResults = [[NSSpellChecker sharedSpellChecker] checkString:textString.get()
                                                                           range:NSMakeRange(0, text.length())
                                                                           types:nsTextCheckingTypes(checkingTypes) | NSTextCheckingTypeOrthography
@@ -465,15 +460,10 @@
     NSString* language = nil;
     NSOrthography* orthography = nil;
     NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker];
-    NSDictionary *options = nil;
-#if HAVE(ADVANCED_SPELL_CHECKING)
-    options = @{
+    NSDictionary *options = @{
         NSTextCheckingInsertionPointKey : @(insertionPoint),
         NSTextCheckingSuppressInitialCapitalizationKey : @(!initialCapitalizationEnabled)
     };
-#else
-    options = @{ NSTextCheckingSuppressInitialCapitalizationKey : @(!initialCapitalizationEnabled) };
-#endif
     if (context.length()) {
         [checker checkString:context range:NSMakeRange(0, context.length()) types:NSTextCheckingTypeOrthography options:options inSpellDocumentWithTag:spellDocumentTag orthography:&orthography wordCount:0];
         language = [checker languageForWordRange:NSMakeRange(0, context.length()) inString:context orthography:orthography];

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (240180 => 240181)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2019-01-18 23:09:38 UTC (rev 240180)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2019-01-18 23:15:56 UTC (rev 240181)
@@ -1,3 +1,19 @@
+2019-01-18  Tim Horton  <timothy_hor...@apple.com>
+
+        Get rid of ADVANCED_SPELL_CHECKING
+        https://bugs.webkit.org/show_bug.cgi?id=193592
+
+        Reviewed by Wenson Hsieh.
+
+        * WebCoreSupport/WebEditorClient.mm:
+        (insertionPointFromCurrentSelection):
+        (WebEditorClient::checkTextOfParagraph):
+        (WebEditorClient::getGuessesForWord):
+        (WebEditorClient::requestCandidatesForSelection):
+        (WebEditorClient::requestCheckingOfString):
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView insertText:]):
+
 2019-01-18  Jer Noble  <jer.no...@apple.com>
 
         SDK_VARIANT build destinations should be separate from non-SDK_VARIANT builds

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm (240180 => 240181)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm	2019-01-18 23:09:38 UTC (rev 240180)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm	2019-01-18 23:15:56 UTC (rev 240181)
@@ -1032,7 +1032,6 @@
     return results;
 }
 
-#if HAVE(ADVANCED_SPELL_CHECKING)
 static int insertionPointFromCurrentSelection(const VisibleSelection& currentSelection)
 {
     VisiblePosition selectionStart = currentSelection.visibleStart();
@@ -1039,14 +1038,10 @@
     VisiblePosition paragraphStart = startOfParagraph(selectionStart);
     return TextIterator::rangeLength(makeRange(paragraphStart, selectionStart).get());
 }
-#endif
 
 Vector<TextCheckingResult> WebEditorClient::checkTextOfParagraph(StringView string, OptionSet<TextCheckingType> coreCheckingTypes, const VisibleSelection& currentSelection)
 {
-    NSDictionary *options = nil;
-#if HAVE(ADVANCED_SPELL_CHECKING)
-    options = @{ NSTextCheckingInsertionPointKey :  [NSNumber numberWithUnsignedInteger:insertionPointFromCurrentSelection(currentSelection)] };
-#endif
+    NSDictionary *options = @{ NSTextCheckingInsertionPointKey :  [NSNumber numberWithUnsignedInteger:insertionPointFromCurrentSelection(currentSelection)] };
     return core([[NSSpellChecker sharedSpellChecker] checkString:string.createNSStringWithoutCopying().get() range:NSMakeRange(0, string.length()) types:(nsTextCheckingTypes(coreCheckingTypes) | NSTextCheckingTypeOrthography) options:options inSpellDocumentWithTag:spellCheckerDocumentTag() orthography:NULL wordCount:NULL], coreCheckingTypes);
 }
 
@@ -1089,10 +1084,7 @@
     NSString* language = nil;
     NSOrthography* orthography = nil;
     NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker];
-    NSDictionary *options = nil;
-#if HAVE(ADVANCED_SPELL_CHECKING)
-    options = @{ NSTextCheckingInsertionPointKey :  [NSNumber numberWithUnsignedInteger:insertionPointFromCurrentSelection(currentSelection)] };
-#endif
+    NSDictionary *options = @{ NSTextCheckingInsertionPointKey :  [NSNumber numberWithUnsignedInteger:insertionPointFromCurrentSelection(currentSelection)] };
     if (context.length()) {
         [checker checkString:context range:NSMakeRange(0, context.length()) types:NSTextCheckingTypeOrthography options:options inSpellDocumentWithTag:spellCheckerDocumentTag() orthography:&orthography wordCount:0];
         language = [checker languageForWordRange:NSMakeRange(0, context.length()) inString:context orthography:orthography];
@@ -1135,7 +1127,6 @@
 
     m_lastSelectionForRequestedCandidates = selection;
 
-#if HAVE(ADVANCED_SPELL_CHECKING)
     VisiblePosition selectionStart = selection.visibleStart();
     VisiblePosition selectionEnd = selection.visibleEnd();
     VisiblePosition paragraphStart = startOfParagraph(selectionStart);
@@ -1155,7 +1146,6 @@
             weakEditor->handleRequestedCandidates(sequenceNumber, candidates);
         });
     }];
-#endif // HAVE(ADVANCED_SPELL_CHECKING)
 }
 
 void WebEditorClient::handleRequestedCandidates(NSInteger sequenceNumber, NSArray<NSTextCheckingResult *> *candidates)
@@ -1267,10 +1257,7 @@
     int sequence = m_textCheckingRequest->data().sequence();
     NSRange range = NSMakeRange(0, m_textCheckingRequest->data().text().length());
     NSRunLoop* currentLoop = [NSRunLoop currentRunLoop];
-    NSDictionary *options = nil;
-#if HAVE(ADVANCED_SPELL_CHECKING)
-    options = @{ NSTextCheckingInsertionPointKey :  [NSNumber numberWithUnsignedInteger:insertionPointFromCurrentSelection(currentSelection)] };
-#endif
+    NSDictionary *options = @{ NSTextCheckingInsertionPointKey :  [NSNumber numberWithUnsignedInteger:insertionPointFromCurrentSelection(currentSelection)] };
     [[NSSpellChecker sharedSpellChecker] requestCheckingOfString:m_textCheckingRequest->data().text() range:range types:NSTextCheckingAllSystemTypes options:options inSpellDocumentWithTag:0 completionHandler:^(NSInteger, NSArray* results, NSOrthography*, NSInteger) {
             [currentLoop performSelector:@selector(perform) 
                                   target:[[[WebEditorSpellCheckResponder alloc] initWithClient:this sequence:sequence results:results] autorelease]

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm (240180 => 240181)


--- trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm	2019-01-18 23:09:38 UTC (rev 240180)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm	2019-01-18 23:15:56 UTC (rev 240181)
@@ -6712,13 +6712,11 @@
         return;
 
     BOOL needToRemoveSoftSpace = NO;
-#if HAVE(ADVANCED_SPELL_CHECKING)
+#if PLATFORM(MAC)
     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;
     }
-#endif
-#if PLATFORM(MAC)
     _private->softSpaceRange = NSMakeRange(NSNotFound, 0);
 #endif
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to