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

Unified Diff: Source/core/dom/Node.cpp

Issue 417093006: Have Node::enclosingLinkEventParentOrSelf() return an Element (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 5 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/dom/Node.h ('k') | Source/core/rendering/RenderLayer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Node.cpp
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index d7e4d8ab891a5c6025735c92509d3c26d7bfb2a1..b407e14c8cb16d0bbbd5bdaae3be45d3c4da0d73 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -1815,14 +1815,17 @@ void Node::showTreeForThisAcrossFrame() const
// --------
-Node* Node::enclosingLinkEventParentOrSelf()
+Element* Node::enclosingLinkEventParentOrSelf()
{
for (Node* node = this; node; node = NodeRenderingTraversal::parent(node)) {
// For imagemaps, the enclosing link node is the associated area element not the image itself.
// So we don't let images be the enclosingLinkNode, even though isLink sometimes returns true
// for them.
- if (node->isLink() && !isHTMLImageElement(*node))
- return node;
+ if (node->isLink() && !isHTMLImageElement(*node)) {
+ // Casting to Element is safe because only HTMLAnchorElement, HTMLImageElement and
+ // SVGAElement can return true for isLink().
+ return toElement(node);
+ }
}
return 0;
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/rendering/RenderLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698