| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 for (const auto& underline : underlines) { | 437 for (const auto& underline : underlines) { |
| 438 unsigned underlineStart = offsetInPlainChars + underline.startOffset(); | 438 unsigned underlineStart = offsetInPlainChars + underline.startOffset(); |
| 439 unsigned underlineEnd = offsetInPlainChars + underline.endOffset(); | 439 unsigned underlineEnd = offsetInPlainChars + underline.endOffset(); |
| 440 | 440 |
| 441 EphemeralRange ephemeralLineRange = | 441 EphemeralRange ephemeralLineRange = |
| 442 PlainTextRange(underlineStart, underlineEnd).createRange(*baseElement); | 442 PlainTextRange(underlineStart, underlineEnd).createRange(*baseElement); |
| 443 if (ephemeralLineRange.isNull()) | 443 if (ephemeralLineRange.isNull()) |
| 444 continue; | 444 continue; |
| 445 | 445 |
| 446 document().markers().addCompositionMarker( | 446 document().markers().addCompositionMarker( |
| 447 ephemeralLineRange.startPosition(), ephemeralLineRange.endPosition(), | 447 ephemeralLineRange, underline.color(), underline.thick(), |
| 448 underline.color(), underline.thick(), underline.backgroundColor()); | 448 underline.backgroundColor()); |
| 449 } | 449 } |
| 450 } | 450 } |
| 451 | 451 |
| 452 bool InputMethodController::replaceCompositionAndMoveCaret( | 452 bool InputMethodController::replaceCompositionAndMoveCaret( |
| 453 const String& text, | 453 const String& text, |
| 454 int relativeCaretPosition, | 454 int relativeCaretPosition, |
| 455 const Vector<CompositionUnderline>& underlines) { | 455 const Vector<CompositionUnderline>& underlines) { |
| 456 Element* rootEditableElement = | 456 Element* rootEditableElement = |
| 457 frame() | 457 frame() |
| 458 .selection() | 458 .selection() |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 | 684 |
| 685 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets | 685 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
| 686 // needs to be audited. see http://crbug.com/590369 for more details. | 686 // needs to be audited. see http://crbug.com/590369 for more details. |
| 687 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 687 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 688 | 688 |
| 689 // We shouldn't close typing in the middle of setComposition. | 689 // We shouldn't close typing in the middle of setComposition. |
| 690 setEditableSelectionOffsets(selectedRange, NotUserTriggered); | 690 setEditableSelectionOffsets(selectedRange, NotUserTriggered); |
| 691 | 691 |
| 692 if (underlines.isEmpty()) { | 692 if (underlines.isEmpty()) { |
| 693 document().markers().addCompositionMarker( | 693 document().markers().addCompositionMarker( |
| 694 m_compositionRange->startPosition(), m_compositionRange->endPosition(), | 694 EphemeralRange(m_compositionRange), Color::black, false, |
| 695 Color::black, false, | |
| 696 LayoutTheme::theme().platformDefaultCompositionBackgroundColor()); | 695 LayoutTheme::theme().platformDefaultCompositionBackgroundColor()); |
| 697 return; | 696 return; |
| 698 } | 697 } |
| 699 | 698 |
| 700 const PlainTextRange compositionPlainTextRange = | 699 const PlainTextRange compositionPlainTextRange = |
| 701 PlainTextRange::create(*baseNode->parentNode(), *m_compositionRange); | 700 PlainTextRange::create(*baseNode->parentNode(), *m_compositionRange); |
| 702 addCompositionUnderlines(underlines, baseNode->parentNode(), | 701 addCompositionUnderlines(underlines, baseNode->parentNode(), |
| 703 compositionPlainTextRange.start()); | 702 compositionPlainTextRange.start()); |
| 704 } | 703 } |
| 705 | 704 |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1242 finishComposingText(KeepSelection); | 1241 finishComposingText(KeepSelection); |
| 1243 } | 1242 } |
| 1244 | 1243 |
| 1245 DEFINE_TRACE(InputMethodController) { | 1244 DEFINE_TRACE(InputMethodController) { |
| 1246 visitor->trace(m_frame); | 1245 visitor->trace(m_frame); |
| 1247 visitor->trace(m_compositionRange); | 1246 visitor->trace(m_compositionRange); |
| 1248 SynchronousMutationObserver::trace(visitor); | 1247 SynchronousMutationObserver::trace(visitor); |
| 1249 } | 1248 } |
| 1250 | 1249 |
| 1251 } // namespace blink | 1250 } // namespace blink |
| OLD | NEW |