Chromium Code Reviews| Index: Source/core/editing/TextIterator.cpp |
| diff --git a/Source/core/editing/TextIterator.cpp b/Source/core/editing/TextIterator.cpp |
| index c62fb7e13f968d93416ab829a008d2ebdcd67def..1c4e10cf67ccb4d16cce4cecf4b443f20f4f4dc1 100644 |
| --- a/Source/core/editing/TextIterator.cpp |
| +++ b/Source/core/editing/TextIterator.cpp |
| @@ -265,6 +265,7 @@ TextIterator::TextIterator(const Range* range, TextIteratorBehaviorFlags behavio |
| , m_shouldStop(false) |
| , m_emitsImageAltText(behavior & TextIteratorEmitsImageAltText) |
| , m_entersAuthorShadowRoots(behavior & TextIteratorEntersAuthorShadowRoots) |
| + , m_emitsReplacementChar(behavior & TextIteratorEmitsReplacementChar) |
| { |
| if (range) |
| initialize(range->startPosition(), range->endPosition()); |
| @@ -782,16 +783,21 @@ bool TextIterator::handleReplacedElement() |
| if (renderer->style()->visibility() != VISIBLE && !m_ignoresStyleVisibility) |
| return false; |
| - if (m_lastTextNodeEndedWithCollapsedSpace) { |
| - emitCharacter(' ', m_lastTextNode->parentNode(), m_lastTextNode, 1, 1); |
| - return false; |
| - } |
| - |
| if (m_entersTextControls && renderer->isTextControl()) { |
| // The shadow tree should be already visited. |
| return true; |
| } |
| + if (m_emitsReplacementChar || true) { |
|
aurimas (slooooooooow)
2014/05/22 21:43:40
"A || true" is true for any value for A, right?
guohui
2014/05/22 22:00:37
Absolutely right, i hardcoded to true for testing
|
| + emitCharacter(objectReplacementCharacter, m_node->parentNode(), m_node, 0, 1); |
| + return true; |
| + } |
| + |
| + if (m_lastTextNodeEndedWithCollapsedSpace) { |
| + emitCharacter(' ', m_lastTextNode->parentNode(), m_lastTextNode, 1, 1); |
| + return false; |
| + } |
| + |
| m_hasEmitted = true; |
| if (m_emitsCharactersBetweenAllVisiblePositions) { |