| Index: components/spellcheck/renderer/spellcheck_provider.cc
|
| diff --git a/components/spellcheck/renderer/spellcheck_provider.cc b/components/spellcheck/renderer/spellcheck_provider.cc
|
| index d41219a2ea5cc0b6f53c2d8a42894c58db66ddce..a6be5bf83a0b3b371106c3df75cb513d90dc9f0c 100644
|
| --- a/components/spellcheck/renderer/spellcheck_provider.cc
|
| +++ b/components/spellcheck/renderer/spellcheck_provider.cc
|
| @@ -10,6 +10,7 @@
|
| #include "components/spellcheck/renderer/spellcheck.h"
|
| #include "components/spellcheck/renderer/spellcheck_language.h"
|
| #include "components/spellcheck/spellcheck_build_features.h"
|
| +#include "content/public/renderer/render_frame.h"
|
| #include "content/public/renderer/render_view.h"
|
| #include "third_party/WebKit/public/platform/WebVector.h"
|
| #include "third_party/WebKit/public/web/WebDocument.h"
|
| @@ -41,7 +42,13 @@ SpellCheckProvider::SpellCheckProvider(
|
| spellcheck_(spellcheck) {
|
| DCHECK(spellcheck_);
|
| if (render_view) { // NULL in unit tests.
|
| - render_view->GetWebView()->setTextCheckClient(this);
|
| + // For a main frame of a view, RenderFrameCreated is called earlier than
|
| + // RenderViewCreated. This workaround ensures that WebTextCheckClient is
|
| + // still set for any main frame.
|
| + // TODO(xiaocheng): Remove this workaround once SpellCheckProvider becomes
|
| + // a RenderFrameObserver.
|
| + if (content::RenderFrame* main_frame = render_view->GetMainRenderFrame())
|
| + main_frame->GetWebFrame()->setTextCheckClient(this);
|
| EnableSpellcheck(spellcheck_->IsSpellcheckEnabled());
|
| }
|
| }
|
|
|