Title: [295408] trunk/Source
Revision
295408
Author
megan_gard...@apple.com
Date
2022-06-08 18:42:15 -0700 (Wed, 08 Jun 2022)

Log Message

Rename MAC_CATALYST_GRAMMAR_CHECKING to ENABLE_POST_EDITING_GRAMMAR_CHECKING for clarity.
https://bugs.webkit.org/show_bug.cgi?id=241434

Reviewed by Tim Horton.

After upstreaming, change the name of this flag, and also have it in open source for clarity.

* Source/WTF/wtf/PlatformEnableCocoa.h:
* Source/WebCore/editing/Editor.cpp:
(WebCore::Editor::markMisspellingsAfterTypingToWord):
(WebCore::Editor::markAndReplaceFor):
* Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm:
(WebCore::grammarColor):
* Source/WebKit/Platform/spi/ios/UIKitSPI.h:
* Source/WebKit/UIProcess/ios/TextCheckerIOS.mm:
(WebKit::mutableState):
(WebKit::TextChecker::setGrammarCheckingEnabled):
(WebKit::TextChecker::checkTextOfParagraph):

Canonical link: https://commits.webkit.org/251414@main

Modified Paths

Diff

Modified: trunk/Source/WTF/wtf/PlatformEnableCocoa.h (295407 => 295408)


--- trunk/Source/WTF/wtf/PlatformEnableCocoa.h	2022-06-09 00:55:13 UTC (rev 295407)
+++ trunk/Source/WTF/wtf/PlatformEnableCocoa.h	2022-06-09 01:42:15 UTC (rev 295408)
@@ -481,6 +481,11 @@
 #define ENABLE_POINTER_LOCK 0
 #endif
 
+
+#if !defined(ENABLE_POST_EDITING_GRAMMAR_CHECKING) && ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 130000) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 160000))
+#define ENABLE_POST_EDITING_GRAMMAR_CHECKING 1
+#endif
+
 #if !defined(ENABLE_PREVIEW_CONVERTER) && PLATFORM(IOS)
 #define ENABLE_PREVIEW_CONVERTER 1
 #endif

Modified: trunk/Source/WebCore/editing/Editor.cpp (295407 => 295408)


--- trunk/Source/WebCore/editing/Editor.cpp	2022-06-09 00:55:13 UTC (rev 295407)
+++ trunk/Source/WebCore/editing/Editor.cpp	2022-06-09 01:42:15 UTC (rev 295408)
@@ -2546,7 +2546,7 @@
     auto adjacentWords = VisibleSelection(startOfWord(wordStart, LeftWordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary));
     auto adjacentWordRange = adjacentWords.toNormalizedRange();
 
