OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "ui/base/ime/win/imm32_manager.h" | 5 #include "ui/base/ime/win/imm32_manager.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlcom.h> | 8 #include <atlcom.h> |
9 #include <msctf.h> | 9 #include <msctf.h> |
10 | 10 |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 // Retrieve the selection range information. If CS_NOMOVECARET is specified, | 322 // Retrieve the selection range information. If CS_NOMOVECARET is specified, |
323 // that means the cursor should not be moved, then we just place the caret at | 323 // that means the cursor should not be moved, then we just place the caret at |
324 // the beginning of the composition string. Otherwise we should honour the | 324 // the beginning of the composition string. Otherwise we should honour the |
325 // GCS_CURSORPOS value if it's available. | 325 // GCS_CURSORPOS value if it's available. |
326 // TODO(suzhe): due to a bug of webkit, we currently can't use selection range | 326 // TODO(suzhe): due to a bug of webkit, we currently can't use selection range |
327 // with composition string. See: https://bugs.webkit.org/show_bug.cgi?id=40805 | 327 // with composition string. See: https://bugs.webkit.org/show_bug.cgi?id=40805 |
328 if (!(lparam & CS_NOMOVECARET) && (lparam & GCS_CURSORPOS)) { | 328 if (!(lparam & CS_NOMOVECARET) && (lparam & GCS_CURSORPOS)) { |
329 // IMM32 does not support non-zero-width selection in a composition. So | 329 // IMM32 does not support non-zero-width selection in a composition. So |
330 // always use the caret position as selection range. | 330 // always use the caret position as selection range. |
331 int cursor = ::ImmGetCompositionString(imm_context, GCS_CURSORPOS, NULL, 0); | 331 int cursor = ::ImmGetCompositionString(imm_context, GCS_CURSORPOS, NULL, 0); |
332 composition->selection = ui::Range(cursor); | 332 composition->selection = gfx::Range(cursor); |
333 } else { | 333 } else { |
334 composition->selection = ui::Range(0); | 334 composition->selection = gfx::Range(0); |
335 } | 335 } |
336 | 336 |
337 // Retrieve the clause segmentations and convert them to underlines. | 337 // Retrieve the clause segmentations and convert them to underlines. |
338 if (lparam & GCS_COMPCLAUSE) { | 338 if (lparam & GCS_COMPCLAUSE) { |
339 GetCompositionUnderlines(imm_context, target_start, target_end, | 339 GetCompositionUnderlines(imm_context, target_start, target_end, |
340 &composition->underlines); | 340 &composition->underlines); |
341 } | 341 } |
342 | 342 |
343 // Set default underlines in case there is no clause information. | 343 // Set default underlines in case there is no clause information. |
344 if (!composition->underlines.size()) { | 344 if (!composition->underlines.size()) { |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 | IME_CMODE_KATAKANA | 634 | IME_CMODE_KATAKANA |
635 | IME_CMODE_FULLSHAPE); | 635 | IME_CMODE_FULLSHAPE); |
636 break; | 636 break; |
637 default: | 637 default: |
638 *open = FALSE; | 638 *open = FALSE; |
639 break; | 639 break; |
640 } | 640 } |
641 } | 641 } |
642 | 642 |
643 } // namespace ui | 643 } // namespace ui |
OLD | NEW |