| 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 m_customCompositionUnderlines = underlines; | 299 m_customCompositionUnderlines = underlines; |
| 300 size_t numUnderlines = m_customCompositionUnderlines.size(); | 300 size_t numUnderlines = m_customCompositionUnderlines.size(); |
| 301 for (size_t i = 0; i < numUnderlines; ++i) { | 301 for (size_t i = 0; i < numUnderlines; ++i) { |
| 302 m_customCompositionUnderlines[i].startOffset += baseOffset; | 302 m_customCompositionUnderlines[i].startOffset += baseOffset; |
| 303 m_customCompositionUnderlines[i].endOffset += baseOffset; | 303 m_customCompositionUnderlines[i].endOffset += baseOffset; |
| 304 } | 304 } |
| 305 | 305 |
| 306 // TODO(ojan): What was this for? Do we need it in sky since we | 306 // TODO(ojan): What was this for? Do we need it in sky since we |
| 307 // don't need to support legacy IMEs? | 307 // don't need to support legacy IMEs? |
| 308 if (baseNode->renderer()) | 308 if (baseNode->renderer()) |
| 309 baseNode->renderer()->scheduleVisualUpdate(); | 309 baseNode->document().scheduleVisualUpdate(); |
| 310 | 310 |
| 311 unsigned start = std::min(baseOffset + selectionStart, extentOffset)
; | 311 unsigned start = std::min(baseOffset + selectionStart, extentOffset)
; |
| 312 unsigned end = std::min(std::max(start, baseOffset + selectionEnd),
extentOffset); | 312 unsigned end = std::min(std::max(start, baseOffset + selectionEnd),
extentOffset); |
| 313 RefPtr<Range> selectedRange = Range::create(baseNode->document(), ba
seNode, start, baseNode, end); | 313 RefPtr<Range> selectedRange = Range::create(baseNode->document(), ba
seNode, start, baseNode, end); |
| 314 m_frame.selection().setSelectedRange(selectedRange.get(), DOWNSTREAM
, FrameSelection::NonDirectional, NotUserTriggered); | 314 m_frame.selection().setSelectedRange(selectedRange.get(), DOWNSTREAM
, FrameSelection::NonDirectional, NotUserTriggered); |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 } | 317 } |
| 318 | 318 |
| 319 void InputMethodController::setCompositionFromExistingText(const Vector<Composit
ionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd) | 319 void InputMethodController::setCompositionFromExistingText(const Vector<Composit
ionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 337 m_customCompositionUnderlines = underlines; | 337 m_customCompositionUnderlines = underlines; |
| 338 size_t numUnderlines = m_customCompositionUnderlines.size(); | 338 size_t numUnderlines = m_customCompositionUnderlines.size(); |
| 339 for (size_t i = 0; i < numUnderlines; ++i) { | 339 for (size_t i = 0; i < numUnderlines; ++i) { |
| 340 m_customCompositionUnderlines[i].startOffset += m_compositionStart; | 340 m_customCompositionUnderlines[i].startOffset += m_compositionStart; |
| 341 m_customCompositionUnderlines[i].endOffset += m_compositionStart; | 341 m_customCompositionUnderlines[i].endOffset += m_compositionStart; |
| 342 } | 342 } |
| 343 | 343 |
| 344 // TODO(ojan): What was this for? Do we need it in sky since we | 344 // TODO(ojan): What was this for? Do we need it in sky since we |
| 345 // don't need to support legacy IMEs? | 345 // don't need to support legacy IMEs? |
| 346 if (baseNode->renderer()) | 346 if (baseNode->renderer()) |
| 347 baseNode->renderer()->scheduleVisualUpdate(); | 347 baseNode->document().scheduleVisualUpdate(); |
| 348 | 348 |
| 349 return; | 349 return; |
| 350 } | 350 } |
| 351 | 351 |
| 352 Editor::RevealSelectionScope revealSelectionScope(&editor()); | 352 Editor::RevealSelectionScope revealSelectionScope(&editor()); |
| 353 SelectionOffsetsScope selectionOffsetsScope(this); | 353 SelectionOffsetsScope selectionOffsetsScope(this); |
| 354 setSelectionOffsets(PlainTextRange(compositionStart, compositionEnd)); | 354 setSelectionOffsets(PlainTextRange(compositionStart, compositionEnd)); |
| 355 setComposition(m_frame.selectedText(), underlines, 0, 0); | 355 setComposition(m_frame.selectedText(), underlines, 0, 0); |
| 356 } | 356 } |
| 357 | 357 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 if (!setSelectionOffsets(PlainTextRange(std::max(static_cast<int>(select
ionOffsets.start()) - before, 0), selectionOffsets.end() + after))) | 423 if (!setSelectionOffsets(PlainTextRange(std::max(static_cast<int>(select
ionOffsets.start()) - before, 0), selectionOffsets.end() + after))) |
| 424 return; | 424 return; |
| 425 if (before == 0) | 425 if (before == 0) |
| 426 break; | 426 break; |
| 427 ++before; | 427 ++before; |
| 428 } while (m_frame.selection().start() == m_frame.selection().end() && before
<= static_cast<int>(selectionOffsets.start())); | 428 } while (m_frame.selection().start() == m_frame.selection().end() && before
<= static_cast<int>(selectionOffsets.start())); |
| 429 TypingCommand::deleteSelection(*m_frame.document()); | 429 TypingCommand::deleteSelection(*m_frame.document()); |
| 430 } | 430 } |
| 431 | 431 |
| 432 } // namespace blink | 432 } // namespace blink |
| OLD | NEW |