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

Side by Side Diff: Source/core/editing/InputMethodController.cpp

Issue 297003003: Emit object replacement char to IME (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: yuta's comments addressed Created 6 years, 6 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 | Source/core/editing/PlainTextRange.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 372 }
373 373
374 bool InputMethodController::setSelectionOffsets(const PlainTextRange& selectionO ffsets) 374 bool InputMethodController::setSelectionOffsets(const PlainTextRange& selectionO ffsets)
375 { 375 {
376 if (selectionOffsets.isNull()) 376 if (selectionOffsets.isNull())
377 return false; 377 return false;
378 Element* rootEditableElement = m_frame.selection().rootEditableElement(); 378 Element* rootEditableElement = m_frame.selection().rootEditableElement();
379 if (!rootEditableElement) 379 if (!rootEditableElement)
380 return false; 380 return false;
381 381
382 RefPtrWillBeRawPtr<Range> range = selectionOffsets.createRange(*rootEditable Element); 382 RefPtrWillBeRawPtr<Range> range = selectionOffsets.createRangeForInputMethod (*rootEditableElement);
383 if (!range) 383 if (!range)
384 return false; 384 return false;
385 385
386 return m_frame.selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY , FrameSelection::CloseTyping); 386 return m_frame.selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY , FrameSelection::CloseTyping);
387 } 387 }
388 388
389 bool InputMethodController::setEditableSelectionOffsets(const PlainTextRange& se lectionOffsets) 389 bool InputMethodController::setEditableSelectionOffsets(const PlainTextRange& se lectionOffsets)
390 { 390 {
391 if (!editor().canEdit()) 391 if (!editor().canEdit())
392 return false; 392 return false;
393 return setSelectionOffsets(selectionOffsets); 393 return setSelectionOffsets(selectionOffsets);
394 } 394 }
395 395
396 void InputMethodController::extendSelectionAndDelete(int before, int after) 396 void InputMethodController::extendSelectionAndDelete(int before, int after)
397 { 397 {
398 if (!editor().canEdit()) 398 if (!editor().canEdit())
399 return; 399 return;
400 PlainTextRange selectionOffsets(getSelectionOffsets()); 400 PlainTextRange selectionOffsets(getSelectionOffsets());
401 if (selectionOffsets.isNull()) 401 if (selectionOffsets.isNull())
402 return; 402 return;
403 setSelectionOffsets(PlainTextRange(std::max(static_cast<int>(selectionOffset s.start()) - before, 0), selectionOffsets.end() + after)); 403 setSelectionOffsets(PlainTextRange(std::max(static_cast<int>(selectionOffset s.start()) - before, 0), selectionOffsets.end() + after));
404 TypingCommand::deleteSelection(*m_frame.document()); 404 TypingCommand::deleteSelection(*m_frame.document());
405 } 405 }
406 406
407 } // namespace WebCore 407 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/PlainTextRange.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698