Chromium Code Reviews| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 int length = static_cast<int>(composition->text.length()); | 300 int length = static_cast<int>(composition->text.length()); |
| 301 | 301 |
| 302 // Find out the range selected by the user. | 302 // Find out the range selected by the user. |
| 303 int target_start = length; | 303 int target_start = length; |
| 304 int target_end = length; | 304 int target_end = length; |
| 305 if (lparam & GCS_COMPATTR) | 305 if (lparam & GCS_COMPATTR) |
| 306 GetCompositionTargetRange(imm_context, &target_start, &target_end); | 306 GetCompositionTargetRange(imm_context, &target_start, &target_end); |
| 307 | 307 |
| 308 // Retrieve the selection range information. If CS_NOMOVECARET is specified, | 308 // Retrieve the selection range information. If CS_NOMOVECARET is specified, |
| 309 // that means the cursor should not be moved, then we just place the caret at | 309 // that means the cursor should not be moved, then we just place the caret at |
| 310 // the beginning of the composition string. Otherwise we should honour the | 310 // the beginning of the composition string. Otherwise we should honour the |
|
yukawa
2017/04/17 03:01:05
"we just place the caret at the beginning of the c
| |
| 311 // GCS_CURSORPOS value if it's available. | 311 // GCS_CURSORPOS value if it's available. |
| 312 // TODO(suzhe): due to a bug of webkit, we currently can't use selection range | 312 // TODO(suzhe): due to a bug of webkit, we currently can't use selection range |
| 313 // with composition string. See: https://bugs.webkit.org/show_bug.cgi?id=40805 | 313 // with composition string. See: https://bugs.webkit.org/show_bug.cgi?id=40805 |
| 314 if (!(lparam & CS_NOMOVECARET) && (lparam & GCS_CURSORPOS)) { | 314 if (!(lparam & CS_NOMOVECARET) && (lparam & GCS_CURSORPOS)) { |
|
yukawa
2017/04/17 04:11:59
As far as I've tested with the stock MS-IME Korean
| |
| 315 // IMM32 does not support non-zero-width selection in a composition. So | 315 // IMM32 does not support non-zero-width selection in a composition. So |
| 316 // always use the caret position as selection range. | 316 // always use the caret position as selection range. |
| 317 int cursor = ::ImmGetCompositionString(imm_context, GCS_CURSORPOS, NULL, 0); | 317 int cursor = ::ImmGetCompositionString(imm_context, GCS_CURSORPOS, NULL, 0); |
| 318 composition->selection = gfx::Range(cursor); | 318 composition->selection = gfx::Range(cursor); |
| 319 } else { | 319 } else { |
| 320 composition->selection = gfx::Range(0); | 320 composition->selection = gfx::Range(length); |
| 321 } | 321 } |
| 322 | 322 |
| 323 // Retrieve the clause segmentations and convert them to underlines. | 323 // Retrieve the clause segmentations and convert them to underlines. |
| 324 if (lparam & GCS_COMPCLAUSE) { | 324 if (lparam & GCS_COMPCLAUSE) { |
| 325 GetCompositionUnderlines(imm_context, target_start, target_end, | 325 GetCompositionUnderlines(imm_context, target_start, target_end, |
| 326 &composition->underlines); | 326 &composition->underlines); |
| 327 } | 327 } |
| 328 | 328 |
| 329 // Set default underlines in case there is no clause information. | 329 // Set default underlines in case there is no clause information. |
| 330 if (!composition->underlines.empty()) | 330 if (!composition->underlines.empty()) |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 602 | IME_CMODE_KATAKANA | 602 | IME_CMODE_KATAKANA |
| 603 | IME_CMODE_FULLSHAPE); | 603 | IME_CMODE_FULLSHAPE); |
| 604 break; | 604 break; |
| 605 default: | 605 default: |
| 606 *open = FALSE; | 606 *open = FALSE; |
| 607 break; | 607 break; |
| 608 } | 608 } |
| 609 } | 609 } |
| 610 | 610 |
| 611 } // namespace ui | 611 } // namespace ui |
| OLD | NEW |