| 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 m_compositionNode = nullptr; | 264 m_compositionNode = nullptr; |
| 265 m_customCompositionUnderlines.clear(); | 265 m_customCompositionUnderlines.clear(); |
| 266 | 266 |
| 267 if (!text.isEmpty()) { | 267 if (!text.isEmpty()) { |
| 268 ASSERT(frame().document()); | 268 ASSERT(frame().document()); |
| 269 TypingCommand::insertText(*frame().document(), text, TypingCommand::Sele
ctInsertedText | TypingCommand::PreventSpellChecking, TypingCommand::TextComposi
tionUpdate); | 269 TypingCommand::insertText(*frame().document(), text, TypingCommand::Sele
ctInsertedText | TypingCommand::PreventSpellChecking, TypingCommand::TextComposi
tionUpdate); |
| 270 | 270 |
| 271 // Find out what node has the composition now. | 271 // Find out what node has the composition now. |
| 272 Position base = frame().selection().base().downstream(); | 272 Position base = frame().selection().base().downstream(); |
| 273 Position extent = frame().selection().extent(); | 273 Position extent = frame().selection().extent(); |
| 274 Node* baseNode = base.deprecatedNode(); | 274 Node* baseNode = base.anchorNode(); |
| 275 unsigned baseOffset = base.deprecatedEditingOffset(); | 275 unsigned baseOffset = base.deprecatedEditingOffset(); |
| 276 Node* extentNode = extent.deprecatedNode(); | 276 Node* extentNode = extent.anchorNode(); |
| 277 unsigned extentOffset = extent.deprecatedEditingOffset(); | 277 unsigned extentOffset = extent.deprecatedEditingOffset(); |
| 278 | 278 |
| 279 if (baseNode && baseNode == extentNode && baseNode->isTextNode() && base
Offset + text.length() == extentOffset) { | 279 if (baseNode && baseNode == extentNode && baseNode->isTextNode() && base
Offset + text.length() == extentOffset) { |
| 280 m_compositionNode = toText(baseNode); | 280 m_compositionNode = toText(baseNode); |
| 281 m_compositionStart = baseOffset; | 281 m_compositionStart = baseOffset; |
| 282 m_compositionEnd = extentOffset; | 282 m_compositionEnd = extentOffset; |
| 283 m_customCompositionUnderlines = underlines; | 283 m_customCompositionUnderlines = underlines; |
| 284 for (auto& underline : m_customCompositionUnderlines) { | 284 for (auto& underline : m_customCompositionUnderlines) { |
| 285 underline.startOffset += baseOffset; | 285 underline.startOffset += baseOffset; |
| 286 underline.endOffset += baseOffset; | 286 underline.endOffset += baseOffset; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 TypingCommand::deleteSelection(*frame().document()); | 408 TypingCommand::deleteSelection(*frame().document()); |
| 409 } | 409 } |
| 410 | 410 |
| 411 DEFINE_TRACE(InputMethodController) | 411 DEFINE_TRACE(InputMethodController) |
| 412 { | 412 { |
| 413 visitor->trace(m_frame); | 413 visitor->trace(m_frame); |
| 414 visitor->trace(m_compositionNode); | 414 visitor->trace(m_compositionNode); |
| 415 } | 415 } |
| 416 | 416 |
| 417 } // namespace blink | 417 } // namespace blink |
| OLD | NEW |