| 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 unsigned length = m_compositionNode->length(); | 347 unsigned length = m_compositionNode->length(); |
| 348 unsigned start = std::min(m_compositionStart, length); | 348 unsigned start = std::min(m_compositionStart, length); |
| 349 unsigned end = std::min(std::max(start, m_compositionEnd), length); | 349 unsigned end = std::min(std::max(start, m_compositionEnd), length); |
| 350 if (start >= end) | 350 if (start >= end) |
| 351 return EphemeralRange(); | 351 return EphemeralRange(); |
| 352 return EphemeralRange(Position(m_compositionNode.get(), start), Position(m_c
ompositionNode.get(), end)); | 352 return EphemeralRange(Position(m_compositionNode.get(), start), Position(m_c
ompositionNode.get(), end)); |
| 353 } | 353 } |
| 354 | 354 |
| 355 PassRefPtrWillBeRawPtr<Range> InputMethodController::compositionRange() const | 355 PassRefPtrWillBeRawPtr<Range> InputMethodController::compositionRange() const |
| 356 { | 356 { |
| 357 const EphemeralRange range = compositionEphemeralRange(); | 357 return createRange(compositionEphemeralRange()); |
| 358 if (range.isNull()) | |
| 359 return nullptr; | |
| 360 return Range::create(range.document(), range.startPosition(), range.endPosit
ion()); | |
| 361 } | 358 } |
| 362 | 359 |
| 363 PlainTextRange InputMethodController::getSelectionOffsets() const | 360 PlainTextRange InputMethodController::getSelectionOffsets() const |
| 364 { | 361 { |
| 365 RefPtrWillBeRawPtr<Range> range = frame().selection().selection().firstRange
(); | 362 RefPtrWillBeRawPtr<Range> range = frame().selection().selection().firstRange
(); |
| 366 if (!range) | 363 if (!range) |
| 367 return PlainTextRange(); | 364 return PlainTextRange(); |
| 368 ContainerNode* editable = frame().selection().rootEditableElementOrTreeScope
RootNode(); | 365 ContainerNode* editable = frame().selection().rootEditableElementOrTreeScope
RootNode(); |
| 369 ASSERT(editable); | 366 ASSERT(editable); |
| 370 return PlainTextRange::create(*editable, *range.get()); | 367 return PlainTextRange::create(*editable, *range.get()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 TypingCommand::deleteSelection(*frame().document()); | 419 TypingCommand::deleteSelection(*frame().document()); |
| 423 } | 420 } |
| 424 | 421 |
| 425 DEFINE_TRACE(InputMethodController) | 422 DEFINE_TRACE(InputMethodController) |
| 426 { | 423 { |
| 427 visitor->trace(m_frame); | 424 visitor->trace(m_frame); |
| 428 visitor->trace(m_compositionNode); | 425 visitor->trace(m_compositionNode); |
| 429 } | 426 } |
| 430 | 427 |
| 431 } // namespace blink | 428 } // namespace blink |
| OLD | NEW |