Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: third_party/WebKit/Source/core/editing/InputMethodController.cpp

Issue 2899923002: Change DocumentMarkerController::AddCompositionMarker() to take EphemeralRange (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.StartPosition(), 468 ephemeral_line_range, underline.GetColor(), underline.Thick(),
469 ephemeral_line_range.EndPosition(), underline.GetColor(), 469 underline.BackgroundColor());
470 underline.Thick(), underline.BackgroundColor());
471 } 470 }
472 } 471 }
473 472
474 bool InputMethodController::ReplaceCompositionAndMoveCaret( 473 bool InputMethodController::ReplaceCompositionAndMoveCaret(
475 const String& text, 474 const String& text,
476 int relative_caret_position, 475 int relative_caret_position,
477 const Vector<CompositionUnderline>& underlines) { 476 const Vector<CompositionUnderline>& underlines) {
478 Element* root_editable_element = 477 Element* root_editable_element =
479 GetFrame() 478 GetFrame()
480 .Selection() 479 .Selection()
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 682
684 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets 683 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets
685 // needs to be audited. see http://crbug.com/590369 for more details. 684 // needs to be audited. see http://crbug.com/590369 for more details.
686 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); 685 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
687 686
688 // We shouldn't close typing in the middle of setComposition. 687 // We shouldn't close typing in the middle of setComposition.
689 SetEditableSelectionOffsets(selected_range, kNotUserTriggered); 688 SetEditableSelectionOffsets(selected_range, kNotUserTriggered);
690 689
691 if (underlines.IsEmpty()) { 690 if (underlines.IsEmpty()) {
692 GetDocument().Markers().AddCompositionMarker( 691 GetDocument().Markers().AddCompositionMarker(
693 composition_range_->StartPosition(), composition_range_->EndPosition(), 692 EphemeralRange(composition_range_), Color::kBlack, false,
694 Color::kBlack, false,
695 LayoutTheme::GetTheme().PlatformDefaultCompositionBackgroundColor()); 693 LayoutTheme::GetTheme().PlatformDefaultCompositionBackgroundColor());
696 return; 694 return;
697 } 695 }
698 696
699 const PlainTextRange composition_plain_text_range = 697 const PlainTextRange composition_plain_text_range =
700 PlainTextRange::Create(*base_node->parentNode(), *composition_range_); 698 PlainTextRange::Create(*base_node->parentNode(), *composition_range_);
701 AddCompositionUnderlines(underlines, base_node->parentNode(), 699 AddCompositionUnderlines(underlines, base_node->parentNode(),
702 composition_plain_text_range.Start()); 700 composition_plain_text_range.Start());
703 } 701 }
704 702
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 FinishComposingText(kKeepSelection); 1235 FinishComposingText(kKeepSelection);
1238 } 1236 }
1239 1237
1240 DEFINE_TRACE(InputMethodController) { 1238 DEFINE_TRACE(InputMethodController) {
1241 visitor->Trace(frame_); 1239 visitor->Trace(frame_);
1242 visitor->Trace(composition_range_); 1240 visitor->Trace(composition_range_);
1243 SynchronousMutationObserver::Trace(visitor); 1241 SynchronousMutationObserver::Trace(visitor);
1244 } 1242 }
1245 1243
1246 } // namespace blink 1244 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698