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

Side by Side Diff: ui/base/ime/win/imm32_manager.cc

Issue 2126433002: Use container::back() and container::pop_back() in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pre-increment Created 4 years, 5 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/base/win/open_file_name_win_unittest.cc » ('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 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 void IMM32Manager::CompleteComposition(HWND window_handle, HIMC imm_context) { 276 void IMM32Manager::CompleteComposition(HWND window_handle, HIMC imm_context) {
277 // We have to confirm there is an ongoing composition before completing it. 277 // We have to confirm there is an ongoing composition before completing it.
278 // This is for preventing some IMEs from getting confused while completing an 278 // This is for preventing some IMEs from getting confused while completing an
279 // ongoing composition even if they do not have any ongoing compositions.) 279 // ongoing composition even if they do not have any ongoing compositions.)
280 if (is_composing_) { 280 if (is_composing_) {
281 ::ImmNotifyIME(imm_context, NI_COMPOSITIONSTR, CPS_COMPLETE, 0); 281 ::ImmNotifyIME(imm_context, NI_COMPOSITIONSTR, CPS_COMPLETE, 0);
282 ResetComposition(window_handle); 282 ResetComposition(window_handle);
283 } 283 }
284 } 284 }
285 285
286 void IMM32Manager::GetCompositionInfo(HIMC imm_context, LPARAM lparam, 286 void IMM32Manager::GetCompositionInfo(HIMC imm_context,
287 CompositionText* composition) { 287 LPARAM lparam,
288 CompositionText* composition) {
288 // We only care about GCS_COMPATTR, GCS_COMPCLAUSE and GCS_CURSORPOS, and 289 // We only care about GCS_COMPATTR, GCS_COMPCLAUSE and GCS_CURSORPOS, and
289 // convert them into underlines and selection range respectively. 290 // convert them into underlines and selection range respectively.
290 composition->underlines.clear(); 291 composition->underlines.clear();
291 292
292 int length = static_cast<int>(composition->text.length()); 293 int length = static_cast<int>(composition->text.length());
293 294
294 // Find out the range selected by the user. 295 // Find out the range selected by the user.
295 int target_start = length; 296 int target_start = length;
296 int target_end = length; 297 int target_end = length;
297 if (lparam & GCS_COMPATTR) 298 if (lparam & GCS_COMPATTR)
(...skipping 14 matching lines...) Expand all
312 composition->selection = gfx::Range(0); 313 composition->selection = gfx::Range(0);
313 } 314 }
314 315
315 // Retrieve the clause segmentations and convert them to underlines. 316 // Retrieve the clause segmentations and convert them to underlines.
316 if (lparam & GCS_COMPCLAUSE) { 317 if (lparam & GCS_COMPCLAUSE) {
317 GetCompositionUnderlines(imm_context, target_start, target_end, 318 GetCompositionUnderlines(imm_context, target_start, target_end,
318 &composition->underlines); 319 &composition->underlines);
319 } 320 }
320 321
321 // Set default underlines in case there is no clause information. 322 // Set default underlines in case there is no clause information.
322 if (!composition->underlines.size()) { 323 if (!composition->underlines.empty())
323 CompositionUnderline underline; 324 return;
324 underline.color = SK_ColorBLACK; 325
325 underline.background_color = SK_ColorTRANSPARENT; 326 CompositionUnderline underline;
326 if (target_start > 0) { 327 underline.color = SK_ColorBLACK;
327 underline.start_offset = 0U; 328 underline.background_color = SK_ColorTRANSPARENT;
328 underline.end_offset = static_cast<uint32_t>(target_start); 329 if (target_start > 0) {
329 underline.thick = false; 330 underline.start_offset = 0U;
330 composition->underlines.push_back(underline); 331 underline.end_offset = static_cast<uint32_t>(target_start);
331 } 332 underline.thick = false;
332 if (target_end > target_start) { 333 composition->underlines.push_back(underline);
333 underline.start_offset = static_cast<uint32_t>(target_start); 334 }
334 underline.end_offset = static_cast<uint32_t>(target_end); 335 if (target_end > target_start) {
335 underline.thick = true; 336 underline.start_offset = static_cast<uint32_t>(target_start);
336 composition->underlines.push_back(underline); 337 underline.end_offset = static_cast<uint32_t>(target_end);
337 } 338 underline.thick = true;
338 if (target_end < length) { 339 composition->underlines.push_back(underline);
339 underline.start_offset = static_cast<uint32_t>(target_end); 340 }
340 underline.end_offset = static_cast<uint32_t>(length); 341 if (target_end < length) {
341 underline.thick = false; 342 underline.start_offset = static_cast<uint32_t>(target_end);
342 composition->underlines.push_back(underline); 343 underline.end_offset = static_cast<uint32_t>(length);
343 } 344 underline.thick = false;
345 composition->underlines.push_back(underline);
344 } 346 }
345 } 347 }
346 348
347 bool IMM32Manager::GetString(HIMC imm_context, 349 bool IMM32Manager::GetString(HIMC imm_context,
348 WPARAM lparam, 350 WPARAM lparam,
349 int type, 351 int type,
350 base::string16* result) { 352 base::string16* result) {
351 if (!(lparam & type)) 353 if (!(lparam & type))
352 return false; 354 return false;
353 LONG string_size = ::ImmGetCompositionString(imm_context, type, NULL, 0); 355 LONG string_size = ::ImmGetCompositionString(imm_context, type, NULL, 0);
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 | IME_CMODE_KATAKANA 616 | IME_CMODE_KATAKANA
615 | IME_CMODE_FULLSHAPE); 617 | IME_CMODE_FULLSHAPE);
616 break; 618 break;
617 default: 619 default:
618 *open = FALSE; 620 *open = FALSE;
619 break; 621 break;
620 } 622 }
621 } 623 }
622 624
623 } // namespace ui 625 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/base/win/open_file_name_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698