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

Side by Side Diff: Source/core/editing/iterators/TextIterator.cpp

Issue 1300823002: Introduce PositionAlgorithm<Strategy>::editingPositionOf() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-18T17:38:11 Created 5 years, 4 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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
3 * Copyright (C) 2005 Alexey Proskuryakov. 3 * Copyright (C) 2005 Alexey Proskuryakov.
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 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 if (m_textState.positionNode()) { 1050 if (m_textState.positionNode()) {
1051 return m_textState.positionNode(); 1051 return m_textState.positionNode();
1052 } 1052 }
1053 ASSERT(m_endContainer); 1053 ASSERT(m_endContainer);
1054 return m_endContainer; 1054 return m_endContainer;
1055 } 1055 }
1056 1056
1057 template<typename Strategy> 1057 template<typename Strategy>
1058 PositionAlgorithm<Strategy> TextIteratorAlgorithm<Strategy>::startPositionInCurr entContainer() const 1058 PositionAlgorithm<Strategy> TextIteratorAlgorithm<Strategy>::startPositionInCurr entContainer() const
1059 { 1059 {
1060 return PositionAlgorithm<Strategy>::createLegacyEditingPosition(currentConta iner(), startOffsetInCurrentContainer()); 1060 return PositionAlgorithm<Strategy>::editingPositionOf(currentContainer(), st artOffsetInCurrentContainer());
1061 } 1061 }
1062 1062
1063 template<typename Strategy> 1063 template<typename Strategy>
1064 PositionAlgorithm<Strategy> TextIteratorAlgorithm<Strategy>::endPositionInCurren tContainer() const 1064 PositionAlgorithm<Strategy> TextIteratorAlgorithm<Strategy>::endPositionInCurren tContainer() const
1065 { 1065 {
1066 return PositionAlgorithm<Strategy>::createLegacyEditingPosition(currentConta iner(), endOffsetInCurrentContainer()); 1066 return PositionAlgorithm<Strategy>::editingPositionOf(currentContainer(), en dOffsetInCurrentContainer());
1067 } 1067 }
1068 1068
1069 template<typename Strategy> 1069 template<typename Strategy>
1070 int TextIteratorAlgorithm<Strategy>::rangeLength(const PositionAlgorithm<Strateg y>& start, const PositionAlgorithm<Strategy>& end, bool forSelectionPreservation ) 1070 int TextIteratorAlgorithm<Strategy>::rangeLength(const PositionAlgorithm<Strateg y>& start, const PositionAlgorithm<Strategy>& end, bool forSelectionPreservation )
1071 { 1071 {
1072 int length = 0; 1072 int length = 0;
1073 TextIteratorBehaviorFlags behaviorFlags = TextIteratorEmitsObjectReplacement Character; 1073 TextIteratorBehaviorFlags behaviorFlags = TextIteratorEmitsObjectReplacement Character;
1074 if (forSelectionPreservation) 1074 if (forSelectionPreservation)
1075 behaviorFlags |= TextIteratorEmitsCharactersBetweenAllVisiblePositions; 1075 behaviorFlags |= TextIteratorEmitsCharactersBetweenAllVisiblePositions;
1076 for (TextIteratorAlgorithm<Strategy> it(start, end, behaviorFlags); !it.atEn d(); it.advance()) 1076 for (TextIteratorAlgorithm<Strategy> it(start, end, behaviorFlags); !it.atEn d(); it.advance())
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 1113
1114 String plainText(const EphemeralRangeInComposedTree& range, TextIteratorBehavior Flags behavior) 1114 String plainText(const EphemeralRangeInComposedTree& range, TextIteratorBehavior Flags behavior)
1115 { 1115 {
1116 return createPlainText<EditingInComposedTreeStrategy>(range, behavior); 1116 return createPlainText<EditingInComposedTreeStrategy>(range, behavior);
1117 } 1117 }
1118 1118
1119 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingStrategy>; 1119 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingStrategy>;
1120 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingInComposedTreeS trategy>; 1120 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingInComposedTreeS trategy>;
1121 1121
1122 } // namespace blink 1122 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/iterators/SimplifiedBackwardsTextIterator.cpp ('k') | Source/core/editing/spellcheck/SpellChecker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698