| 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 <msctf.h> | 7 #include <msctf.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 scoped_ptr<uint32[]> clause_data(new uint32[clause_length]); | 76 scoped_ptr<uint32[]> clause_data(new uint32[clause_length]); |
| 77 if (clause_data.get()) { | 77 if (clause_data.get()) { |
| 78 ::ImmGetCompositionString(imm_context, GCS_COMPCLAUSE, | 78 ::ImmGetCompositionString(imm_context, GCS_COMPCLAUSE, |
| 79 clause_data.get(), clause_size); | 79 clause_data.get(), clause_size); |
| 80 for (int i = 0; i < clause_length - 1; ++i) { | 80 for (int i = 0; i < clause_length - 1; ++i) { |
| 81 ui::CompositionUnderline underline; | 81 ui::CompositionUnderline underline; |
| 82 underline.start_offset = clause_data[i]; | 82 underline.start_offset = clause_data[i]; |
| 83 underline.end_offset = clause_data[i+1]; | 83 underline.end_offset = clause_data[i+1]; |
| 84 underline.color = SK_ColorBLACK; | 84 underline.color = SK_ColorBLACK; |
| 85 underline.thick = false; | 85 underline.thick = false; |
| 86 underline.background_color = SK_ColorTRANSPARENT; |
| 86 | 87 |
| 87 // Use thick underline for the target clause. | 88 // Use thick underline for the target clause. |
| 88 if (underline.start_offset >= static_cast<unsigned>(target_start) && | 89 if (underline.start_offset >= static_cast<unsigned>(target_start) && |
| 89 underline.end_offset <= static_cast<unsigned>(target_end)) { | 90 underline.end_offset <= static_cast<unsigned>(target_end)) { |
| 90 underline.thick = true; | 91 underline.thick = true; |
| 91 } | 92 } |
| 92 underlines->push_back(underline); | 93 underlines->push_back(underline); |
| 93 } | 94 } |
| 94 } | 95 } |
| 95 } | 96 } |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 // Retrieve the clause segmentations and convert them to underlines. | 336 // Retrieve the clause segmentations and convert them to underlines. |
| 336 if (lparam & GCS_COMPCLAUSE) { | 337 if (lparam & GCS_COMPCLAUSE) { |
| 337 GetCompositionUnderlines(imm_context, target_start, target_end, | 338 GetCompositionUnderlines(imm_context, target_start, target_end, |
| 338 &composition->underlines); | 339 &composition->underlines); |
| 339 } | 340 } |
| 340 | 341 |
| 341 // Set default underlines in case there is no clause information. | 342 // Set default underlines in case there is no clause information. |
| 342 if (!composition->underlines.size()) { | 343 if (!composition->underlines.size()) { |
| 343 CompositionUnderline underline; | 344 CompositionUnderline underline; |
| 344 underline.color = SK_ColorBLACK; | 345 underline.color = SK_ColorBLACK; |
| 346 underline.background_color = SK_ColorTRANSPARENT; |
| 345 if (target_start > 0) { | 347 if (target_start > 0) { |
| 346 underline.start_offset = 0; | 348 underline.start_offset = 0; |
| 347 underline.end_offset = target_start; | 349 underline.end_offset = target_start; |
| 348 underline.thick = false; | 350 underline.thick = false; |
| 349 composition->underlines.push_back(underline); | 351 composition->underlines.push_back(underline); |
| 350 } | 352 } |
| 351 if (target_end > target_start) { | 353 if (target_end > target_start) { |
| 352 underline.start_offset = target_start; | 354 underline.start_offset = target_start; |
| 353 underline.end_offset = target_end; | 355 underline.end_offset = target_end; |
| 354 underline.thick = true; | 356 underline.thick = true; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 | IME_CMODE_KATAKANA | 633 | IME_CMODE_KATAKANA |
| 632 | IME_CMODE_FULLSHAPE); | 634 | IME_CMODE_FULLSHAPE); |
| 633 break; | 635 break; |
| 634 default: | 636 default: |
| 635 *open = FALSE; | 637 *open = FALSE; |
| 636 break; | 638 break; |
| 637 } | 639 } |
| 638 } | 640 } |
| 639 | 641 |
| 640 } // namespace ui | 642 } // namespace ui |
| OLD | NEW |