summaryrefslogtreecommitdiffstats
path: root/WebCore/editing/TextIterator.cpp
diff options
context:
space:
mode:
authorIain Merrick <husky@google.com>2010-08-19 17:55:56 +0100
committerIain Merrick <husky@google.com>2010-08-23 11:05:40 +0100
commitf486d19d62f1bc33246748b14b14a9dfa617b57f (patch)
tree195485454c93125455a30e553a73981c3816144d /WebCore/editing/TextIterator.cpp
parent6ba0b43722d16bc295606bec39f396f596e4fef1 (diff)
downloadexternal_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.zip
external_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.tar.gz
external_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.tar.bz2
Merge WebKit at r65615 : Initial merge by git.
Change-Id: Ifbf384f4531e3b58475a662e38195c2d9152ae79
Diffstat (limited to 'WebCore/editing/TextIterator.cpp')
-rw-r--r--WebCore/editing/TextIterator.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/WebCore/editing/TextIterator.cpp b/WebCore/editing/TextIterator.cpp
index 9589bff..39013c1 100644
--- a/WebCore/editing/TextIterator.cpp
+++ b/WebCore/editing/TextIterator.cpp
@@ -442,11 +442,6 @@ void TextIterator::advance()
}
}
-static inline bool compareBoxStart(const InlineTextBox* first, const InlineTextBox* second)
-{
- return first->start() < second->start();
-}
-
bool TextIterator::handleTextNode()
{
if (m_fullyClippedStack.top())
@@ -507,7 +502,7 @@ bool TextIterator::handleTextNode()
for (InlineTextBox* textBox = renderer->firstTextBox(); textBox; textBox = textBox->nextTextBox()) {
m_sortedTextBoxes.append(textBox);
}
- std::sort(m_sortedTextBoxes.begin(), m_sortedTextBoxes.end(), compareBoxStart);
+ std::sort(m_sortedTextBoxes.begin(), m_sortedTextBoxes.end(), InlineTextBox::compareByStart);
m_sortedTextBoxesPosition = 0;
}
@@ -526,11 +521,11 @@ void TextIterator::handleTextBox()
return;
}
String str = renderer->text();
- int start = m_offset;
- int end = (m_node == m_endContainer) ? m_endOffset : INT_MAX;
+ unsigned start = m_offset;
+ unsigned end = (m_node == m_endContainer) ? m_endOffset : UINT_MAX;
while (m_textBox) {
- int textBoxStart = m_textBox->start();
- int runStart = max(textBoxStart, start);
+ unsigned textBoxStart = m_textBox->start();
+ unsigned runStart = max(textBoxStart, start);
// Check for collapsed space at the start of this run.
InlineTextBox* firstTextBox = renderer->containsReversedText() ? m_sortedTextBoxes[0] : renderer->firstTextBox();
@@ -546,8 +541,8 @@ void TextIterator::handleTextBox()
emitCharacter(' ', m_node, 0, runStart, runStart);
return;
}
- int textBoxEnd = textBoxStart + m_textBox->len();
- int runEnd = min(textBoxEnd, end);
+ unsigned textBoxEnd = textBoxStart + m_textBox->len();
+ unsigned runEnd = min(textBoxEnd, end);
// Determine what the next text box will be, but don't advance yet
InlineTextBox* nextTextBox = 0;
@@ -565,8 +560,8 @@ void TextIterator::handleTextBox()
emitCharacter(' ', m_node, 0, runStart, runStart + 1);
m_offset = runStart + 1;
} else {
- int subrunEnd = str.find('\n', runStart);
- if (subrunEnd == -1 || subrunEnd > runEnd)
+ size_t subrunEnd = str.find('\n', runStart);
+ if (subrunEnd == notFound || subrunEnd > runEnd)
subrunEnd = runEnd;
m_offset = subrunEnd;
@@ -575,11 +570,11 @@ void TextIterator::handleTextBox()
// If we are doing a subrun that doesn't go to the end of the text box,
// come back again to finish handling this text box; don't advance to the next one.
- if (m_positionEndOffset < textBoxEnd)
+ if (static_cast<unsigned>(m_positionEndOffset) < textBoxEnd)
return;
// Advance and return
- int nextRunStart = nextTextBox ? nextTextBox->start() : str.length();
+ unsigned nextRunStart = nextTextBox ? nextTextBox->start() : str.length();
if (nextRunStart > runEnd)
m_lastTextNodeEndedWithCollapsedSpace = true; // collapsed space between runs or at the end
m_textBox = nextTextBox;