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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 if (start >= end) | 360 if (start >= end) |
361 return nullptr; | 361 return nullptr; |
362 return Range::create(m_compositionNode->document(), m_compositionNode.get(),
start, m_compositionNode.get(), end); | 362 return Range::create(m_compositionNode->document(), m_compositionNode.get(),
start, m_compositionNode.get(), end); |
363 } | 363 } |
364 | 364 |
365 PlainTextRange InputMethodController::getSelectionOffsets() const | 365 PlainTextRange InputMethodController::getSelectionOffsets() const |
366 { | 366 { |
367 RefPtrWillBeRawPtr<Range> range = m_frame.selection().selection().firstRange
(); | 367 RefPtrWillBeRawPtr<Range> range = m_frame.selection().selection().firstRange
(); |
368 if (!range) | 368 if (!range) |
369 return PlainTextRange(); | 369 return PlainTextRange(); |
370 Node* editable = m_frame.selection().rootEditableElementOrTreeScopeRootNode(
); | 370 ContainerNode* editable = m_frame.selection().rootEditableElementOrTreeScope
RootNode(); |
371 ASSERT(editable); | 371 ASSERT(editable); |
372 return PlainTextRange::create(*editable, *range.get()); | 372 return PlainTextRange::create(*editable, *range.get()); |
373 } | 373 } |
374 | 374 |
375 bool InputMethodController::setSelectionOffsets(const PlainTextRange& selectionO
ffsets) | 375 bool InputMethodController::setSelectionOffsets(const PlainTextRange& selectionO
ffsets) |
376 { | 376 { |
377 if (selectionOffsets.isNull()) | 377 if (selectionOffsets.isNull()) |
378 return false; | 378 return false; |
379 Element* rootEditableElement = m_frame.selection().rootEditableElement(); | 379 Element* rootEditableElement = m_frame.selection().rootEditableElement(); |
380 if (!rootEditableElement) | 380 if (!rootEditableElement) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 if (!setSelectionOffsets(PlainTextRange(std::max(static_cast<int>(select
ionOffsets.start()) - before, 0), selectionOffsets.end() + after))) | 418 if (!setSelectionOffsets(PlainTextRange(std::max(static_cast<int>(select
ionOffsets.start()) - before, 0), selectionOffsets.end() + after))) |
419 return; | 419 return; |
420 if (before == 0) | 420 if (before == 0) |
421 break; | 421 break; |
422 ++before; | 422 ++before; |
423 } while (m_frame.selection().start() == m_frame.selection().end() && before
<= static_cast<int>(selectionOffsets.start())); | 423 } while (m_frame.selection().start() == m_frame.selection().end() && before
<= static_cast<int>(selectionOffsets.start())); |
424 TypingCommand::deleteSelection(*m_frame.document()); | 424 TypingCommand::deleteSelection(*m_frame.document()); |
425 } | 425 } |
426 | 426 |
427 } // namespace blink | 427 } // namespace blink |
OLD | NEW |