| Index: third_party/WebKit/Source/platform/text/SegmentedString.cpp
|
| diff --git a/third_party/WebKit/Source/platform/text/SegmentedString.cpp b/third_party/WebKit/Source/platform/text/SegmentedString.cpp
|
| index ec3507ebc712617ffd802488608d8dcc71ca82d9..944a17725d3033764c6bf867982b72650ae7d3d4 100644
|
| --- a/third_party/WebKit/Source/platform/text/SegmentedString.cpp
|
| +++ b/third_party/WebKit/Source/platform/text/SegmentedString.cpp
|
| @@ -87,22 +87,21 @@ void SegmentedString::push(UChar c)
|
| return;
|
| }
|
|
|
| - prepend(SegmentedString(String(&c, 1)));
|
| + prepend(SegmentedString(String(&c, 1)), PrependType::Unconsume);
|
| }
|
|
|
| -void SegmentedString::prepend(const SegmentedSubstring& s)
|
| +void SegmentedString::prepend(const SegmentedSubstring& s, PrependType type)
|
| {
|
| ASSERT(!s.numberOfCharactersConsumed());
|
| if (!s.length())
|
| return;
|
|
|
| - // FIXME: We're assuming that the prepend were originally consumed by
|
| - // this SegmentedString. We're also ASSERTing that s is a fresh
|
| - // SegmentedSubstring. These assumptions are sufficient for our
|
| - // current use, but we might need to handle the more elaborate
|
| - // cases in the future.
|
| + // FIXME: We're also ASSERTing that s is a fresh SegmentedSubstring.
|
| + // The assumption is sufficient for our current use, but we might
|
| + // need to handle the more elaborate cases in the future.
|
| m_numberOfCharactersConsumedPriorToCurrentString += m_currentString.numberOfCharactersConsumed();
|
| - m_numberOfCharactersConsumedPriorToCurrentString -= s.length();
|
| + if (type == PrependType::Unconsume)
|
| + m_numberOfCharactersConsumedPriorToCurrentString -= s.length();
|
| if (!m_currentString.length()) {
|
| m_currentString = s;
|
| updateAdvanceFunctionPointers();
|
| @@ -136,15 +135,15 @@ void SegmentedString::append(const SegmentedString& s)
|
| m_currentChar = m_currentString.length() ? m_currentString.getCurrentChar() : 0;
|
| }
|
|
|
| -void SegmentedString::prepend(const SegmentedString& s)
|
| +void SegmentedString::prepend(const SegmentedString& s, PrependType type)
|
| {
|
| if (s.isComposite()) {
|
| Deque<SegmentedSubstring>::const_reverse_iterator it = s.m_substrings.rbegin();
|
| Deque<SegmentedSubstring>::const_reverse_iterator e = s.m_substrings.rend();
|
| for (; it != e; ++it)
|
| - prepend(*it);
|
| + prepend(*it, type);
|
| }
|
| - prepend(s.m_currentString);
|
| + prepend(s.m_currentString, type);
|
| m_currentChar = m_currentString.length() ? m_currentString.getCurrentChar() : 0;
|
| }
|
|
|
|
|