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

Unified Diff: content/browser/renderer_host/render_widget_host_view_win.cc

Issue 11233028: Handle IMR_QUERYCHARPOSITION even when there is no composition (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 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 | « no previous file | no next file » | 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_win.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc
index 32775cb25b1900bd0c213ea59aeb393031590584..2010e7144186e8301caf58d7762017d218b5562d 100644
--- a/content/browser/renderer_host/render_widget_host_view_win.cc
+++ b/content/browser/renderer_host/render_widget_host_view_win.cc
@@ -3024,14 +3024,23 @@ LRESULT RenderWidgetHostViewWin::OnQueryCharPosition(
IMECHARPOSITION* position) {
DCHECK(position);
- if (!ime_input_.is_composing() || composition_range_.is_empty() ||
- position->dwSize < sizeof(IMECHARPOSITION) ||
- position->dwCharPos >= composition_character_bounds_.size()) {
+ if (position->dwSize < sizeof(IMECHARPOSITION))
return 0;
- }
- RECT target_rect =
- composition_character_bounds_[position->dwCharPos].ToRECT();
+ RECT target_rect = {};
+ if (ime_input_.is_composing() && !composition_range_.is_empty() &&
+ position->dwCharPos < composition_character_bounds_.size()) {
+ target_rect =
+ composition_character_bounds_[position->dwCharPos].ToRECT();
+ } else if (position->dwCharPos == 0) {
+ // When there is no on-going composition but |position->dwCharPos| is 0,
+ // use the caret rect. This behavior is the same to RichEdit. In fact,
+ // CUAS (Cicero Unaware Application Support) relies on this behavior to
+ // implement ITfContextView::GetTextExt on top of IMM32-based applications.
+ target_rect = caret_rect_.ToRECT();
+ } else {
+ return 0;
+ }
ClientToScreen(&target_rect);
RECT document_rect = GetViewBounds().ToRECT();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698