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

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

Issue 1999423002: tyrbot test for commitText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SetHasCompositionTextToTrue Created 4 years, 3 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
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 813d7a1967453611de054825f1d20c911eacd53e..10b1a11a6c17c6b26420885154b99959ac25307d 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -1840,7 +1840,7 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged(
// simply confirm all ongoing composition here.
if (type == NSLeftMouseDown || type == NSRightMouseDown ||
type == NSOtherMouseDown) {
- [self confirmComposition];
+ [self finishComposingText];
}
WebMouseEvent event = WebMouseEventBuilder::Build(theEvent, self);
@@ -2067,7 +2067,7 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged(
// Then send keypress and/or composition related events.
// If there was a marked text or the text to be inserted is longer than 1
- // character, then we send the text by calling ConfirmComposition().
+ // character, then we send the text by calling FinishComposingText().
// Otherwise, if the text to be inserted only contains 1 character, then we
// can just send a keypress event which is fabricated by changing the type of
// the keydown event, so that we can retain all necessary informations, such
@@ -2079,8 +2079,7 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged(
BOOL textInserted = NO;
if (textToBeInserted_.length() >
((hasMarkedText_ || oldHasMarkedText) ? 0u : 1u)) {
- widgetHost->ImeConfirmComposition(
- textToBeInserted_, gfx::Range::InvalidRange(), false);
+ widgetHost->ImeCommitText(textToBeInserted_, gfx::Range::InvalidRange(), 0);
textInserted = YES;
}
@@ -2097,8 +2096,7 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged(
NSMaxRange(markedTextSelectedRange_));
} else if (oldHasMarkedText && !hasMarkedText_ && !textInserted) {
if (unmarkTextCalled_) {
- widgetHost->ImeConfirmComposition(
- base::string16(), gfx::Range::InvalidRange(), false);
+ widgetHost->ImeFinishComposingText(false);
} else {
widgetHost->ImeCancelComposition();
}
@@ -2946,12 +2944,11 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
markedTextSelectedRange_ = NSMakeRange(NSNotFound, 0);
underlines_.clear();
- // If we are handling a key down event, then ConfirmComposition() will be
+ // If we are handling a key down event, then FinishComposingText() will be
// called in keyEvent: method.
if (!handlingKeyDown_) {
if (renderWidgetHostView_->GetActiveWidget()) {
- renderWidgetHostView_->GetActiveWidget()->ImeConfirmComposition(
- base::string16(), gfx::Range::InvalidRange(), false);
+ renderWidgetHostView_->GetActiveWidget()->ImeFinishComposingText(false);
}
} else {
unmarkTextCalled_ = YES;
@@ -3052,8 +3049,8 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
} else {
gfx::Range replacement_range(replacementRange);
if (renderWidgetHostView_->GetActiveWidget()) {
- renderWidgetHostView_->GetActiveWidget()->ImeConfirmComposition(
- base::SysNSStringToUTF16(im_text), replacement_range, false);
+ renderWidgetHostView_->GetActiveWidget()->ImeCommitText(
+ base::SysNSStringToUTF16(im_text), replacement_range, 0);
}
}
@@ -3181,13 +3178,12 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
// cancel composition IPC message to the renderer.
}
-- (void)confirmComposition {
+- (void)finishComposingText {
if (!hasMarkedText_)
return;
if (renderWidgetHostView_->GetActiveWidget()) {
- renderWidgetHostView_->GetActiveWidget()->ImeConfirmComposition(
- base::string16(), gfx::Range::InvalidRange(), false);
+ renderWidgetHostView_->GetActiveWidget()->ImeFinishComposingText(false);
}
[self cancelComposition];
@@ -3254,7 +3250,7 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
// If the user is currently using an IME, confirm the IME input,
// and then insert the text from the service, the same as TextEdit and Safari.
- [self confirmComposition];
+ [self finishComposingText];
[self insertText:string];
return YES;
}

Powered by Google App Engine
This is Rietveld 408576698