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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 frame().selection().setSelectedRange(selectedRange.get(), DOWNSTREAM
, FrameSelection::NonDirectional, NotUserTriggered); | 311 frame().selection().setSelectedRange(selectedRange.get(), DOWNSTREAM
, FrameSelection::NonDirectional, NotUserTriggered); |
312 } | 312 } |
313 } | 313 } |
314 } | 314 } |
315 | 315 |
316 void InputMethodController::setCompositionFromExistingText(const Vector<Composit
ionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd) | 316 void InputMethodController::setCompositionFromExistingText(const Vector<Composit
ionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd) |
317 { | 317 { |
318 Element* editable = frame().selection().rootEditableElement(); | 318 Element* editable = frame().selection().rootEditableElement(); |
319 Position base = frame().selection().base().downstream(); | 319 Position base = frame().selection().base().downstream(); |
320 Node* baseNode = base.anchorNode(); | 320 Node* baseNode = base.anchorNode(); |
321 if (editable->firstChild() == baseNode && editable->lastChild() == baseNode
&& baseNode->isTextNode()) { | 321 if (baseNode && editable->firstChild() == baseNode && editable->lastChild()
== baseNode && baseNode->isTextNode()) { |
322 m_compositionNode = nullptr; | 322 m_compositionNode = nullptr; |
323 m_customCompositionUnderlines.clear(); | 323 m_customCompositionUnderlines.clear(); |
324 | 324 |
325 if (base.anchorType() != Position::PositionIsOffsetInAnchor) | 325 if (base.anchorType() != Position::PositionIsOffsetInAnchor) |
326 return; | 326 return; |
327 if (!baseNode || baseNode != frame().selection().extent().anchorNode()) | 327 if (baseNode != frame().selection().extent().anchorNode()) |
328 return; | 328 return; |
329 | 329 |
330 m_compositionNode = toText(baseNode); | 330 m_compositionNode = toText(baseNode); |
331 RefPtrWillBeRawPtr<Range> range = PlainTextRange(compositionStart, compo
sitionEnd).createRange(*editable); | 331 RefPtrWillBeRawPtr<Range> range = PlainTextRange(compositionStart, compo
sitionEnd).createRange(*editable); |
332 if (!range) | 332 if (!range) |
333 return; | 333 return; |
334 | 334 |
335 m_compositionStart = range->startOffset(); | 335 m_compositionStart = range->startOffset(); |
336 m_compositionEnd = range->endOffset(); | 336 m_compositionEnd = range->endOffset(); |
337 m_customCompositionUnderlines = underlines; | 337 m_customCompositionUnderlines = underlines; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 TypingCommand::deleteSelection(*frame().document()); | 425 TypingCommand::deleteSelection(*frame().document()); |
426 } | 426 } |
427 | 427 |
428 void InputMethodController::trace(Visitor* visitor) | 428 void InputMethodController::trace(Visitor* visitor) |
429 { | 429 { |
430 visitor->trace(m_frame); | 430 visitor->trace(m_frame); |
431 visitor->trace(m_compositionNode); | 431 visitor->trace(m_compositionNode); |
432 } | 432 } |
433 | 433 |
434 } // namespace blink | 434 } // namespace blink |
OLD | NEW |