Bug 1759504 - Put the text recognition UI behind an experimental feature r=emilio,nordzilla,fluent-reviewers,preferences-reviewers,flod

Differential Revision: https://phabricator.services.mozilla.com/D146829
This commit is contained in:
Greg Tatum 2022-06-02 14:31:43 +00:00
Родитель 9011e6d570
Коммит d3d55f9e6b
4 изменённых файлов: 30 добавлений и 2 удалений

Просмотреть файл

@ -590,8 +590,11 @@ class nsContextMenu {
// Copy image location depends on whether we're on an image.
this.showItem("context-copyimage", this.onImage || showBGImage);
// Performing text recognition only works on images.
this.showItem("context-imagetext", this.onImage);
// Performing text recognition only works on images, and if the feature is enabled.
this.showItem(
"context-imagetext",
this.onImage && TEXT_RECOGNITION_ENABLED
);
// Send media URL (but not for canvas, since it's a big data: URL)
this.showItem("context-sendimage", this.onImage || showBGImage);
@ -2378,3 +2381,10 @@ XPCOMUtils.defineLazyPreferenceGetter(
"layout.forms.reveal-password-context-menu.enabled",
false
);
XPCOMUtils.defineLazyPreferenceGetter(
this,
"TEXT_RECOGNITION_ENABLED",
"dom.text-recognition.enabled",
false
);

Просмотреть файл

@ -188,6 +188,9 @@ pref("dom.keyboardevent.keypress.hack.use_legacy_keycode_and_charcode.addl", "")
// explanation for the detail.
pref("dom.mouseevent.click.hack.use_legacy_non-primary_dispatch", "");
// Enable experimental text recognition features for supported OSes.
pref("dom.text-recognition.enabled", false);
// Fastback caching - if this pref is negative, then we calculate the number
// of content viewers to cache based on the amount of available memory.
pref("browser.sessionhistory.max_total_viewers", -1);

Просмотреть файл

@ -122,3 +122,13 @@ type = "boolean"
bug-numbers = [1673971]
is-public = true
default-value = false
[text-recognition]
title = "experimental-features-text-recognition"
description = "experimental-features-text-recognition-description"
preference = "dom.text-recognition.enabled"
restart-required = false
type = "boolean"
bug-numbers = [1759199]
is-public = {default = false, "nightly,mac" = true}
default-value = false

Просмотреть файл

@ -72,3 +72,8 @@ experimental-features-js-warp-description = Enable Warp, a project to improve Ja
experimental-features-ime-search =
.label = Address Bar: show results during IME composition
experimental-features-ime-search-description = An IME (Input Method Editor) is a tool that allows you to enter complex symbols, such as those used in East Asian or Indic written languages, using a standard keyboard. Enabling this experiment will keep the address bar panel open, showing search results and suggestions, while using IME to input text. Note that the IME might display a panel that covers the address bar results, therefore this preference is only suggested for IME not using this type of panel.
# Text recognition for images
experimental-features-text-recognition =
.label = Text Recognition
experimental-features-text-recognition-description = Enable features to recognize text in images.