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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 for (auto& underline : m_customCompositionUnderlines) { | 292 for (auto& underline : m_customCompositionUnderlines) { |
293 underline.startOffset += baseOffset; | 293 underline.startOffset += baseOffset; |
294 underline.endOffset += baseOffset; | 294 underline.endOffset += baseOffset; |
295 } | 295 } |
296 if (baseNode->layoutObject()) | 296 if (baseNode->layoutObject()) |
297 baseNode->layoutObject()->setShouldDoFullPaintInvalidation(); | 297 baseNode->layoutObject()->setShouldDoFullPaintInvalidation(); |
298 | 298 |
299 unsigned start = std::min(baseOffset + selectionStart, extentOffset); | 299 unsigned start = std::min(baseOffset + selectionStart, extentOffset); |
300 unsigned end = std::min(std::max(start, baseOffset + selectionEnd), extentOf
fset); | 300 unsigned end = std::min(std::max(start, baseOffset + selectionEnd), extentOf
fset); |
301 RefPtrWillBeRawPtr<Range> selectedRange = Range::create(baseNode->document()
, baseNode, start, baseNode, end); | 301 RefPtrWillBeRawPtr<Range> selectedRange = Range::create(baseNode->document()
, baseNode, start, baseNode, end); |
302 frame().selection().setSelectedRange(selectedRange.get(), DOWNSTREAM, FrameS
election::NonDirectional, NotUserTriggered); | 302 frame().selection().setSelectedRange(selectedRange.get(), TextAffinity::Down
stream, FrameSelection::NonDirectional, NotUserTriggered); |
303 } | 303 } |
304 | 304 |
305 void InputMethodController::setCompositionFromExistingText(const Vector<Composit
ionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd) | 305 void InputMethodController::setCompositionFromExistingText(const Vector<Composit
ionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd) |
306 { | 306 { |
307 Element* editable = frame().selection().rootEditableElement(); | 307 Element* editable = frame().selection().rootEditableElement(); |
308 Position base = frame().selection().base().downstream(); | 308 Position base = frame().selection().base().downstream(); |
309 Node* baseNode = base.anchorNode(); | 309 Node* baseNode = base.anchorNode(); |
310 if (baseNode && editable->firstChild() == baseNode && editable->lastChild()
== baseNode && baseNode->isTextNode()) { | 310 if (baseNode && editable->firstChild() == baseNode && editable->lastChild()
== baseNode && baseNode->isTextNode()) { |
311 m_compositionNode = nullptr; | 311 m_compositionNode = nullptr; |
312 m_customCompositionUnderlines.clear(); | 312 m_customCompositionUnderlines.clear(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 TypingCommand::deleteSelection(*frame().document()); | 422 TypingCommand::deleteSelection(*frame().document()); |
423 } | 423 } |
424 | 424 |
425 DEFINE_TRACE(InputMethodController) | 425 DEFINE_TRACE(InputMethodController) |
426 { | 426 { |
427 visitor->trace(m_frame); | 427 visitor->trace(m_frame); |
428 visitor->trace(m_compositionNode); | 428 visitor->trace(m_compositionNode); |
429 } | 429 } |
430 | 430 |
431 } // namespace blink | 431 } // namespace blink |
OLD | NEW |