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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 void InputMethodController::cancelCompositionIfSelectionIsInvalid() | 153 void InputMethodController::cancelCompositionIfSelectionIsInvalid() |
154 { | 154 { |
155 if (!hasComposition() || editor().preventRevealSelection()) | 155 if (!hasComposition() || editor().preventRevealSelection()) |
156 return; | 156 return; |
157 | 157 |
158 // Check if selection start and selection end are valid. | 158 // Check if selection start and selection end are valid. |
159 FrameSelection& selection = frame().selection(); | 159 FrameSelection& selection = frame().selection(); |
160 if (!selection.isNone() && !m_compositionRange->collapsed()) { | 160 if (!selection.isNone() && !m_compositionRange->collapsed()) { |
161 Position start = selection.start(); | 161 Position start = selection.start(); |
162 Position end = selection.end(); | 162 Position end = selection.end(); |
163 if (selection.start().compareTo(m_compositionRange->startPosition()) >=
0 | 163 if (start.compareTo(m_compositionRange->startPosition()) >= 0 |
164 && selection.end().compareTo(m_compositionRange->endPosition()) <= 0
) | 164 && end.compareTo(m_compositionRange->endPosition()) <= 0) |
165 return; | 165 return; |
166 } | 166 } |
167 | 167 |
168 cancelComposition(); | 168 cancelComposition(); |
169 frame().chromeClient().didCancelCompositionOnSelectionChange(); | 169 frame().chromeClient().didCancelCompositionOnSelectionChange(); |
170 } | 170 } |
171 | 171 |
172 bool InputMethodController::finishComposition(const String& text, FinishComposit
ionMode mode) | 172 bool InputMethodController::finishComposition(const String& text, FinishComposit
ionMode mode) |
173 { | 173 { |
174 if (!hasComposition()) | 174 if (!hasComposition()) |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 TypingCommand::deleteSelection(*frame().document()); | 433 TypingCommand::deleteSelection(*frame().document()); |
434 } | 434 } |
435 | 435 |
436 DEFINE_TRACE(InputMethodController) | 436 DEFINE_TRACE(InputMethodController) |
437 { | 437 { |
438 visitor->trace(m_frame); | 438 visitor->trace(m_frame); |
439 visitor->trace(m_compositionRange); | 439 visitor->trace(m_compositionRange); |
440 } | 440 } |
441 | 441 |
442 } // namespace blink | 442 } // namespace blink |
OLD | NEW |