| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 return true; | 224 return true; |
| 225 } | 225 } |
| 226 | 226 |
| 227 void InputMethodController::setComposition(const String& text, const Vector<Comp
ositionUnderline>& underlines, unsigned selectionStart, unsigned selectionEnd) | 227 void InputMethodController::setComposition(const String& text, const Vector<Comp
ositionUnderline>& underlines, unsigned selectionStart, unsigned selectionEnd) |
| 228 { | 228 { |
| 229 Editor::RevealSelectionScope revealSelectionScope(&editor()); | 229 Editor::RevealSelectionScope revealSelectionScope(&editor()); |
| 230 | 230 |
| 231 // Updates styles before setting selection for composition to prevent | 231 // Updates styles before setting selection for composition to prevent |
| 232 // inserting the previous composition text into text nodes oddly. | 232 // inserting the previous composition text into text nodes oddly. |
| 233 // See https://bugs.webkit.org/show_bug.cgi?id=46868 | 233 // See https://bugs.webkit.org/show_bug.cgi?id=46868 |
| 234 m_frame.document()->updateStyleIfNeeded(); | 234 m_frame.document()->updateRenderTreeIfNeeded(); |
| 235 | 235 |
| 236 selectComposition(); | 236 selectComposition(); |
| 237 | 237 |
| 238 if (m_frame.selection().isNone()) | 238 if (m_frame.selection().isNone()) |
| 239 return; | 239 return; |
| 240 | 240 |
| 241 if (Element* target = m_frame.document()->focusedElement()) { | 241 if (Element* target = m_frame.document()->focusedElement()) { |
| 242 // Dispatch an appropriate composition event to the focused node. | 242 // Dispatch an appropriate composition event to the focused node. |
| 243 // We check the composition status and choose an appropriate composition
event since this | 243 // We check the composition status and choose an appropriate composition
event since this |
| 244 // function is used for three purposes: | 244 // function is used for three purposes: |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 if (!editor().canEdit()) | 398 if (!editor().canEdit()) |
| 399 return; | 399 return; |
| 400 PlainTextRange selectionOffsets(getSelectionOffsets()); | 400 PlainTextRange selectionOffsets(getSelectionOffsets()); |
| 401 if (selectionOffsets.isNull()) | 401 if (selectionOffsets.isNull()) |
| 402 return; | 402 return; |
| 403 setSelectionOffsets(PlainTextRange(std::max(static_cast<int>(selectionOffset
s.start()) - before, 0), selectionOffsets.end() + after)); | 403 setSelectionOffsets(PlainTextRange(std::max(static_cast<int>(selectionOffset
s.start()) - before, 0), selectionOffsets.end() + after)); |
| 404 TypingCommand::deleteSelection(*m_frame.document()); | 404 TypingCommand::deleteSelection(*m_frame.document()); |
| 405 } | 405 } |
| 406 | 406 |
| 407 } // namespace WebCore | 407 } // namespace WebCore |
| OLD | NEW |