| OLD | NEW |
| 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 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 do { | 814 do { |
| 815 if (!setSelectionOffsets(PlainTextRange( | 815 if (!setSelectionOffsets(PlainTextRange( |
| 816 std::max(static_cast<int>(selectionOffsets.start()) - before, 0), | 816 std::max(static_cast<int>(selectionOffsets.start()) - before, 0), |
| 817 selectionOffsets.end() + after))) | 817 selectionOffsets.end() + after))) |
| 818 return; | 818 return; |
| 819 if (before == 0) | 819 if (before == 0) |
| 820 break; | 820 break; |
| 821 ++before; | 821 ++before; |
| 822 } while (frame().selection().start() == frame().selection().end() && | 822 } while (frame().selection().start() == frame().selection().end() && |
| 823 before <= static_cast<int>(selectionOffsets.start())); | 823 before <= static_cast<int>(selectionOffsets.start())); |
| 824 Range* const range = firstRangeOf(frame().selection().selection()); | |
| 825 // TODO(chongz): Find a way to distinguish Forward and Backward. | 824 // TODO(chongz): Find a way to distinguish Forward and Backward. |
| 826 dispatchBeforeInputEditorCommand(document().focusedElement(), | 825 Node* target = document().focusedElement(); |
| 827 InputEvent::InputType::DeleteContentBackward, | 826 if (target) { |
| 828 new RangeVector(1, range)); | 827 dispatchBeforeInputEditorCommand( |
| 828 target, InputEvent::InputType::DeleteContentBackward, |
| 829 targetRangesForInputEvent(*target)); |
| 830 } |
| 829 TypingCommand::deleteSelection(document()); | 831 TypingCommand::deleteSelection(document()); |
| 830 } | 832 } |
| 831 | 833 |
| 832 // TODO(yabinh): We should reduce the number of selectionchange events. | 834 // TODO(yabinh): We should reduce the number of selectionchange events. |
| 833 void InputMethodController::deleteSurroundingText(int before, int after) { | 835 void InputMethodController::deleteSurroundingText(int before, int after) { |
| 834 if (!editor().canEdit()) | 836 if (!editor().canEdit()) |
| 835 return; | 837 return; |
| 836 const PlainTextRange selectionOffsets(getSelectionOffsets()); | 838 const PlainTextRange selectionOffsets(getSelectionOffsets()); |
| 837 if (selectionOffsets.isNull()) | 839 if (selectionOffsets.isNull()) |
| 838 return; | 840 return; |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 frame().chromeClient().resetInputMethod(); | 1111 frame().chromeClient().resetInputMethod(); |
| 1110 } | 1112 } |
| 1111 | 1113 |
| 1112 DEFINE_TRACE(InputMethodController) { | 1114 DEFINE_TRACE(InputMethodController) { |
| 1113 visitor->trace(m_frame); | 1115 visitor->trace(m_frame); |
| 1114 visitor->trace(m_compositionRange); | 1116 visitor->trace(m_compositionRange); |
| 1115 SynchronousMutationObserver::trace(visitor); | 1117 SynchronousMutationObserver::trace(visitor); |
| 1116 } | 1118 } |
| 1117 | 1119 |
| 1118 } // namespace blink | 1120 } // namespace blink |
| OLD | NEW |