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