| 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 } | 372 } |
| 373 | 373 |
| 374 bool InputMethodController::setSelectionOffsets(const PlainTextRange& selectionO
ffsets) | 374 bool InputMethodController::setSelectionOffsets(const PlainTextRange& selectionO
ffsets) |
| 375 { | 375 { |
| 376 if (selectionOffsets.isNull()) | 376 if (selectionOffsets.isNull()) |
| 377 return false; | 377 return false; |
| 378 Element* rootEditableElement = m_frame.selection().rootEditableElement(); | 378 Element* rootEditableElement = m_frame.selection().rootEditableElement(); |
| 379 if (!rootEditableElement) | 379 if (!rootEditableElement) |
| 380 return false; | 380 return false; |
| 381 | 381 |
| 382 RefPtrWillBeRawPtr<Range> range = selectionOffsets.createRange(*rootEditable
Element); | 382 RefPtrWillBeRawPtr<Range> range = selectionOffsets.createRangeForInput(*root
EditableElement); |
| 383 if (!range) | 383 if (!range) |
| 384 return false; | 384 return false; |
| 385 | 385 |
| 386 return m_frame.selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY
, FrameSelection::CloseTyping); | 386 return m_frame.selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY
, FrameSelection::CloseTyping); |
| 387 } | 387 } |
| 388 | 388 |
| 389 bool InputMethodController::setEditableSelectionOffsets(const PlainTextRange& se
lectionOffsets) | 389 bool InputMethodController::setEditableSelectionOffsets(const PlainTextRange& se
lectionOffsets) |
| 390 { | 390 { |
| 391 if (!editor().canEdit()) | 391 if (!editor().canEdit()) |
| 392 return false; | 392 return false; |
| 393 return setSelectionOffsets(selectionOffsets); | 393 return setSelectionOffsets(selectionOffsets); |
| 394 } | 394 } |
| 395 | 395 |
| 396 void InputMethodController::extendSelectionAndDelete(int before, int after) | 396 void InputMethodController::extendSelectionAndDelete(int before, int after) |
| 397 { | 397 { |
| 398 if (!editor().canEdit()) | 398 if (!editor().canEdit()) |
| 399 return; | 399 return; |
| 400 PlainTextRange selectionOffsets(getSelectionOffsets()); | 400 PlainTextRange selectionOffsets(getSelectionOffsets()); |
| 401 if (selectionOffsets.isNull()) | 401 if (selectionOffsets.isNull()) |
| 402 return; | 402 return; |
| 403 setSelectionOffsets(PlainTextRange(std::max(static_cast<int>(selectionOffset
s.start()) - before, 0), selectionOffsets.end() + after)); | 403 setSelectionOffsets(PlainTextRange(std::max(static_cast<int>(selectionOffset
s.start()) - before, 0), selectionOffsets.end() + after)); |
| 404 TypingCommand::deleteSelection(*m_frame.document()); | 404 TypingCommand::deleteSelection(*m_frame.document()); |
| 405 } | 405 } |
| 406 | 406 |
| 407 } // namespace WebCore | 407 } // namespace WebCore |
| OLD | NEW |