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

Side by Side Diff: ui/views/cocoa/bridged_content_view.mm

Issue 2177853002: MacViews: Fix setMarkedText in BridgedContentView to take replacementRange into account. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ime_regression
Patch Set: Add test. Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/cocoa/bridged_native_widget_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ui/views/cocoa/bridged_content_view.h" 5 #import "ui/views/cocoa/bridged_content_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "base/mac/mac_util.h" 8 #import "base/mac/mac_util.h"
9 #import "base/mac/scoped_nsobject.h" 9 #import "base/mac/scoped_nsobject.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 } 1207 }
1208 1208
1209 - (void)setMarkedText:(id)text 1209 - (void)setMarkedText:(id)text
1210 selectedRange:(NSRange)selectedRange 1210 selectedRange:(NSRange)selectedRange
1211 replacementRange:(NSRange)replacementRange { 1211 replacementRange:(NSRange)replacementRange {
1212 if (!textInputClient_) 1212 if (!textInputClient_)
1213 return; 1213 return;
1214 1214
1215 if ([text isKindOfClass:[NSAttributedString class]]) 1215 if ([text isKindOfClass:[NSAttributedString class]])
1216 text = [text string]; 1216 text = [text string];
1217
1218 textInputClient_->DeleteRange(gfx::Range(replacementRange));
1217 ui::CompositionText composition; 1219 ui::CompositionText composition;
1218 composition.text = base::SysNSStringToUTF16(text); 1220 composition.text = base::SysNSStringToUTF16(text);
1219 composition.selection = gfx::Range(selectedRange); 1221 composition.selection = gfx::Range(selectedRange);
1220 textInputClient_->SetCompositionText(composition); 1222 textInputClient_->SetCompositionText(composition);
1221 } 1223 }
1222 1224
1223 - (void)unmarkText { 1225 - (void)unmarkText {
1224 if (textInputClient_) 1226 if (textInputClient_)
1225 textInputClient_->ConfirmCompositionText(); 1227 textInputClient_->ConfirmCompositionText();
1226 } 1228 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 } 1283 }
1282 1284
1283 return [super accessibilityAttributeValue:attribute]; 1285 return [super accessibilityAttributeValue:attribute];
1284 } 1286 }
1285 1287
1286 - (id)accessibilityHitTest:(NSPoint)point { 1288 - (id)accessibilityHitTest:(NSPoint)point {
1287 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; 1289 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point];
1288 } 1290 }
1289 1291
1290 @end 1292 @end
OLDNEW
« no previous file with comments | « no previous file | ui/views/cocoa/bridged_native_widget_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698