Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Deprecate electron spellchecker by chromium's #244

Merged
merged 1 commit into from
Jul 12, 2017
Merged

Conversation

darkdh
Copy link
Member

@darkdh darkdh commented Jul 11, 2017

if (spellcheck) {
if (spellcheck->GetCustomDictionary()
->HasWord(base::UTF16ToUTF8(new_params.selection_text))) {
new_params.misspelled_word =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand what is happening here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used for https://github.com/brave/browser-laptop/pull/9951/files#diff-b9f459fd47114771333b78b87fac7daaR557 which provides user an option to remove added word to custom dictionary.
because if a word is in custom dictionary, we can't tell if it is correctly spelled word or in custom dictionary from ContextMenuParams. misspelled_word and dictionary_suggestions will be empty

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

per discussion on slack, we should use ContextMenuParams.properties

@@ -971,6 +989,50 @@ void WebContents::AuthorizePlugin(mate::Arguments* args) {
web_contents(), true, resource_id);
}

void WebContents::AddWord(mate::Arguments* args) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the spellcheck service is associated with the browser context, not the webcontents so this should probably be an api attached to session like autofill

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do. and this will helps for migrating old words in legacy custom dictionary.

if (SpellCheckProvider* provider =
SpellCheckProvider::Get(render_view->GetMainRenderFrame()))
provider->EnableSpellcheck(spellcheck_->IsSpellcheckEnabled());
new SpellCheckPanel(render_view);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be wrapped in #if BUILDFLAG(HAS_SPELLCHECK_PANEL) ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we should. because I was working based on cr59 and this is added in cr60.
When I pushed the commit, I just rebase the muon for our cr60 commits

Emit("context-menu", std::make_pair(params, web_contents()));
// For forgetting custom dictionary option
content::ContextMenuParams new_params(params);
if (new_params.misspelled_word.empty()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should also check to make sure selection_text is not empty

@darkdh
Copy link
Member Author

darkdh commented Jul 11, 2017

@bridiver feedback addressed!

Copy link
Collaborator

@bridiver bridiver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++ with a few small changes

if (spellcheck->GetCustomDictionary()->HasWord(selection_text)) {
new_params.properties.insert(
std::pair<std::string, std::string>
(std::string("learnedSpelling"), selection_text));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe "customDictionaryWord"?

@@ -71,36 +67,9 @@ WebFrameBindings::~WebFrameBindings() {
}

void WebFrameBindings::Invalidate() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should remove this method override

Emit("context-menu", std::make_pair(params, web_contents()));
// For forgetting custom dictionary option
content::ContextMenuParams new_params(params);
if (new_params.misspelled_word.empty() &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually we should also check is_editable and spellcheck_enabled because spellcheck only applies to editable fields. Just want to narrow this check to run as infrequently as possible

@darkdh
Copy link
Member Author

darkdh commented Jul 12, 2017

@bridiver if 3abf627 looks good to you, I will squash the commits

@bridiver
Copy link
Collaborator

lgtm. Just want to verify that this is targeted to browser-laptop 0.18? If not please update the milestone to 4.4.0

@darkdh
Copy link
Member Author

darkdh commented Jul 12, 2017

my bad.it should be in 4.4.0

@bridiver bridiver merged commit 1fd2962 into master Jul 12, 2017
@bsclifton bsclifton deleted the spellchecker branch July 13, 2017 04:58
bridiver added a commit that referenced this pull request Jul 18, 2017
Deprecate electron spellchecker by chromium's
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants