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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 m_compositionNode = toText(baseNode); | 298 m_compositionNode = toText(baseNode); |
299 m_compositionStart = baseOffset; | 299 m_compositionStart = baseOffset; |
300 m_compositionEnd = extentOffset; | 300 m_compositionEnd = extentOffset; |
301 m_customCompositionUnderlines = underlines; | 301 m_customCompositionUnderlines = underlines; |
302 size_t numUnderlines = m_customCompositionUnderlines.size(); | 302 size_t numUnderlines = m_customCompositionUnderlines.size(); |
303 for (size_t i = 0; i < numUnderlines; ++i) { | 303 for (size_t i = 0; i < numUnderlines; ++i) { |
304 m_customCompositionUnderlines[i].startOffset += baseOffset; | 304 m_customCompositionUnderlines[i].startOffset += baseOffset; |
305 m_customCompositionUnderlines[i].endOffset += baseOffset; | 305 m_customCompositionUnderlines[i].endOffset += baseOffset; |
306 } | 306 } |
307 if (baseNode->renderer()) | 307 if (baseNode->renderer()) |
308 baseNode->renderer()->paintInvalidationForWholeRenderer(); | 308 baseNode->renderer()->setShouldDoFullPaintInvalidation(true); |
309 | 309 |
310 unsigned start = std::min(baseOffset + selectionStart, extentOffset)
; | 310 unsigned start = std::min(baseOffset + selectionStart, extentOffset)
; |
311 unsigned end = std::min(std::max(start, baseOffset + selectionEnd),
extentOffset); | 311 unsigned end = std::min(std::max(start, baseOffset + selectionEnd),
extentOffset); |
312 RefPtrWillBeRawPtr<Range> selectedRange = Range::create(baseNode->do
cument(), baseNode, start, baseNode, end); | 312 RefPtrWillBeRawPtr<Range> selectedRange = Range::create(baseNode->do
cument(), baseNode, start, baseNode, end); |
313 m_frame.selection().setSelectedRange(selectedRange.get(), DOWNSTREAM
, FrameSelection::NonDirectional, NotUserTriggered); | 313 m_frame.selection().setSelectedRange(selectedRange.get(), DOWNSTREAM
, FrameSelection::NonDirectional, NotUserTriggered); |
314 } | 314 } |
315 } | 315 } |
316 } | 316 } |
317 | 317 |
318 void InputMethodController::setCompositionFromExistingText(const Vector<Composit
ionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd) | 318 void InputMethodController::setCompositionFromExistingText(const Vector<Composit
ionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd) |
(...skipping 14 matching lines...) Expand all Loading... |
333 RefPtrWillBeRawPtr<Range> range = PlainTextRange(compositionStart, compo
sitionEnd).createRange(*editable); | 333 RefPtrWillBeRawPtr<Range> range = PlainTextRange(compositionStart, compo
sitionEnd).createRange(*editable); |
334 m_compositionStart = range->startOffset(); | 334 m_compositionStart = range->startOffset(); |
335 m_compositionEnd = range->endOffset(); | 335 m_compositionEnd = range->endOffset(); |
336 m_customCompositionUnderlines = underlines; | 336 m_customCompositionUnderlines = underlines; |
337 size_t numUnderlines = m_customCompositionUnderlines.size(); | 337 size_t numUnderlines = m_customCompositionUnderlines.size(); |
338 for (size_t i = 0; i < numUnderlines; ++i) { | 338 for (size_t i = 0; i < numUnderlines; ++i) { |
339 m_customCompositionUnderlines[i].startOffset += m_compositionStart; | 339 m_customCompositionUnderlines[i].startOffset += m_compositionStart; |
340 m_customCompositionUnderlines[i].endOffset += m_compositionStart; | 340 m_customCompositionUnderlines[i].endOffset += m_compositionStart; |
341 } | 341 } |
342 if (baseNode->renderer()) | 342 if (baseNode->renderer()) |
343 baseNode->renderer()->paintInvalidationForWholeRenderer(); | 343 baseNode->renderer()->setShouldDoFullPaintInvalidation(true); |
344 return; | 344 return; |
345 } | 345 } |
346 | 346 |
347 Editor::RevealSelectionScope revealSelectionScope(&editor()); | 347 Editor::RevealSelectionScope revealSelectionScope(&editor()); |
348 SelectionOffsetsScope selectionOffsetsScope(this); | 348 SelectionOffsetsScope selectionOffsetsScope(this); |
349 setSelectionOffsets(PlainTextRange(compositionStart, compositionEnd)); | 349 setSelectionOffsets(PlainTextRange(compositionStart, compositionEnd)); |
350 setComposition(m_frame.selectedText(), underlines, 0, 0); | 350 setComposition(m_frame.selectedText(), underlines, 0, 0); |
351 } | 351 } |
352 | 352 |
353 PassRefPtrWillBeRawPtr<Range> InputMethodController::compositionRange() const | 353 PassRefPtrWillBeRawPtr<Range> InputMethodController::compositionRange() const |
(...skipping 64 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 |