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

Unified Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 1635953002: Added replacement_range to ImeSetComposition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: erikchen's review Created 4 years, 11 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/browser/renderer_host/render_widget_host_view_mac.h ('k') | content/common/input_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_mac.mm
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 18dcf46ae16625f71ab8488c275e21f62b1aa4f4..a06022dee0f2ab420a83cfe562694d76d03927f1 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -2150,6 +2150,7 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged(
markedText_.clear();
markedTextSelectedRange_ = NSMakeRange(NSNotFound, 0);
underlines_.clear();
+ setMarkedTextReplacementRange_ = gfx::Range::InvalidRange();
unmarkTextCalled_ = NO;
hasEditCommands_ = NO;
editCommands_.clear();
@@ -2235,6 +2236,7 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged(
// When marked text is available, |markedTextSelectedRange_| will be the
// range being selected inside the marked text.
widgetHost->ImeSetComposition(markedText_, underlines_,
+ setMarkedTextReplacementRange_,
markedTextSelectedRange_.location,
NSMaxRange(markedTextSelectedRange_));
} else if (oldHasMarkedText && !hasMarkedText_ && !textInserted) {
@@ -2246,6 +2248,9 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged(
}
}
+ // Clear information from |interpretKeyEvents:|
+ setMarkedTextReplacementRange_ = gfx::Range::InvalidRange();
+
// If the key event was handled by the input method but it also generated some
// edit commands, then we need to send the real key event and corresponding
// edit commands here. This usually occurs when the input method wants to
@@ -3097,9 +3102,11 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
// is empty to update the input method state. (Our input method backend can
// automatically cancels an ongoing composition when we send an empty text.
// So, it is OK to send an empty text to the renderer.)
- if (!handlingKeyDown_) {
+ if (handlingKeyDown_) {
+ setMarkedTextReplacementRange_ = gfx::Range(replacementRange);
+ } else {
renderWidgetHostView_->render_widget_host_->ImeSetComposition(
- markedText_, underlines_,
+ markedText_, underlines_, gfx::Range(replacementRange),
newSelRange.location, NSMaxRange(newSelRange));
}
}
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.h ('k') | content/common/input_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698