Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: content/renderer/render_view_impl.cc

Issue 12038037: Replace the misspelled range within a selection to correct spelling. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 11a2f409b6d684a13fc35cf4c0a13289644923e6..95ee209dde7cf8ec9321d2227abf381f7d24766c 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -983,6 +983,7 @@ bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste)
IPC_MESSAGE_HANDLER(ViewMsg_PasteAndMatchStyle, OnPasteAndMatchStyle)
IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace)
+ IPC_MESSAGE_HANDLER(ViewMsg_ReplaceMisspelling, OnReplaceMisspelling)
IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete)
IPC_MESSAGE_HANDLER(ViewMsg_SetName, OnSetName)
IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll)
@@ -1404,9 +1405,21 @@ void RenderViewImpl::OnReplace(const string16& text) {
WebFrame* frame = webview()->focusedFrame();
if (!frame->hasSelection())
frame->selectWordAroundCaret();
+
frame->replaceSelection(text);
}
+void RenderViewImpl::OnReplaceMisspelling(const string16& text) {
+ if (!webview())
+ return;
+
+ WebFrame* frame = webview()->focusedFrame();
+ if (!frame->hasSelection())
+ return;
+
+ frame->replaceMisspelledRange(text);
+}
+
void RenderViewImpl::OnDelete() {
if (!webview())
return;
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698