Index: Source/core/editing/TextIterator.cpp |
diff --git a/Source/core/editing/TextIterator.cpp b/Source/core/editing/TextIterator.cpp |
index c62fb7e13f968d93416ab829a008d2ebdcd67def..ad6282af9fa1d0e984d14b2e58cf4781305ece6f 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) { |
+ 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) { |