Chromium Code Reviews| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 252 // Send a compositionupdate event when this function updates the exis ting composition | 252 // Send a compositionupdate event when this function updates the exis ting composition |
| 253 // node, i.e. m_compositionNode != 0 && !text.isEmpty(). | 253 // node, i.e. m_compositionNode != 0 && !text.isEmpty(). |
| 254 // 3. Canceling the ongoing composition. | 254 // 3. Canceling the ongoing composition. |
| 255 // Send a compositionend event when function deletes the existing com position node, i.e. | 255 // Send a compositionend event when function deletes the existing com position node, i.e. |
| 256 // m_compositionNode != 0 && test.isEmpty(). | 256 // m_compositionNode != 0 && test.isEmpty(). |
| 257 RefPtrWillBeRawPtr<CompositionEvent> event = nullptr; | 257 RefPtrWillBeRawPtr<CompositionEvent> event = nullptr; |
| 258 if (!hasComposition()) { | 258 if (!hasComposition()) { |
| 259 // We should send a compositionstart event only when the given text is not empty because this | 259 // We should send a compositionstart event only when the given text is not empty because this |
| 260 // function doesn't create a composition node when the text is empty . | 260 // function doesn't create a composition node when the text is empty . |
| 261 if (!text.isEmpty()) { | 261 if (!text.isEmpty()) { |
| 262 target->dispatchEvent(CompositionEvent::create(EventTypeNames::c ompositionstart, m_frame.domWindow(), m_frame.selectedText(), underlines)); | 262 RefPtrWillBeRawPtr<CompositionEvent> compositionStartEvent = Com positionEvent::create(EventTypeNames::compositionstart, m_frame.domWindow(), m_f rame.selectedText(), underlines); |
| 263 if (!target->dispatchEvent(compositionStartEvent)) | |
| 264 return; | |
|
kochi
2014/06/06 05:20:41
You have to dispatch compositionend event for this
| |
| 263 event = CompositionEvent::create(EventTypeNames::compositionupda te, m_frame.domWindow(), text, underlines); | 265 event = CompositionEvent::create(EventTypeNames::compositionupda te, m_frame.domWindow(), text, underlines); |
| 264 } | 266 } |
| 265 } else { | 267 } else { |
| 266 if (!text.isEmpty()) | 268 if (!text.isEmpty()) |
| 267 event = CompositionEvent::create(EventTypeNames::compositionupda te, m_frame.domWindow(), text, underlines); | 269 event = CompositionEvent::create(EventTypeNames::compositionupda te, m_frame.domWindow(), text, underlines); |
| 268 else | 270 else |
| 269 event = CompositionEvent::create(EventTypeNames::compositionend, m_frame.domWindow(), text, underlines); | 271 event = CompositionEvent::create(EventTypeNames::compositionend, m_frame.domWindow(), text, underlines); |
| 270 } | 272 } |
| 271 if (event.get()) | 273 if (event.get()) |
| 272 target->dispatchEvent(event, IGNORE_EXCEPTION); | 274 target->dispatchEvent(event, IGNORE_EXCEPTION); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 398 if (!editor().canEdit()) | 400 if (!editor().canEdit()) |
| 399 return; | 401 return; |
| 400 PlainTextRange selectionOffsets(getSelectionOffsets()); | 402 PlainTextRange selectionOffsets(getSelectionOffsets()); |
| 401 if (selectionOffsets.isNull()) | 403 if (selectionOffsets.isNull()) |
| 402 return; | 404 return; |
| 403 setSelectionOffsets(PlainTextRange(std::max(static_cast<int>(selectionOffset s.start()) - before, 0), selectionOffsets.end() + after)); | 405 setSelectionOffsets(PlainTextRange(std::max(static_cast<int>(selectionOffset s.start()) - before, 0), selectionOffsets.end() + after)); |
| 404 TypingCommand::deleteSelection(*m_frame.document()); | 406 TypingCommand::deleteSelection(*m_frame.document()); |
| 405 } | 407 } |
| 406 | 408 |
| 407 } // namespace WebCore | 409 } // namespace WebCore |
| OLD | NEW |