Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Unified Diff: Source/WebCore/editing/TextIterator.cpp

Issue 7350003: Merge 89831 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/782/
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/editing/text-iterator/first-letter-rtl-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/editing/TextIterator.cpp
===================================================================
--- Source/WebCore/editing/TextIterator.cpp (revision 90857)
+++ Source/WebCore/editing/TextIterator.cpp (working copy)
@@ -459,7 +459,7 @@
emitCharacter(' ', m_node, 0, runStart, runStart);
return false;
}
- if (!m_handledFirstLetter && renderer->isTextFragment()) {
+ if (!m_handledFirstLetter && renderer->isTextFragment() && !m_offset) {
handleTextNodeFirstLetter(static_cast<RenderTextFragment*>(renderer));
if (m_firstLetterText) {
String firstLetter = m_firstLetterText->text();
@@ -496,6 +496,14 @@
return true;
}
+
+ m_textBox = renderer->firstTextBox();
+ if (!m_handledFirstLetter && renderer->isTextFragment() && !m_offset)
+ handleTextNodeFirstLetter(static_cast<RenderTextFragment*>(renderer));
+
+ if (m_firstLetterText)
+ renderer = m_firstLetterText;
+
// Used when text boxes are out of order (Hebrew/Arabic w/ embeded LTR text)
if (renderer->containsReversedText()) {
m_sortedTextBoxes.clear();
@@ -504,11 +512,9 @@
}
std::sort(m_sortedTextBoxes.begin(), m_sortedTextBoxes.end(), InlineTextBox::compareByStart);
m_sortedTextBoxesPosition = 0;
+ m_textBox = m_sortedTextBoxes.isEmpty() ? 0 : m_sortedTextBoxes[0];
}
-
- m_textBox = renderer->containsReversedText() ? (m_sortedTextBoxes.isEmpty() ? 0 : m_sortedTextBoxes[0]) : renderer->firstTextBox();
- if (!m_handledFirstLetter && renderer->isTextFragment() && !m_offset)
- handleTextNodeFirstLetter(static_cast<RenderTextFragment*>(renderer));
+
handleTextBox();
return true;
}
@@ -975,6 +981,9 @@
RenderText* renderer = toRenderText(renderObject);
m_text = m_emitsTextWithoutTranscoding ? renderer->textWithoutTranscoding() : renderer->text();
ASSERT(m_text.characters());
+ ASSERT(0 <= textStartOffset && textStartOffset < static_cast<int>(m_text.length()));
+ ASSERT(0 <= textEndOffset && textEndOffset <= static_cast<int>(m_text.length()));
+ ASSERT(textStartOffset <= textEndOffset);
m_positionNode = textNode;
m_positionOffsetBaseNode = 0;
« no previous file with comments | « LayoutTests/editing/text-iterator/first-letter-rtl-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698