summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOystein <oysteine@chromium.org>2014-07-22 09:05:08 +0200
committerAllan Sandfeld Jensen <allan.jensen@digia.com>2014-07-22 12:57:29 +0200
commit4a39158368f6184c8d56e1d65866ba99f83297e0 (patch)
tree010797f76282f1bc1c7902a07b84cb8ea87c7b97
parent20558f56823e28c0c28043ed5ba06b29bebe348b (diff)
Added support for appending an escaped SegmentedString to another.
Merge of blink r174725 This was previously an assert which triggers in the situation where the HTMLEntityParser is parsing a potential named entity, but only has one or two characters of data available due to being at the end of a network packet boundary, so it 'unconsumes' them from the SegmentedString which has some special handling when only one or two characters needs unconsuming to avoid string creation. Next time the tokenizer is pumped, the SegmentedString is then appended to the HTMLSourceTracker right before the actual parsing happens (i.e. when we'd consume the previously unconsumed characters). SegmentedString::append mostly assumes the parameter string hasn't been consumed from and had an assert instead of handling this case, which hits. Task-number: QTBUG-40284 Change-Id: Ifcf9af6f6e2e5a9750af4297cfda2f55f3bb274e Reviewed-by: Michael Bruning <michael.bruning@digia.com>
-rw-r--r--Source/WebCore/platform/text/SegmentedString.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/WebCore/platform/text/SegmentedString.cpp b/Source/WebCore/platform/text/SegmentedString.cpp
index b0dc3d3dd..95de06ae4 100644
--- a/Source/WebCore/platform/text/SegmentedString.cpp
+++ b/Source/WebCore/platform/text/SegmentedString.cpp
@@ -166,7 +166,14 @@ void SegmentedString::close()
void SegmentedString::append(const SegmentedString& s)
{
ASSERT(!m_closed);
- ASSERT(!s.escaped());
+ if (s.m_pushedChar1) {
+ Vector<UChar, 2> unconsumedData;
+ unconsumedData.append(s.m_pushedChar1);
+ if (s.m_pushedChar2)
+ unconsumedData.append(s.m_pushedChar2);
+ append(SegmentedSubstring(String(unconsumedData)));
+ }
+
append(s.m_currentString);
if (s.isComposite()) {
Deque<SegmentedSubstring>::const_iterator it = s.m_substrings.begin();
@@ -174,7 +181,7 @@ void SegmentedString::append(const SegmentedString& s)
for (; it != e; ++it)
append(*it);
}
- m_currentChar = m_pushedChar1 ? m_pushedChar1 : (m_currentString.m_length ? m_currentString.getCurrentChar() : 0);
+ m_currentChar = m_currentString.m_length ? m_currentString.getCurrentChar() : 0;
}
void SegmentedString::prepend(const SegmentedString& s)