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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 unsigned underline_start = offset_in_plain_chars + underline.StartOffset(); | 458 unsigned underline_start = offset_in_plain_chars + underline.StartOffset(); |
459 unsigned underline_end = offset_in_plain_chars + underline.EndOffset(); | 459 unsigned underline_end = offset_in_plain_chars + underline.EndOffset(); |
460 | 460 |
461 EphemeralRange ephemeral_line_range = | 461 EphemeralRange ephemeral_line_range = |
462 PlainTextRange(underline_start, underline_end) | 462 PlainTextRange(underline_start, underline_end) |
463 .CreateRange(*base_element); | 463 .CreateRange(*base_element); |
464 if (ephemeral_line_range.IsNull()) | 464 if (ephemeral_line_range.IsNull()) |
465 continue; | 465 continue; |
466 | 466 |
467 GetDocument().Markers().AddCompositionMarker( | 467 GetDocument().Markers().AddCompositionMarker( |
468 ephemeral_line_range, underline.GetColor(), underline.Thick(), | 468 ephemeral_line_range, underline.GetColor(), |
| 469 underline.Thick() ? CompositionMarker::Thickness::kThick |
| 470 : CompositionMarker::Thickness::kThin, |
469 underline.BackgroundColor()); | 471 underline.BackgroundColor()); |
470 } | 472 } |
471 } | 473 } |
472 | 474 |
473 bool InputMethodController::ReplaceCompositionAndMoveCaret( | 475 bool InputMethodController::ReplaceCompositionAndMoveCaret( |
474 const String& text, | 476 const String& text, |
475 int relative_caret_position, | 477 int relative_caret_position, |
476 const Vector<CompositionUnderline>& underlines) { | 478 const Vector<CompositionUnderline>& underlines) { |
477 Element* root_editable_element = | 479 Element* root_editable_element = |
478 GetFrame() | 480 GetFrame() |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 | 684 |
683 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets | 685 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets |
684 // 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. |
685 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); | 687 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); |
686 | 688 |
687 // We shouldn't close typing in the middle of setComposition. | 689 // We shouldn't close typing in the middle of setComposition. |
688 SetEditableSelectionOffsets(selected_range, kNotUserTriggered); | 690 SetEditableSelectionOffsets(selected_range, kNotUserTriggered); |
689 | 691 |
690 if (underlines.IsEmpty()) { | 692 if (underlines.IsEmpty()) { |
691 GetDocument().Markers().AddCompositionMarker( | 693 GetDocument().Markers().AddCompositionMarker( |
692 EphemeralRange(composition_range_), Color::kBlack, false, | 694 EphemeralRange(composition_range_), Color::kBlack, |
| 695 CompositionMarker::Thickness::kThin, |
693 LayoutTheme::GetTheme().PlatformDefaultCompositionBackgroundColor()); | 696 LayoutTheme::GetTheme().PlatformDefaultCompositionBackgroundColor()); |
694 return; | 697 return; |
695 } | 698 } |
696 | 699 |
697 const PlainTextRange composition_plain_text_range = | 700 const PlainTextRange composition_plain_text_range = |
698 PlainTextRange::Create(*base_node->parentNode(), *composition_range_); | 701 PlainTextRange::Create(*base_node->parentNode(), *composition_range_); |
699 AddCompositionUnderlines(underlines, base_node->parentNode(), | 702 AddCompositionUnderlines(underlines, base_node->parentNode(), |
700 composition_plain_text_range.Start()); | 703 composition_plain_text_range.Start()); |
701 } | 704 } |
702 | 705 |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 FinishComposingText(kKeepSelection); | 1238 FinishComposingText(kKeepSelection); |
1236 } | 1239 } |
1237 | 1240 |
1238 DEFINE_TRACE(InputMethodController) { | 1241 DEFINE_TRACE(InputMethodController) { |
1239 visitor->Trace(frame_); | 1242 visitor->Trace(frame_); |
1240 visitor->Trace(composition_range_); | 1243 visitor->Trace(composition_range_); |
1241 SynchronousMutationObserver::Trace(visitor); | 1244 SynchronousMutationObserver::Trace(visitor); |
1242 } | 1245 } |
1243 | 1246 |
1244 } // namespace blink | 1247 } // namespace blink |
OLD | NEW |