Index: Source/core/editing/TextIterator.cpp |
diff --git a/Source/core/editing/TextIterator.cpp b/Source/core/editing/TextIterator.cpp |
index 7baf1c49df1e8a5c28764f5c2bc76f7cf5a144de..0ec60e78884c8fe59aa79c874bdc47fec1423b77 100644 |
--- a/Source/core/editing/TextIterator.cpp |
+++ b/Source/core/editing/TextIterator.cpp |
@@ -38,6 +38,8 @@ |
#include "core/editing/htmlediting.h" |
#include "core/frame/FrameView.h" |
#include "core/html/HTMLElement.h" |
+#include "core/html/HTMLImageElement.h" |
+#include "core/html/HTMLInputElement.h" |
#include "core/html/HTMLTextFormControlElement.h" |
#include "core/rendering/InlineTextBox.h" |
#include "core/rendering/RenderImage.h" |
@@ -470,6 +472,7 @@ void TextIterator::advance() |
|| (m_node && m_node->isHTMLElement() |
&& (isHTMLFormControlElement(toHTMLElement(*m_node)) |
|| isHTMLLegendElement(toHTMLElement(*m_node)) |
+ || isHTMLImageElement(toElement(*m_node)) |
|| isHTMLMeterElement(toHTMLElement(*m_node)) |
|| isHTMLProgressElement(toHTMLElement(*m_node)))))) { |
handledNode = handleReplacedElement(); |
@@ -829,8 +832,8 @@ bool TextIterator::handleReplacedElement() |
m_positionEndOffset = 1; |
m_singleCharacterBuffer = 0; |
- if (m_emitsImageAltText && renderer->isImage() && renderer->isRenderImage()) { |
- m_text = toRenderImage(renderer)->altText(); |
+ if (m_emitsImageAltText) { |
+ m_text = toHTMLElement(m_node)->altText(); |
if (!m_text.isEmpty()) { |
m_textLength = m_text.length(); |
m_lastCharacter = m_text[m_textLength - 1]; |
@@ -1411,7 +1414,7 @@ void SimplifiedBackwardsTextIterator::advance() |
// FIXME: What about CDATA_SECTION_NODE? |
if (renderer->style()->visibility() == VISIBLE && m_offset > 0) |
m_handledNode = handleTextNode(); |
- } else if (renderer && (renderer->isImage() || renderer->isRenderPart())) { |
+ } else if (renderer && (isHTMLImageElement(toElement(*m_node)) || isHTMLInputElement(toElement(*m_node)) || renderer->isRenderPart())) { |
if (renderer->style()->visibility() == VISIBLE && m_offset > 0) |
m_handledNode = handleReplacedElement(); |
} else { |