Title: [288934] trunk/Source
- Revision
- 288934
- Author
- [email protected]
- Date
- 2022-02-01 18:02:01 -0800 (Tue, 01 Feb 2022)
Log Message
The default values for a couple of Live Text-related features should respect system feature flags
https://bugs.webkit.org/show_bug.cgi?id=235980
rdar://88349726
Reviewed by Tim Horton.
Source/WebKit:
Split the extant `TextRecognitionEnhancements` feature flag into two flags: one to control enablement of the
"image analysis queue", and another to control Live Text behaviors (still referred to as "text recognition
enhancements"). Add WebKitAdditions integration points to allow the default values for these two flags to read
from system feature flags.
* Platform/cocoa/TextRecognitionUtilities.h:
* Platform/cocoa/TextRecognitionUtilities.mm:
(WebKit::textRecognitionEnhancementsSystemFeatureEnabled):
(WebKit::imageAnalysisQueueSystemFeatureEnabled):
(WebKit::isLiveTextAvailableAndEnabled):
(WebKit::isLiveTextEnabled): Deleted.
(WebKit::requestImageAnalysisWithIdentifier): Deleted.
* Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:
(WebKit::defaultTextRecognitionEnhancementsEnabled):
(WebKit::defaultImageAnalysisQueueEnabled):
* Shared/WebPreferencesDefaultValues.h:
Source/WTF:
Add a new feature flag, and add default values for both features. See WebKit/ChangeLog for more details.
* Scripts/Preferences/WebPreferencesInternal.yaml:
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (288933 => 288934)
--- trunk/Source/WTF/ChangeLog 2022-02-02 01:41:26 UTC (rev 288933)
+++ trunk/Source/WTF/ChangeLog 2022-02-02 02:02:01 UTC (rev 288934)
@@ -1,3 +1,15 @@
+2022-02-01 Wenson Hsieh <[email protected]>
+
+ The default values for a couple of Live Text-related features should respect system feature flags
+ https://bugs.webkit.org/show_bug.cgi?id=235980
+ rdar://88349726
+
+ Reviewed by Tim Horton.
+
+ Add a new feature flag, and add default values for both features. See WebKit/ChangeLog for more details.
+
+ * Scripts/Preferences/WebPreferencesInternal.yaml:
+
2022-02-01 Tim Nguyen <[email protected]>
Add setting to toggle PDF.js viewer
Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml (288933 => 288934)
--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml 2022-02-02 01:41:26 UTC (rev 288933)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml 2022-02-02 02:02:01 UTC (rev 288934)
@@ -358,6 +358,20 @@
WebKit:
default: false
+ImageAnalysisQueueEnabled:
+ type: bool
+ humanReadableName: "Image analysis queue"
+ humanReadableDescription: "Enable image analysis queue"
+ condition: ENABLE(IMAGE_ANALYSIS)
+ exposed: [ WebKit ]
+ defaultValue:
+ WebCore:
+ default: false
+ WebKitLegacy:
+ default: false
+ WebKit:
+ default: defaultImageAnalysisQueueEnabled()
+
InputTypeColorEnabled:
type: bool
humanReadableName: "Color Inputs"
@@ -837,7 +851,7 @@
WebKitLegacy:
default: false
WebKit:
- default: false
+ default: defaultTextRecognitionEnhancementsEnabled()
# FIXME: Is this implemented for WebKitLegacy? If not, this should be excluded from WebKitLegacy entirely.
UndoManagerAPIEnabled:
Modified: trunk/Source/WebKit/ChangeLog (288933 => 288934)
--- trunk/Source/WebKit/ChangeLog 2022-02-02 01:41:26 UTC (rev 288933)
+++ trunk/Source/WebKit/ChangeLog 2022-02-02 02:02:01 UTC (rev 288934)
@@ -1,3 +1,28 @@
+2022-02-01 Wenson Hsieh <[email protected]>
+
+ The default values for a couple of Live Text-related features should respect system feature flags
+ https://bugs.webkit.org/show_bug.cgi?id=235980
+ rdar://88349726
+
+ Reviewed by Tim Horton.
+
+ Split the extant `TextRecognitionEnhancements` feature flag into two flags: one to control enablement of the
+ "image analysis queue", and another to control Live Text behaviors (still referred to as "text recognition
+ enhancements"). Add WebKitAdditions integration points to allow the default values for these two flags to read
+ from system feature flags.
+
+ * Platform/cocoa/TextRecognitionUtilities.h:
+ * Platform/cocoa/TextRecognitionUtilities.mm:
+ (WebKit::textRecognitionEnhancementsSystemFeatureEnabled):
+ (WebKit::imageAnalysisQueueSystemFeatureEnabled):
+ (WebKit::isLiveTextAvailableAndEnabled):
+ (WebKit::isLiveTextEnabled): Deleted.
+ (WebKit::requestImageAnalysisWithIdentifier): Deleted.
+ * Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:
+ (WebKit::defaultTextRecognitionEnhancementsEnabled):
+ (WebKit::defaultImageAnalysisQueueEnabled):
+ * Shared/WebPreferencesDefaultValues.h:
+
2022-02-01 Tim Nguyen <[email protected]>
Add setting to toggle PDF.js viewer
Modified: trunk/Source/WebKit/Platform/cocoa/TextRecognitionUtilities.h (288933 => 288934)
--- trunk/Source/WebKit/Platform/cocoa/TextRecognitionUtilities.h 2022-02-02 01:41:26 UTC (rev 288933)
+++ trunk/Source/WebKit/Platform/cocoa/TextRecognitionUtilities.h 2022-02-02 02:02:01 UTC (rev 288934)
@@ -38,6 +38,9 @@
namespace WebKit {
bool isLiveTextAvailableAndEnabled();
+bool textRecognitionEnhancementsSystemFeatureEnabled();
+bool imageAnalysisQueueSystemFeatureEnabled();
+
WebCore::TextRecognitionResult makeTextRecognitionResult(VKImageAnalysis *);
// FIXME: Replace the return types of these helper functions with VKCImageAnalyzer and VKCImageAnalyzerRequest, respectively.
Modified: trunk/Source/WebKit/Platform/cocoa/TextRecognitionUtilities.mm (288933 => 288934)
--- trunk/Source/WebKit/Platform/cocoa/TextRecognitionUtilities.mm 2022-02-02 01:41:26 UTC (rev 288933)
+++ trunk/Source/WebKit/Platform/cocoa/TextRecognitionUtilities.mm 2022-02-02 02:02:01 UTC (rev 288934)
@@ -139,25 +139,29 @@
#include <WebKitAdditions/TextRecognitionUtilitiesAdditions.mm>
#else
-static bool isLiveTextEnabled()
+bool textRecognitionEnhancementsSystemFeatureEnabled()
{
+#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
return true;
+#else
+ return false;
+#endif
}
+bool imageAnalysisQueueSystemFeatureEnabled()
+{
#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
-
-void requestImageAnalysisWithIdentifier(VKImageAnalyzer *, const String&, CGImageRef, CompletionHandler<void(TextRecognitionResult&&)>&& completion)
-{
- completion({ });
+ return true;
+#else
+ return false;
+#endif
}
-#endif // ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
-
#endif
bool isLiveTextAvailableAndEnabled()
{
- return PAL::isVisionKitCoreFrameworkAvailable() && isLiveTextEnabled();
+ return PAL::isVisionKitCoreFrameworkAvailable();
}
} // namespace WebKit
Modified: trunk/Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm (288933 => 288934)
--- trunk/Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm 2022-02-02 01:41:26 UTC (rev 288933)
+++ trunk/Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm 2022-02-02 02:02:01 UTC (rev 288934)
@@ -28,8 +28,8 @@
#if PLATFORM(COCOA)
+#import "TextRecognitionUtilities.h"
#import <Foundation/NSBundle.h>
-
#import <pal/spi/cocoa/FeatureFlagsSPI.h>
#import <wtf/RetainPtr.h>
#import <wtf/cocoa/RuntimeApplicationChecksCocoa.h>
@@ -72,6 +72,20 @@
}
#endif
+#if ENABLE(IMAGE_ANALYSIS)
+
+bool defaultTextRecognitionEnhancementsEnabled()
+{
+ return textRecognitionEnhancementsSystemFeatureEnabled();
+}
+
+bool defaultImageAnalysisQueueEnabled()
+{
+ return imageAnalysisQueueSystemFeatureEnabled();
+}
+
+#endif // ENABLE(IMAGE_ANALYSIS)
+
} // namespace WebKit
-#endif
+#endif // PLATFORM(COCOA)
Modified: trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h (288933 => 288934)
--- trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h 2022-02-02 01:41:26 UTC (rev 288933)
+++ trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h 2022-02-02 02:02:01 UTC (rev 288934)
@@ -115,4 +115,9 @@
bool defaultScreenCaptureKitEnabled();
#endif
+#if ENABLE(IMAGE_ANALYSIS)
+bool defaultTextRecognitionEnhancementsEnabled();
+bool defaultImageAnalysisQueueEnabled();
+#endif
+
} // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes