Index: Source/core/editing/TextIterator.cpp |
diff --git a/Source/core/editing/TextIterator.cpp b/Source/core/editing/TextIterator.cpp |
index 2fad13588cfa45747555c261c1aacff8826cf7e9..55c41c7a5ed754762f4625c85582ca58647d76b8 100644 |
--- a/Source/core/editing/TextIterator.cpp |
+++ b/Source/core/editing/TextIterator.cpp |
@@ -37,6 +37,7 @@ |
#include "core/editing/htmlediting.h" |
#include "core/frame/FrameView.h" |
#include "core/html/HTMLElement.h" |
+#include "core/html/HTMLImageElement.h" |
#include "core/html/HTMLTextFormControlElement.h" |
#include "core/rendering/InlineTextBox.h" |
#include "core/rendering/RenderImage.h" |
@@ -467,6 +468,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,9 +831,14 @@ bool TextIterator::handleReplacedElement() |
m_positionEndOffset = 1; |
m_singleCharacterBuffer = 0; |
- if (m_emitsImageAltText && renderer->isImage() && renderer->isRenderImage()) { |
- m_text = toRenderImage(renderer)->altText(); |
- if (!m_text.isEmpty()) { |
+ if (m_emitsImageAltText) { |
+ bool isTextModified = false; |
+ if (isHTMLImageElement(toElement(*m_node))) { |
+ m_text = toHTMLImageElement(m_node)->altText(); |
+ isTextModified = true; |
+ } |
+ |
+ if (!m_text.isEmpty() && isTextModified) { |
m_textLength = m_text.length(); |
m_lastCharacter = m_text[m_textLength - 1]; |
return true; |
@@ -1313,7 +1320,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->isWidget())) { |
+ } else if (renderer && (isHTMLImageElement(toElement(*m_node)) || renderer->isWidget())) { |
esprehn
2014/09/05 00:47:50
I think this breaks image inputs, they're also Ren
rhogan
2014/09/08 19:52:41
Done
|
if (renderer->style()->visibility() == VISIBLE && m_offset > 0) |
m_handledNode = handleReplacedElement(); |
} else { |