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

Unified Diff: Source/core/rendering/HitTestResult.cpp

Issue 197283025: Use new is*Element() helper functions more in rendering 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 | « no previous file | Source/core/rendering/RenderBlock.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/HitTestResult.cpp
diff --git a/Source/core/rendering/HitTestResult.cpp b/Source/core/rendering/HitTestResult.cpp
index b80a9a02048b4c4bd77b0e1c3c4a606822549f01..1b15d9c1a5ef3ccab049658bf77ad88758b3efe9 100644
--- a/Source/core/rendering/HitTestResult.cpp
+++ b/Source/core/rendering/HitTestResult.cpp
@@ -39,6 +39,7 @@
#include "core/page/FrameTree.h"
#include "core/rendering/RenderImage.h"
#include "core/rendering/RenderTextFragment.h"
+#include "core/svg/SVGElement.h"
#include "platform/scroll/Scrollbar.h"
namespace WebCore {
@@ -238,14 +239,14 @@ const AtomicString& HitTestResult::altDisplayString() const
if (!m_innerNonSharedNode)
return nullAtom;
- if (m_innerNonSharedNode->hasTagName(imgTag)) {
- HTMLImageElement* image = toHTMLImageElement(m_innerNonSharedNode);
- return image->getAttribute(altAttr);
+ if (isHTMLImageElement(*m_innerNonSharedNode)) {
+ HTMLImageElement& image = toHTMLImageElement(*m_innerNonSharedNode);
+ return image.getAttribute(altAttr);
}
- if (m_innerNonSharedNode->hasTagName(inputTag)) {
- HTMLInputElement* input = toHTMLInputElement(m_innerNonSharedNode);
- return input->alt();
+ if (isHTMLInputElement(*m_innerNonSharedNode)) {
+ HTMLInputElement& input = toHTMLInputElement(*m_innerNonSharedNode);
+ return input.alt();
}
return nullAtom;
@@ -282,13 +283,13 @@ KURL HitTestResult::absoluteImageURL() const
return KURL();
AtomicString urlString;
- if (m_innerNonSharedNode->hasTagName(embedTag)
- || m_innerNonSharedNode->hasTagName(imgTag)
- || m_innerNonSharedNode->hasTagName(inputTag)
- || m_innerNonSharedNode->hasTagName(objectTag)
- || m_innerNonSharedNode->hasTagName(SVGNames::imageTag)
+ if (isHTMLEmbedElement(*m_innerNonSharedNode)
+ || isHTMLImageElement(*m_innerNonSharedNode)
+ || isHTMLInputElement(*m_innerNonSharedNode)
+ || isHTMLObjectElement(*m_innerNonSharedNode)
+ || isSVGImageElement(*m_innerNonSharedNode)
) {
- urlString = toElement(m_innerNonSharedNode)->imageSourceURL();
+ urlString = toElement(*m_innerNonSharedNode).imageSourceURL();
} else
return KURL();
@@ -321,9 +322,9 @@ KURL HitTestResult::absoluteLinkURL() const
return KURL();
AtomicString urlString;
- if (m_innerURLElement->hasTagName(aTag) || m_innerURLElement->hasTagName(areaTag) || m_innerURLElement->hasTagName(linkTag))
+ if (isHTMLAnchorElement(*m_innerURLElement) || isHTMLAreaElement(*m_innerURLElement) || isHTMLLinkElement(*m_innerURLElement))
urlString = m_innerURLElement->getAttribute(hrefAttr);
- else if (m_innerURLElement->hasTagName(SVGNames::aTag))
+ else if (isSVGAElement(*m_innerURLElement))
urlString = m_innerURLElement->getAttribute(XLinkNames::hrefAttr);
else
return KURL();
@@ -336,10 +337,10 @@ bool HitTestResult::isLiveLink() const
if (!m_innerURLElement)
return false;
- if (m_innerURLElement->hasTagName(aTag))
+ if (isHTMLAnchorElement(*m_innerURLElement))
return toHTMLAnchorElement(m_innerURLElement)->isLiveLink();
- if (m_innerURLElement->hasTagName(SVGNames::aTag))
+ if (isSVGAElement(*m_innerURLElement))
return m_innerURLElement->isLink();
return false;
@@ -385,11 +386,11 @@ bool HitTestResult::isContentEditable() const
if (!m_innerNonSharedNode)
return false;
- if (m_innerNonSharedNode->hasTagName(textareaTag))
+ if (isHTMLTextAreaElement(*m_innerNonSharedNode))
return true;
- if (m_innerNonSharedNode->hasTagName(inputTag))
- return toHTMLInputElement(m_innerNonSharedNode)->isTextField();
+ if (isHTMLInputElement(*m_innerNonSharedNode))
+ return toHTMLInputElement(*m_innerNonSharedNode).isTextField();
return m_innerNonSharedNode->rendererIsEditable();
}
« no previous file with comments | « no previous file | Source/core/rendering/RenderBlock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698