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

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

Issue 2771603002: [WIP] Change DocumentMarkerController::add*Marker() methods to take an EphemeralRange (Closed)
Patch Set: Rebase Created 3 years, 8 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 for (const auto& underline : underlines) { 441 for (const auto& underline : underlines) {
442 unsigned underlineStart = offsetInPlainChars + underline.startOffset(); 442 unsigned underlineStart = offsetInPlainChars + underline.startOffset();
443 unsigned underlineEnd = offsetInPlainChars + underline.endOffset(); 443 unsigned underlineEnd = offsetInPlainChars + underline.endOffset();
444 444
445 EphemeralRange ephemeralLineRange = 445 EphemeralRange ephemeralLineRange =
446 PlainTextRange(underlineStart, underlineEnd).createRange(*baseElement); 446 PlainTextRange(underlineStart, underlineEnd).createRange(*baseElement);
447 if (ephemeralLineRange.isNull()) 447 if (ephemeralLineRange.isNull())
448 continue; 448 continue;
449 449
450 document().markers().addCompositionMarker( 450 document().markers().addCompositionMarker(
451 ephemeralLineRange.startPosition(), ephemeralLineRange.endPosition(), 451 ephemeralLineRange, underline.color(), underline.thick(),
452 underline.color(), underline.thick(), underline.backgroundColor()); 452 underline.backgroundColor());
453 } 453 }
454 } 454 }
455 455
456 bool InputMethodController::replaceCompositionAndMoveCaret( 456 bool InputMethodController::replaceCompositionAndMoveCaret(
457 const String& text, 457 const String& text,
458 int relativeCaretPosition, 458 int relativeCaretPosition,
459 const Vector<CompositionUnderline>& underlines) { 459 const Vector<CompositionUnderline>& underlines) {
460 Element* rootEditableElement = 460 Element* rootEditableElement =
461 frame() 461 frame()
462 .selection() 462 .selection()
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 688
689 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets 689 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
690 // needs to be audited. see http://crbug.com/590369 for more details. 690 // needs to be audited. see http://crbug.com/590369 for more details.
691 document().updateStyleAndLayoutIgnorePendingStylesheets(); 691 document().updateStyleAndLayoutIgnorePendingStylesheets();
692 692
693 // We shouldn't close typing in the middle of setComposition. 693 // We shouldn't close typing in the middle of setComposition.
694 setEditableSelectionOffsets(selectedRange, NotUserTriggered); 694 setEditableSelectionOffsets(selectedRange, NotUserTriggered);
695 695
696 if (underlines.isEmpty()) { 696 if (underlines.isEmpty()) {
697 document().markers().addCompositionMarker( 697 document().markers().addCompositionMarker(
698 m_compositionRange->startPosition(), m_compositionRange->endPosition(), 698 EphemeralRange(m_compositionRange), Color::black, false,
699 Color::black, false,
700 LayoutTheme::theme().platformDefaultCompositionBackgroundColor()); 699 LayoutTheme::theme().platformDefaultCompositionBackgroundColor());
701 return; 700 return;
702 } 701 }
703 702
704 const PlainTextRange compositionPlainTextRange = 703 const PlainTextRange compositionPlainTextRange =
705 PlainTextRange::create(*baseNode->parentNode(), *m_compositionRange); 704 PlainTextRange::create(*baseNode->parentNode(), *m_compositionRange);
706 addCompositionUnderlines(underlines, baseNode->parentNode(), 705 addCompositionUnderlines(underlines, baseNode->parentNode(),
707 compositionPlainTextRange.start()); 706 compositionPlainTextRange.start());
708 } 707 }
709 708
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 finishComposingText(KeepSelection); 1239 finishComposingText(KeepSelection);
1241 } 1240 }
1242 1241
1243 DEFINE_TRACE(InputMethodController) { 1242 DEFINE_TRACE(InputMethodController) {
1244 visitor->trace(m_frame); 1243 visitor->trace(m_frame);
1245 visitor->trace(m_compositionRange); 1244 visitor->trace(m_compositionRange);
1246 SynchronousMutationObserver::trace(visitor); 1245 SynchronousMutationObserver::trace(visitor);
1247 } 1246 }
1248 1247
1249 } // namespace blink 1248 } // 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