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

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

Issue 196683003: Use new is*Element() helper functions more in editing code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | « Source/core/editing/SpellChecker.cpp ('k') | Source/core/editing/TypingCommand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/TextIterator.cpp
diff --git a/Source/core/editing/TextIterator.cpp b/Source/core/editing/TextIterator.cpp
index a0e041e37711a138cb41304f1836e854b95ce80b..3c452ce0bcb46bf8bd74f4379d47a8edb93838d9 100644
--- a/Source/core/editing/TextIterator.cpp
+++ b/Source/core/editing/TextIterator.cpp
@@ -406,9 +406,9 @@ void TextIterator::advance()
} else if (renderer && (renderer->isImage() || renderer->isWidget()
|| (m_node && m_node->isElementNode()
&& (toElement(m_node)->isFormControlElement()
- || toElement(m_node)->hasTagName(legendTag)
- || toElement(m_node)->hasTagName(meterTag)
- || toElement(m_node)->hasTagName(progressTag))))) {
+ || isHTMLLegendElement(toElement(*m_node))
+ || isHTMLMeterElement(toElement(*m_node))
+ || isHTMLProgressElement(toElement(*m_node)))))) {
handledNode = handleReplacedElement();
} else {
handledNode = handleNonTextNode();
@@ -808,9 +808,9 @@ static bool shouldEmitNewlineForNode(Node* node, bool emitsOriginalText)
{
RenderObject* renderer = node->renderer();
- if (renderer ? !renderer->isBR() : !node->hasTagName(brTag))
+ if (renderer ? !renderer->isBR() : !isHTMLBRElement(node))
return false;
- return emitsOriginalText || !(node->isInShadowTree() && node->shadowHost()->hasTagName(inputTag));
+ return emitsOriginalText || !(node->isInShadowTree() && isHTMLInputElement(*node->shadowHost()));
}
static bool shouldEmitNewlinesBeforeAndAfterNode(Node& node)
@@ -975,7 +975,7 @@ bool TextIterator::shouldRepresentNodeOffsetZero()
// Additionally, if the range we are iterating over contains huge sections of unrendered content,
// we would create VisiblePositions on every call to this function without this check.
if (!m_node->renderer() || m_node->renderer()->style()->visibility() != VISIBLE
- || (m_node->renderer()->isRenderBlockFlow() && !toRenderBlock(m_node->renderer())->height() && !m_node->hasTagName(bodyTag)))
+ || (m_node->renderer()->isRenderBlockFlow() && !toRenderBlock(m_node->renderer())->height() && !isHTMLBodyElement(*m_node)))
return false;
// The startPos.isNotNull() check is needed because the start could be before the body,
« no previous file with comments | « Source/core/editing/SpellChecker.cpp ('k') | Source/core/editing/TypingCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698