summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/editing/TextIterator.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-18 13:36:51 +0100
committerSteve Block <steveblock@google.com>2011-05-24 15:38:28 +0100
commit2fc2651226baac27029e38c9d6ef883fa32084db (patch)
treee396d4bf89dcce6ed02071be66212495b1df1dec /Source/WebCore/editing/TextIterator.cpp
parentb3725cedeb43722b3b175aaeff70552e562d2c94 (diff)
downloadexternal_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.zip
external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.gz
external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.bz2
Merge WebKit at r78450: Initial merge by git.
Change-Id: I6d3e5f1f868ec266a0aafdef66182ddc3f265dc1
Diffstat (limited to 'Source/WebCore/editing/TextIterator.cpp')
-rw-r--r--Source/WebCore/editing/TextIterator.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/WebCore/editing/TextIterator.cpp b/Source/WebCore/editing/TextIterator.cpp
index 1fc7606..b621dc2 100644
--- a/Source/WebCore/editing/TextIterator.cpp
+++ b/Source/WebCore/editing/TextIterator.cpp
@@ -27,7 +27,6 @@
#include "config.h"
#include "TextIterator.h"
-#include "CharacterNames.h"
#include "Document.h"
#include "HTMLElement.h"
#include "HTMLNames.h"
@@ -42,6 +41,7 @@
#include "TextBreakIterator.h"
#include "VisiblePosition.h"
#include "visible_units.h"
+#include <wtf/unicode/CharacterNames.h>
#if USE(ICU_UNICODE) && !UCONFIG_NO_COLLATION
#include "TextBreakIteratorInternalICU.h"
@@ -543,7 +543,7 @@ void TextIterator::handleTextBox()
unsigned runStart = max(textBoxStart, start);
// Check for collapsed space at the start of this run.
- InlineTextBox* firstTextBox = renderer->containsReversedText() ? m_sortedTextBoxes[0] : renderer->firstTextBox();
+ InlineTextBox* firstTextBox = renderer->containsReversedText() ? (m_sortedTextBoxes.isEmpty() ? 0 : m_sortedTextBoxes[0]) : renderer->firstTextBox();
bool needSpace = m_lastTextNodeEndedWithCollapsedSpace
|| (m_textBox == firstTextBox && textBoxStart == runStart && runStart > 0);
if (needSpace && !isCollapsibleWhitespace(m_lastCharacter) && m_lastCharacter) {
@@ -551,7 +551,7 @@ void TextIterator::handleTextBox()
unsigned spaceRunStart = runStart - 1;
while (spaceRunStart > 0 && str[spaceRunStart - 1] == ' ')
--spaceRunStart;
- emitText(m_node, spaceRunStart, spaceRunStart + 1);
+ emitText(m_node, renderer, spaceRunStart, spaceRunStart + 1);
} else
emitCharacter(' ', m_node, 0, runStart, runStart);
return;
@@ -1922,6 +1922,11 @@ inline SearchBuffer::SearchBuffer(const String& target, FindOptions options)
inline SearchBuffer::~SearchBuffer()
{
+ // Leave the static object pointing to a valid string.
+ UErrorCode status = U_ZERO_ERROR;
+ usearch_setPattern(WebCore::searcher(), &newlineCharacter, 1, &status);
+ ASSERT(status == U_ZERO_ERROR);
+
unlockSearcher();
}