Commit 3314ae7b authored by Alex Moshchuk's avatar Alex Moshchuk Committed by Commit Bot

Fix the spellcheck enabled setting for remote-to-local main frame navigations.

Previously, the Blink spellchecking enabled state was initialized from
ChromeContentRendererClient::RenderViewCreated(), which only did
this for RenderViews where the main frame was a local frame.

This CL moves that initialization logic into RenderFrameCreated(),
where it is applied to all main frames.  Other than being good cleanup
because RenderView is going away, this also makes it also work for
provisional main frames (i.e., when the main frame is remote and it
navigates back to a local frame).  The latter became more common
after r501081, which means that the spellcheck enabled setting wasn't
always respected after cross-process main frame navigations prior to
this fix.

Bug: 784673
Change-Id: I91851c35027715b3d0c3a6ddfc22c514806adff3
Reviewed-on: https://chromium-review.googlesource.com/794790Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#519917}
parent 138492ab
...@@ -628,7 +628,16 @@ void ChromeContentRendererClient::RenderFrameCreated( ...@@ -628,7 +628,16 @@ void ChromeContentRendererClient::RenderFrameCreated(
#endif // !defined(OS_ANDROID) #endif // !defined(OS_ANDROID)
#if BUILDFLAG(ENABLE_SPELLCHECK) #if BUILDFLAG(ENABLE_SPELLCHECK)
new SpellCheckProvider(render_frame, spellcheck_.get(), this); SpellCheckProvider* spell_check_provider =
new SpellCheckProvider(render_frame, spellcheck_.get(), this);
// TODO(xiaochengh): Design better way to sync between Chrome-side and
// Blink-side spellcheck enabled states. See crbug.com/710097.
//
// TODO(alexmos): Do this for all frames so that this works properly for
// OOPIFs. See https://crbug.com/789273.
if (render_frame->IsMainFrame())
spell_check_provider->EnableSpellcheck(spellcheck_->IsSpellcheckEnabled());
#if BUILDFLAG(HAS_SPELLCHECK_PANEL) #if BUILDFLAG(HAS_SPELLCHECK_PANEL)
new SpellCheckPanel(render_frame, registry, this); new SpellCheckPanel(render_frame, registry, this);
#endif // BUILDFLAG(HAS_SPELLCHECK_PANEL) #endif // BUILDFLAG(HAS_SPELLCHECK_PANEL)
...@@ -640,16 +649,6 @@ void ChromeContentRendererClient::RenderFrameCreated( ...@@ -640,16 +649,6 @@ void ChromeContentRendererClient::RenderFrameCreated(
void ChromeContentRendererClient::RenderViewCreated( void ChromeContentRendererClient::RenderViewCreated(
content::RenderView* render_view) { content::RenderView* render_view) {
#if BUILDFLAG(ENABLE_SPELLCHECK)
// This is a workaround keeping the behavior that, the Blink side spellcheck
// enabled state is initialized on RenderView creation.
// TODO(xiaochengh): Design better way to sync between Chrome-side and
// Blink-side spellcheck enabled states. See crbug.com/710097.
if (SpellCheckProvider* provider =
SpellCheckProvider::Get(render_view->GetMainRenderFrame()))
provider->EnableSpellcheck(spellcheck_->IsSpellcheckEnabled());
#endif // BUILDFLAG(ENABLE_SPELLCHECK)
new prerender::PrerendererClient(render_view); new prerender::PrerendererClient(render_view);
new ChromeRenderViewObserver(render_view, web_cache_impl_.get()); new ChromeRenderViewObserver(render_view, web_cache_impl_.get());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment