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

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

Issue 2922233002: [ActiveSuggestionMarker #1] Introduce abstract StyleableMarker subclass of DocumentMarker (Closed)
Patch Set: DISALLOW_COPY_AND_ASSIGN() Created 3 years, 6 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
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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(), 468 ephemeral_line_range, underline.GetColor(),
469 underline.Thick() ? CompositionMarker::Thickness::kThick 469 underline.Thick() ? StyleableMarker::Thickness::kThick
470 : CompositionMarker::Thickness::kThin, 470 : StyleableMarker::Thickness::kThin,
471 underline.BackgroundColor()); 471 underline.BackgroundColor());
472 } 472 }
473 } 473 }
474 474
475 bool InputMethodController::ReplaceCompositionAndMoveCaret( 475 bool InputMethodController::ReplaceCompositionAndMoveCaret(
476 const String& text, 476 const String& text,
477 int relative_caret_position, 477 int relative_caret_position,
478 const Vector<CompositionUnderline>& underlines) { 478 const Vector<CompositionUnderline>& underlines) {
479 Element* root_editable_element = 479 Element* root_editable_element =
480 GetFrame() 480 GetFrame()
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets 685 // TODO(editing-dev): 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 GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); 687 GetDocument().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(selected_range, kNotUserTriggered); 690 SetEditableSelectionOffsets(selected_range, kNotUserTriggered);
691 691
692 if (underlines.IsEmpty()) { 692 if (underlines.IsEmpty()) {
693 GetDocument().Markers().AddCompositionMarker( 693 GetDocument().Markers().AddCompositionMarker(
694 EphemeralRange(composition_range_), Color::kBlack, 694 EphemeralRange(composition_range_), Color::kBlack,
695 CompositionMarker::Thickness::kThin, 695 StyleableMarker::Thickness::kThin,
696 LayoutTheme::GetTheme().PlatformDefaultCompositionBackgroundColor()); 696 LayoutTheme::GetTheme().PlatformDefaultCompositionBackgroundColor());
697 return; 697 return;
698 } 698 }
699 699
700 const PlainTextRange composition_plain_text_range = 700 const PlainTextRange composition_plain_text_range =
701 PlainTextRange::Create(*base_node->parentNode(), *composition_range_); 701 PlainTextRange::Create(*base_node->parentNode(), *composition_range_);
702 AddCompositionUnderlines(underlines, base_node->parentNode(), 702 AddCompositionUnderlines(underlines, base_node->parentNode(),
703 composition_plain_text_range.Start()); 703 composition_plain_text_range.Start());
704 } 704 }
705 705
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 FinishComposingText(kKeepSelection); 1238 FinishComposingText(kKeepSelection);
1239 } 1239 }
1240 1240
1241 DEFINE_TRACE(InputMethodController) { 1241 DEFINE_TRACE(InputMethodController) {
1242 visitor->Trace(frame_); 1242 visitor->Trace(frame_);
1243 visitor->Trace(composition_range_); 1243 visitor->Trace(composition_range_);
1244 SynchronousMutationObserver::Trace(visitor); 1244 SynchronousMutationObserver::Trace(visitor);
1245 } 1245 }
1246 1246
1247 } // namespace blink 1247 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698