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

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

Issue 2715913002: Introduce rootEditableElementOrTreeScopeRootNodeOf() as replacement of FrameSelection member (Closed)
Patch Set: 2017-02-24T16:18:33 Created 3 years, 9 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 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 return plainText( 691 return plainText(
692 compositionEphemeralRange(), 692 compositionEphemeralRange(),
693 TextIteratorBehavior::Builder().setEmitsOriginalText(true).build()); 693 TextIteratorBehavior::Builder().setEmitsOriginalText(true).build());
694 } 694 }
695 695
696 PlainTextRange InputMethodController::getSelectionOffsets() const { 696 PlainTextRange InputMethodController::getSelectionOffsets() const {
697 EphemeralRange range = firstEphemeralRangeOf( 697 EphemeralRange range = firstEphemeralRangeOf(
698 frame().selection().computeVisibleSelectionInDOMTreeDeprecated()); 698 frame().selection().computeVisibleSelectionInDOMTreeDeprecated());
699 if (range.isNull()) 699 if (range.isNull())
700 return PlainTextRange(); 700 return PlainTextRange();
701 ContainerNode* editable = 701 ContainerNode* const editable = rootEditableElementOrTreeScopeRootNodeOf(
702 frame().selection().rootEditableElementOrTreeScopeRootNode(); 702 frame().selection().computeVisibleSelectionInDOMTreeDeprecated());
703 DCHECK(editable); 703 DCHECK(editable);
704 return PlainTextRange::create(*editable, range); 704 return PlainTextRange::create(*editable, range);
705 } 705 }
706 706
707 EphemeralRange InputMethodController::ephemeralRangeForOffsets( 707 EphemeralRange InputMethodController::ephemeralRangeForOffsets(
708 const PlainTextRange& offsets) const { 708 const PlainTextRange& offsets) const {
709 if (offsets.isNull()) 709 if (offsets.isNull())
710 return EphemeralRange(); 710 return EphemeralRange();
711 Element* rootEditableElement = 711 Element* rootEditableElement =
712 frame() 712 frame()
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 finishComposingText(KeepSelection); 1125 finishComposingText(KeepSelection);
1126 } 1126 }
1127 1127
1128 DEFINE_TRACE(InputMethodController) { 1128 DEFINE_TRACE(InputMethodController) {
1129 visitor->trace(m_frame); 1129 visitor->trace(m_frame);
1130 visitor->trace(m_compositionRange); 1130 visitor->trace(m_compositionRange);
1131 SynchronousMutationObserver::trace(visitor); 1131 SynchronousMutationObserver::trace(visitor);
1132 } 1132 }
1133 1133
1134 } // namespace blink 1134 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698