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

Side by Side Diff: Source/core/editing/iterators/BackwardsCharacterIterator.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 28 matching lines...) Expand all
39 while (!atEnd() && !m_textIterator.length()) 39 while (!atEnd() && !m_textIterator.length())
40 m_textIterator.advance(); 40 m_textIterator.advance();
41 } 41 }
42 42
43 template <typename Strategy> 43 template <typename Strategy>
44 PositionAlgorithm<Strategy> BackwardsCharacterIteratorAlgorithm<Strategy>::endPo sition() const 44 PositionAlgorithm<Strategy> BackwardsCharacterIteratorAlgorithm<Strategy>::endPo sition() const
45 { 45 {
46 if (!m_textIterator.atEnd()) { 46 if (!m_textIterator.atEnd()) {
47 if (m_textIterator.length() > 1) { 47 if (m_textIterator.length() > 1) {
48 Node* n = m_textIterator.startContainer(); 48 Node* n = m_textIterator.startContainer();
49 return PositionAlgorithm<Strategy>::createLegacyEditingPosition(n, m _textIterator.endOffset() - m_runOffset); 49 return PositionAlgorithm<Strategy>::editingPositionOf(n, m_textItera tor.endOffset() - m_runOffset);
50 } 50 }
51 ASSERT(!m_runOffset); 51 ASSERT(!m_runOffset);
52 } 52 }
53 return m_textIterator.endPosition(); 53 return m_textIterator.endPosition();
54 } 54 }
55 55
56 template <typename Strategy> 56 template <typename Strategy>
57 void BackwardsCharacterIteratorAlgorithm<Strategy>::advance(int count) 57 void BackwardsCharacterIteratorAlgorithm<Strategy>::advance(int count)
58 { 58 {
59 if (count <= 0) { 59 if (count <= 0) {
(...skipping 30 matching lines...) Expand all
90 } 90 }
91 91
92 m_atBreak = true; 92 m_atBreak = true;
93 m_runOffset = 0; 93 m_runOffset = 0;
94 } 94 }
95 95
96 template class CORE_TEMPLATE_EXPORT BackwardsCharacterIteratorAlgorithm<EditingS trategy>; 96 template class CORE_TEMPLATE_EXPORT BackwardsCharacterIteratorAlgorithm<EditingS trategy>;
97 template class CORE_TEMPLATE_EXPORT BackwardsCharacterIteratorAlgorithm<EditingI nComposedTreeStrategy>; 97 template class CORE_TEMPLATE_EXPORT BackwardsCharacterIteratorAlgorithm<EditingI nComposedTreeStrategy>;
98 98
99 } // namespace blink 99 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/commands/DeleteSelectionCommand.cpp ('k') | Source/core/editing/iterators/CharacterIterator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698