Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 11 matching lines...) Expand all Loading... | |
| 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "core/editing/iterators/WordAwareIterator.h" | 27 #include "core/editing/iterators/WordAwareIterator.h" |
| 28 | 28 |
| 29 namespace blink { | 29 namespace blink { |
| 30 | 30 |
| 31 WordAwareIterator::WordAwareIterator(const Position& start, const Position& end) | 31 WordAwareIterator::WordAwareIterator(const Position& start, const Position& end) |
| 32 : m_didLookAhead( | 32 // So we consider the first chunk from the text iterator. |
|
Nico
2016/10/05 01:20:08
Yup, like so :-)
jbroman
2016/10/05 13:42:01
Acknowledged.
| |
| 33 true) // So we consider the first chunk from the text iterator. | 33 : m_didLookAhead(true), |
| 34 , | |
| 35 m_textIterator(start, end) { | 34 m_textIterator(start, end) { |
| 36 advance(); // Get in position over the first chunk of text. | 35 advance(); // Get in position over the first chunk of text. |
| 37 } | 36 } |
| 38 | 37 |
| 39 WordAwareIterator::~WordAwareIterator() {} | 38 WordAwareIterator::~WordAwareIterator() {} |
| 40 | 39 |
| 41 // FIXME: Performance could be bad for huge spans next to each other that don't fall on word boundaries. | 40 // FIXME: Performance could be bad for huge spans next to each other that don't fall on word boundaries. |
| 42 | 41 |
| 43 void WordAwareIterator::advance() { | 42 void WordAwareIterator::advance() { |
| 44 m_buffer.clear(); | 43 m_buffer.clear(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 return m_textIterator.text().substring(position, length); | 91 return m_textIterator.text().substring(position, length); |
| 93 } | 92 } |
| 94 | 93 |
| 95 UChar WordAwareIterator::characterAt(unsigned index) const { | 94 UChar WordAwareIterator::characterAt(unsigned index) const { |
| 96 if (!m_buffer.isEmpty()) | 95 if (!m_buffer.isEmpty()) |
| 97 return m_buffer[index]; | 96 return m_buffer[index]; |
| 98 return m_textIterator.text().characterAt(index); | 97 return m_textIterator.text().characterAt(index); |
| 99 } | 98 } |
| 100 | 99 |
| 101 } // namespace blink | 100 } // namespace blink |
| OLD | NEW |