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()->repaint(); | 308 baseNode->renderer()->paintInvalidationForWholeRenderer(); |
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
, false, NotUserTriggered); | 313 m_frame.selection().setSelectedRange(selectedRange.get(), DOWNSTREAM
, false, 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 13 matching lines...) Expand all Loading... |
332 m_compositionNode = toText(baseNode); | 332 m_compositionNode = toText(baseNode); |
333 m_compositionStart = compositionStart; | 333 m_compositionStart = compositionStart; |
334 m_compositionEnd = compositionEnd; | 334 m_compositionEnd = compositionEnd; |
335 m_customCompositionUnderlines = underlines; | 335 m_customCompositionUnderlines = underlines; |
336 size_t numUnderlines = m_customCompositionUnderlines.size(); | 336 size_t numUnderlines = m_customCompositionUnderlines.size(); |
337 for (size_t i = 0; i < numUnderlines; ++i) { | 337 for (size_t i = 0; i < numUnderlines; ++i) { |
338 m_customCompositionUnderlines[i].startOffset += compositionStart; | 338 m_customCompositionUnderlines[i].startOffset += compositionStart; |
339 m_customCompositionUnderlines[i].endOffset += compositionStart; | 339 m_customCompositionUnderlines[i].endOffset += compositionStart; |
340 } | 340 } |
341 if (baseNode->renderer()) | 341 if (baseNode->renderer()) |
342 baseNode->renderer()->repaint(); | 342 baseNode->renderer()->paintInvalidationForWholeRenderer(); |
343 return; | 343 return; |
344 } | 344 } |
345 | 345 |
346 Editor::RevealSelectionScope revealSelectionScope(&editor()); | 346 Editor::RevealSelectionScope revealSelectionScope(&editor()); |
347 SelectionOffsetsScope selectionOffsetsScope(this); | 347 SelectionOffsetsScope selectionOffsetsScope(this); |
348 setSelectionOffsets(PlainTextRange(compositionStart, compositionEnd)); | 348 setSelectionOffsets(PlainTextRange(compositionStart, compositionEnd)); |
349 setComposition(m_frame.selectedText(), underlines, 0, 0); | 349 setComposition(m_frame.selectedText(), underlines, 0, 0); |
350 } | 350 } |
351 | 351 |
352 PassRefPtrWillBeRawPtr<Range> InputMethodController::compositionRange() const | 352 PassRefPtrWillBeRawPtr<Range> InputMethodController::compositionRange() const |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |