Title: [295376] trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm
Revision
295376
Author
[email protected]
Date
2022-06-07 22:20:39 -0700 (Tue, 07 Jun 2022)

Log Message

Upstream iOS grammar checking.
https://bugs.webkit.org/show_bug.cgi?id=241388

Reviewed by Wenson Hsieh and Tim Horton.

Upstream work for grammar checking colors for iOS.

* Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm:
(WebCore::grammarColor):

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

Modified Paths

Diff

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


--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm	2022-06-08 04:45:04 UTC (rev 295375)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm	2022-06-08 05:20:39 UTC (rev 295376)
@@ -60,14 +60,20 @@
 // NSColor, NSBezierPath, and NSGraphicsContext calls do not raise exceptions
 // so we don't block exceptions.
 
-#if USE(APPLE_INTERNAL_SDK)
-#include <WebKitAdditions/GraphicsContextCocoa.mm>
-#else
 static RetainPtr<CGColorRef> grammarColor(bool useDarkMode)
 {
+#if ENABLE(MAC_CATALYST_GRAMMAR_CHECKING)
+    static bool useBlueForGrammar = false;
+    static std::once_flag flag;
+    std::call_once(flag, [] {
+        useBlueForGrammar = os_feature_enabled(TextComposer, PostEditing) && os_feature_enabled(TextComposer, PostEditingUseBlueDots);
+    });
+
+    if (useBlueForGrammar)
+        return cachedCGColor(useDarkMode ? SRGBA<uint8_t> { 40, 145, 255, 217 } : SRGBA<uint8_t> { 0, 122, 255, 191 });
+#endif
     return cachedCGColor(useDarkMode ? SRGBA<uint8_t> { 50, 215, 75, 217 } : SRGBA<uint8_t> { 25, 175, 50, 191 });
 }
-#endif
 
 static bool drawFocusRingAtTime(CGContextRef context, NSTimeInterval timeOffset, const Color& color)
 {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to