Delete abandoned flag for replace text API for diacritics.
Bug: b/279670207,1443726 Change-Id: Icf5979c935b6632c6b06cb697b7032bef4aac42d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5869374 Reviewed-by: John Palmer <jopalmer@chromium.org> Commit-Queue: Darren Shen <shend@chromium.org> Cr-Commit-Position: refs/heads/main@{#1383309}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
31542941da
commit
1210a3a823
ash/constants
chrome/browser
about_flags.ccflag_descriptions.ccflag_descriptions.h
ash
input_method
autocorrect_manager_unittest.ccemoji_suggester.ccemoji_suggester_unittest.ccfake_suggestion_handler.ccfake_suggestion_handler.hgrammar_manager_unittest.ccinput_method_engine.ccinput_method_engine.hinput_method_engine_unittest.cclongpress_control_v_suggester.cclongpress_diacritics_suggester.ccsuggestion_handler_interface.h
@ -571,12 +571,6 @@ BASE_FEATURE(kDiacriticsOnPhysicalKeyboardLongpressDefaultOn,
|
||||
"DiacriticsOnPhysicalKeyboardLongpressDefaultOn",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
||||
// When enabled, diacritics on longpress will use |ReplaceSurroundingText| API,
|
||||
// which is atomic and compatible with more apps.
|
||||
BASE_FEATURE(kDiacriticsUseReplaceSurroundingText,
|
||||
"DiacriticsUseReplaceSurroundingText",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
||||
// Disables hardware requirement checks for Bruschetta installer, allowing for
|
||||
// more easy development against changes of said requirements.
|
||||
BASE_FEATURE(kDisableBruschettaInstallChecks,
|
||||
|
@ -5785,16 +5785,6 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
flag_descriptions::kAutocorrectByDefaultName,
|
||||
flag_descriptions::kAutocorrectByDefaultDescription, kOsCrOS,
|
||||
FEATURE_VALUE_TYPE(ash::features::kAutocorrectByDefault)},
|
||||
{"enable-cros-autocorrect-use-replace-surrounding-text",
|
||||
flag_descriptions::kAutocorrectUseReplaceSurroundingTextName,
|
||||
flag_descriptions::kAutocorrectUseReplaceSurroundingTextDescription,
|
||||
kOsCrOS,
|
||||
FEATURE_VALUE_TYPE(ash::features::kAutocorrectUseReplaceSurroundingText)},
|
||||
{"enable-cros-diacritics-use-replace-surrounding-text",
|
||||
flag_descriptions::kDiacriticsUseReplaceSurroundingTextName,
|
||||
flag_descriptions::kDiacriticsUseReplaceSurroundingTextDescription,
|
||||
kOsCrOS,
|
||||
FEATURE_VALUE_TYPE(ash::features::kDiacriticsUseReplaceSurroundingText)},
|
||||
{"enable-cros-first-party-vietnamese-input",
|
||||
flag_descriptions::kFirstPartyVietnameseInputName,
|
||||
flag_descriptions::kFirstPartyVietnameseInputDescription, kOsCrOS,
|
||||
|
@ -496,7 +496,6 @@ class MockSuggestionHandler : public SuggestionHandlerInterface {
|
||||
(int context_id,
|
||||
const std::u16string& candidate,
|
||||
size_t delete_previous_utf16_len,
|
||||
bool use_replace_surrounding_text,
|
||||
std::string* error),
|
||||
(override));
|
||||
MOCK_METHOD(bool,
|
||||
|
@ -325,8 +325,7 @@ bool EmojiSuggester::AcceptSuggestion(size_t index) {
|
||||
std::string error;
|
||||
suggestion_handler_->AcceptSuggestionCandidate(
|
||||
*focused_context_id_, candidates_[index],
|
||||
/* delete_previous_utf16_len=*/0, /*use_replace_surrounding_text=*/false,
|
||||
&error);
|
||||
/* delete_previous_utf16_len=*/0, &error);
|
||||
|
||||
if (!error.empty()) {
|
||||
LOG(ERROR) << "Failed to accept suggestion. " << error;
|
||||
|
@ -107,7 +107,6 @@ class TestSuggestionHandler : public SuggestionHandlerInterface {
|
||||
bool AcceptSuggestionCandidate(int context_id,
|
||||
const std::u16string& candidate,
|
||||
size_t delete_previous_utf16_len,
|
||||
bool use_replace_surrounding_text,
|
||||
std::string* error) override {
|
||||
return false;
|
||||
}
|
||||
|
@ -68,7 +68,6 @@ bool FakeSuggestionHandler::AcceptSuggestionCandidate(
|
||||
int context_id,
|
||||
const std::u16string& candidate,
|
||||
size_t delete_previous_utf16_len,
|
||||
bool use_replace_surrounding_text,
|
||||
std::string* error) {
|
||||
showing_suggestion_ = false;
|
||||
accepted_suggestion_ = true;
|
||||
|
@ -41,7 +41,6 @@ class FakeSuggestionHandler : public SuggestionHandlerInterface {
|
||||
bool AcceptSuggestionCandidate(int context_id,
|
||||
const std::u16string& candidate,
|
||||
size_t delete_previous_utf16_len,
|
||||
bool use_replace_surrounding_text,
|
||||
std::string* error) override;
|
||||
bool SetAssistiveWindowProperties(
|
||||
int context_id,
|
||||
|
@ -96,7 +96,6 @@ class MockSuggestionHandler : public SuggestionHandlerInterface {
|
||||
(int context_id,
|
||||
const std::u16string& candidate,
|
||||
size_t delete_previous_utf16_len,
|
||||
bool use_replace_surrounding_text,
|
||||
std::string* error),
|
||||
(override));
|
||||
MOCK_METHOD(bool,
|
||||
|
@ -713,7 +713,6 @@ bool InputMethodEngine::AcceptSuggestionCandidate(
|
||||
int context_id,
|
||||
const std::u16string& suggestion,
|
||||
size_t delete_previous_utf16_len,
|
||||
bool use_replace_surrounding_text,
|
||||
std::string* error) {
|
||||
if (!IsActive()) {
|
||||
*error = kErrorNotActive;
|
||||
@ -724,35 +723,14 @@ bool InputMethodEngine::AcceptSuggestionCandidate(
|
||||
return false;
|
||||
}
|
||||
|
||||
if (use_replace_surrounding_text) {
|
||||
if (delete_previous_utf16_len) {
|
||||
if (base::expected<void, Error> result = ReplaceSurroundingText(
|
||||
context_id_, delete_previous_utf16_len, 0, suggestion);
|
||||
!result.has_value()) {
|
||||
switch (result.error()) {
|
||||
case Error::kInputMethodNotActive:
|
||||
*error = kErrorNotActive;
|
||||
return false;
|
||||
case Error::kIncorrectContextId:
|
||||
*error = base::StringPrintf(
|
||||
"%s request context id = %d, current context id = %d",
|
||||
kErrorWrongContext, context_id, context_id_);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CommitText(context_id, suggestion, error);
|
||||
}
|
||||
} else {
|
||||
if (delete_previous_utf16_len) {
|
||||
DeleteSurroundingText(context_id_,
|
||||
-static_cast<int>(delete_previous_utf16_len),
|
||||
delete_previous_utf16_len, error);
|
||||
}
|
||||
|
||||
CommitText(context_id, suggestion, error);
|
||||
if (delete_previous_utf16_len) {
|
||||
DeleteSurroundingText(context_id_,
|
||||
-static_cast<int>(delete_previous_utf16_len),
|
||||
delete_previous_utf16_len, error);
|
||||
}
|
||||
|
||||
CommitText(context_id, suggestion, error);
|
||||
|
||||
IMEAssistiveWindowHandlerInterface* aw_handler =
|
||||
IMEBridge::Get()->GetAssistiveWindowHandler();
|
||||
if (aw_handler) {
|
||||
|
@ -269,7 +269,6 @@ class InputMethodEngine : virtual public TextInputMethod,
|
||||
bool AcceptSuggestionCandidate(int context_id,
|
||||
const std::u16string& candidate,
|
||||
size_t delete_previous_utf16_len,
|
||||
bool use_replace_surrounding_text,
|
||||
std::string* error) override;
|
||||
bool SetAssistiveWindowProperties(
|
||||
int context_id,
|
||||
|
@ -393,7 +393,6 @@ TEST_F(InputMethodEngineTest, AcceptSuggestionCandidateCommitsCandidate) {
|
||||
|
||||
std::string error;
|
||||
engine_->AcceptSuggestionCandidate(context, u"suggestion", 0,
|
||||
/*use_replace_surrounding_text=*/false,
|
||||
&error);
|
||||
|
||||
EXPECT_EQ("", error);
|
||||
@ -402,27 +401,6 @@ TEST_F(InputMethodEngineTest, AcceptSuggestionCandidateCommitsCandidate) {
|
||||
EXPECT_EQ(u"suggestion", mock_ime_input_context_handler_->last_commit_text());
|
||||
}
|
||||
|
||||
TEST_F(InputMethodEngineTest,
|
||||
AcceptSuggestionCandidateReplacesSurroundingText) {
|
||||
CreateEngine(true);
|
||||
Focus(ui::TEXT_INPUT_TYPE_TEXT);
|
||||
engine_->Enable(kTestImeComponentId);
|
||||
|
||||
const int context = engine_->GetContextIdForTesting();
|
||||
|
||||
std::string error;
|
||||
engine_->AcceptSuggestionCandidate(context, u"suggestion", 3,
|
||||
/*use_replace_surrounding_text=*/true,
|
||||
&error);
|
||||
|
||||
EXPECT_EQ("", error);
|
||||
const auto& arg =
|
||||
mock_ime_input_context_handler_->last_replace_surrounding_text_arg();
|
||||
EXPECT_EQ(3u, arg.length_before_selection);
|
||||
EXPECT_EQ(0u, arg.length_after_selection);
|
||||
EXPECT_EQ(u"suggestion", arg.replacement_text);
|
||||
}
|
||||
|
||||
TEST_F(InputMethodEngineTest,
|
||||
AcceptSuggestionCandidateDeletesSurroundingAndCommitsCandidate) {
|
||||
CreateEngine(true);
|
||||
@ -434,7 +412,6 @@ TEST_F(InputMethodEngineTest,
|
||||
std::string error;
|
||||
engine_->CommitText(context, u"text", &error);
|
||||
engine_->AcceptSuggestionCandidate(context, u"suggestion", 1,
|
||||
/*use_replace_surrounding_text=*/false,
|
||||
&error);
|
||||
|
||||
EXPECT_EQ("", error);
|
||||
|
@ -67,9 +67,6 @@ bool LongpressControlVSuggester::AcceptSuggestion(size_t index) {
|
||||
suggestion_handler_->AcceptSuggestionCandidate(
|
||||
*focused_context_id_, /*candidate=*/u"",
|
||||
/*delete_previous_utf16_len=*/pasted_text_end - *pasted_text_start_,
|
||||
/*use_replace_surrounding_text=*/
|
||||
base::FeatureList::IsEnabled(
|
||||
features::kDiacriticsUseReplaceSurroundingText),
|
||||
&error);
|
||||
if (!error.empty()) {
|
||||
LOG(ERROR) << "suggest: Accepted long-press Ctrl+V suggestion without "
|
||||
|
@ -281,10 +281,7 @@ bool LongpressDiacriticsSuggester::AcceptSuggestion(size_t index) {
|
||||
std::string error;
|
||||
suggestion_handler_->AcceptSuggestionCandidate(
|
||||
*focused_context_id_, current_suggestions[index],
|
||||
/* delete_previous_utf16_len=*/1, /*use_replace_surrounding_text=*/
|
||||
base::FeatureList::IsEnabled(
|
||||
features::kDiacriticsUseReplaceSurroundingText),
|
||||
&error);
|
||||
/* delete_previous_utf16_len=*/1, &error);
|
||||
if (error.empty()) {
|
||||
suggestion_handler_->Announce(
|
||||
l10n_util::GetStringUTF16(IDS_SUGGESTION_DIACRITICS_INSERTED));
|
||||
|
@ -55,7 +55,6 @@ class SuggestionHandlerInterface {
|
||||
virtual bool AcceptSuggestionCandidate(int context_id,
|
||||
const std::u16string& candidate,
|
||||
size_t delete_previous_utf16_len,
|
||||
bool use_replace_surrounding_text,
|
||||
std::string* error) = 0;
|
||||
|
||||
// Shows/Hides given assistive window. No-op if context_id doesn't match or
|
||||
|
@ -6874,12 +6874,6 @@ const char kHelpAppOpensInsteadOfReleaseNotesNotificationDescription[] =
|
||||
"Enables opening the Help App's What's New page immediately instead of "
|
||||
"showing a notification to open the help app.";
|
||||
|
||||
const char kDiacriticsUseReplaceSurroundingTextName[] =
|
||||
"Use ReplaceSurroundingText API for longpress diacritics.";
|
||||
const char kDiacriticsUseReplaceSurroundingTextDescription[] =
|
||||
"When longpress diacritics is enabled, use the ReplaceSurroundingText API "
|
||||
"for better app compatibility.";
|
||||
|
||||
const char kHoldingSpaceSuggestionsName[] = "Enable holding space suggestions";
|
||||
const char kHoldingSpaceSuggestionsDescription[] =
|
||||
"Enables pinned file suggestions in holding space to help the user "
|
||||
|
@ -3974,9 +3974,6 @@ extern const char kHelpAppOnboardingRevampDescription[];
|
||||
extern const char kHelpAppOpensInsteadOfReleaseNotesNotificationName[];
|
||||
extern const char kHelpAppOpensInsteadOfReleaseNotesNotificationDescription[];
|
||||
|
||||
extern const char kDiacriticsUseReplaceSurroundingTextName[];
|
||||
extern const char kDiacriticsUseReplaceSurroundingTextDescription[];
|
||||
|
||||
extern const char kHoldingSpaceSuggestionsName[];
|
||||
extern const char kHoldingSpaceSuggestionsDescription[];
|
||||
|
||||
|
Reference in New Issue
Block a user