Index: chrome/renderer/render_view.cc |
=================================================================== |
--- chrome/renderer/render_view.cc (revision 32394) |
+++ chrome/renderer/render_view.cc (working copy) |
@@ -52,9 +52,7 @@ |
#include "chrome/renderer/plugin_channel_host.h" |
#include "chrome/renderer/print_web_view_helper.h" |
#include "chrome/renderer/render_process.h" |
-#if defined(SPELLCHECKER_IN_RENDERER) |
#include "chrome/renderer/spellchecker/spellcheck.h" |
-#endif |
#include "chrome/renderer/user_script_slave.h" |
#include "chrome/renderer/visitedlink_slave.h" |
#include "chrome/renderer/webplugin_delegate_pepper.h" |
@@ -1503,19 +1501,14 @@ |
int& misspelled_length) { |
EnsureDocumentTag(); |
-#if defined(SPELLCHECKER_IN_RENDERER) |
string16 word(text); |
RenderThread* thread = RenderThread::current(); |
// Will be NULL during unit tests. |
if (thread) { |
- RenderThread::current()->spellchecker()->SpellCheckWord( |
+ thread->spellchecker()->SpellCheckWord( |
word.c_str(), word.size(), document_tag_, |
&misspelled_offset, &misspelled_length, NULL); |
} |
-#else |
- Send(new ViewHostMsg_SpellCheck(routing_id_, text, document_tag_, |
- &misspelled_offset, &misspelled_length)); |
-#endif |
} |
WebString RenderView::autoCorrectWord(const WebKit::WebString& word) { |
@@ -1523,18 +1516,13 @@ |
const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
if (command_line.HasSwitch(switches::kExperimentalSpellcheckerFeatures)) { |
EnsureDocumentTag(); |
-#if defined(SPELLCHECKER_IN_RENDERER) |
RenderThread* thread = RenderThread::current(); |
// Will be NULL during unit tests. |
if (thread) { |
autocorrect_word = |
- RenderThread::current()->spellchecker()->GetAutoCorrectionWord( |
+ thread->spellchecker()->GetAutoCorrectionWord( |
word, document_tag_); |
} |
-#else |
- Send(new ViewHostMsg_GetAutoCorrectWord( |
- routing_id_, word, document_tag_, &autocorrect_word)); |
-#endif |
} |
return autocorrect_word; |
} |
@@ -1619,7 +1607,19 @@ |
void RenderView::showContextMenu( |
WebFrame* frame, const WebContextMenuData& data) { |
- Send(new ViewHostMsg_ContextMenu(routing_id_, ContextMenuParams(data))); |
+ ContextMenuParams params = ContextMenuParams(data); |
+ if (!params.misspelled_word.empty() && RenderThread::current()) { |
+ int misspelled_offset, misspelled_length; |
+ bool misspelled = RenderThread::current()->spellchecker()->SpellCheckWord( |
+ params.misspelled_word.c_str(), params.misspelled_word.size(), |
+ document_tag_, |
+ &misspelled_offset, &misspelled_length, |
+ ¶ms.dictionary_suggestions); |
+ if (!misspelled) |
+ params.misspelled_word.clear(); |
+ } |
+ |
+ Send(new ViewHostMsg_ContextMenu(routing_id_, params)); |
} |
void RenderView::setStatusText(const WebString& text) { |
@@ -2547,7 +2547,7 @@ |
// they're different. |
int width = webview()->mainFrame()->contentsPreferredWidth(); |
int height = webview()->mainFrame()->documentElementScrollHeight(); |
- |
+ |
if (width != preferred_size_.width() || |
height != preferred_size_.height()) { |
preferred_size_.set_width(width); |