-#if ENABLE(MAC_CATALYST_GRAMMAR_CHECKING)
+#if ENABLE(POST_EDITING_GRAMMAR_CHECKING)
     if (isGrammarCheckingEnabled()) {
         textCheckingOptions.add(TextCheckingType::Grammar);
         textCheckingOptions.add(TextCheckingType::Correction);
@@ -2879,7 +2879,7 @@
 
         bool resultRangeIsAcceptableForReplacement = automaticReplacementStartLocation <= resultEndLocation && resultEndLocation <= automaticReplacementEndLocation;
         // In this case the result range just has to touch the automatic replacement range, so we can handle replacing non-word text such as punctuation.
-#if ENABLE(MAC_CATALYST_GRAMMAR_CHECKING)
+#if ENABLE(POST_EDITING_GRAMMAR_CHECKING)
         if (!resultRangeIsAcceptableForReplacement && shouldCheckForCorrection && resultType == TextCheckingType::Correction)
             resultRangeIsAcceptableForReplacement = results[i].details.size() > 0;
         if (!resultRangeIsAcceptableForReplacement && shouldMarkGrammar && shouldCheckForCorrection && resultType == TextCheckingType::Correction) {
@@ -2934,7 +2934,7 @@
 
             String replacedString = plainText(rangeToReplace);
             bool existingMarkersPermitReplacement = m_alternativeTextController->processMarkersOnTextToBeReplacedByResult(results[i], rangeToReplace, replacedString);
-#if ENABLE(MAC_CATALYST_GRAMMAR_CHECKING)
+#if ENABLE(POST_EDITING_GRAMMAR_CHECKING)
             if (!existingMarkersPermitReplacement && shouldCheckForCorrection && resultType == TextCheckingType::Correction)
                 existingMarkersPermitReplacement = results[i].details.size() > 0;
 #endif

Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm (295407 => 295408)


--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm	2022-06-09 00:55:13 UTC (rev 295407)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm	2022-06-09 01:42:15 UTC (rev 295408)
@@ -63,7 +63,7 @@
 
 static RetainPtr<CGColorRef> grammarColor(bool useDarkMode)
 {
-#if ENABLE(MAC_CATALYST_GRAMMAR_CHECKING)
+#if ENABLE(POST_EDITING_GRAMMAR_CHECKING)
     static bool useBlueForGrammar = false;
     static std::once_flag flag;
     std::call_once(flag, [] {

Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (295407 => 295408)


--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2022-06-09 00:55:13 UTC (rev 295407)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2022-06-09 01:42:15 UTC (rev 295408)
@@ -1545,7 +1545,7 @@
 @end
 #endif
 
-#if ENABLE(MAC_CATALYST_GRAMMAR_CHECKING)
+#if ENABLE(POST_EDITING_GRAMMAR_CHECKING)
 @interface UITextChecker ()
 + (BOOL)grammarCheckingEnabled;
 - (NSArray<NSTextCheckingResult *> *)checkString:(NSString *)stringToCheck range:(NSRange)range types:(NSTextCheckingTypes)checkingTypes languages:(NSArray<NSString *> *)languagesArray options:(NSDictionary<NSString *, id> *)options;

Modified: trunk/Source/WebKit/UIProcess/ios/TextCheckerIOS.mm (295407 => 295408)


--- trunk/Source/WebKit/UIProcess/ios/TextCheckerIOS.mm	2022-06-09 00:55:13 UTC (rev 295407)
+++ trunk/Source/WebKit/UIProcess/ios/TextCheckerIOS.mm	2022-06-09 01:42:15 UTC (rev 295408)
@@ -46,7 +46,7 @@
     static NeverDestroyed state = [] {
         TextCheckerState initialState;
         initialState.isContinuousSpellCheckingEnabled = TextChecker::isContinuousSpellCheckingAllowed();
-#if ENABLE(MAC_CATALYST_GRAMMAR_CHECKING)
+#if ENABLE(POST_EDITING_GRAMMAR_CHECKING)
         initialState.isGrammarCheckingEnabled = [UITextChecker respondsToSelector:@selector(grammarCheckingEnabled)] && [UITextChecker grammarCheckingEnabled];
 #else
         initialState.isGrammarCheckingEnabled = false;
@@ -81,7 +81,7 @@
 
 void TextChecker::setGrammarCheckingEnabled(bool isGrammarCheckingEnabled)
 {
-#if ENABLE(MAC_CATALYST_GRAMMAR_CHECKING)
+#if ENABLE(POST_EDITING_GRAMMAR_CHECKING)
     if (state().isGrammarCheckingEnabled == isGrammarCheckingEnabled)
         return;
 
@@ -222,7 +222,7 @@
     auto stringToCheck = text.createNSStringWithoutCopying();
     auto range = NSMakeRange(0, [stringToCheck length]);
 
-#if ENABLE(MAC_CATALYST_GRAMMAR_CHECKING)
+#if ENABLE(POST_EDITING_GRAMMAR_CHECKING)
     if ([textChecker respondsToSelector:@selector(checkString:range:types:languages:options:)]) {
         NSTextCheckingTypes types = 0;
         if (checkingTypes.contains(TextCheckingType::Spelling))
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to