| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 void InputMethodController::cancelCompositionIfSelectionIsInvalid() | 165 void InputMethodController::cancelCompositionIfSelectionIsInvalid() |
| 166 { | 166 { |
| 167 if (!hasComposition() || editor().preventRevealSelection()) | 167 if (!hasComposition() || editor().preventRevealSelection()) |
| 168 return; | 168 return; |
| 169 | 169 |
| 170 // Check if selection start and selection end are valid. | 170 // Check if selection start and selection end are valid. |
| 171 Position start = m_frame->selection().start(); | 171 Position start = m_frame->selection().start(); |
| 172 Position end = m_frame->selection().end(); | 172 Position end = m_frame->selection().end(); |
| 173 if (start.containerNode() == m_compositionNode | 173 if (start.containerNode() == m_compositionNode |
| 174 && end.containerNode() == m_compositionNode | 174 && end.containerNode() == m_compositionNode |
| 175 && static_cast<unsigned>(start.computeOffsetInContainerNode()) > m_compo
sitionStart | 175 && static_cast<unsigned>(start.computeOffsetInContainerNode()) >= m_comp
ositionStart |
| 176 && static_cast<unsigned>(end.computeOffsetInContainerNode()) < m_composi
tionEnd) | 176 && static_cast<unsigned>(end.computeOffsetInContainerNode()) <= m_compos
itionEnd) |
| 177 return; | 177 return; |
| 178 | 178 |
| 179 cancelComposition(); | 179 cancelComposition(); |
| 180 editorClient().didCancelCompositionOnSelectionChange(); | 180 editorClient().didCancelCompositionOnSelectionChange(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void InputMethodController::finishComposition(const String& text, FinishComposit
ionMode mode) | 183 void InputMethodController::finishComposition(const String& text, FinishComposit
ionMode mode) |
| 184 { | 184 { |
| 185 ASSERT(mode == ConfirmComposition || mode == CancelComposition); | 185 ASSERT(mode == ConfirmComposition || mode == CancelComposition); |
| 186 UserTypingGestureIndicator typingGestureIndicator(m_frame); | 186 UserTypingGestureIndicator typingGestureIndicator(m_frame); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 | 375 |
| 376 bool InputMethodController::setSelectionOffsets(const PlainTextOffsets& selectio
nOffsets) | 376 bool InputMethodController::setSelectionOffsets(const PlainTextOffsets& selectio
nOffsets) |
| 377 { | 377 { |
| 378 if (selectionOffsets.isNull()) | 378 if (selectionOffsets.isNull()) |
| 379 return false; | 379 return false; |
| 380 // FIXME: We should move Editor::setSelectionOffsets() into InputMethodContr
oller class. | 380 // FIXME: We should move Editor::setSelectionOffsets() into InputMethodContr
oller class. |
| 381 return editor().setSelectionOffsets(selectionOffsets.start(), selectionOffse
ts.end()); | 381 return editor().setSelectionOffsets(selectionOffsets.start(), selectionOffse
ts.end()); |
| 382 } | 382 } |
| 383 | 383 |
| 384 } // namespace WebCore | 384 } // namespace WebCore |
| OLD | NEW |