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

Side by Side 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, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/rendering/RenderLayer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after
1808 Node* rootNode = const_cast<Node*>(this); 1808 Node* rootNode = const_cast<Node*>(this);
1809 while (parentOrShadowHostOrFrameOwner(rootNode)) 1809 while (parentOrShadowHostOrFrameOwner(rootNode))
1810 rootNode = parentOrShadowHostOrFrameOwner(rootNode); 1810 rootNode = parentOrShadowHostOrFrameOwner(rootNode);
1811 showSubTreeAcrossFrame(rootNode, this, ""); 1811 showSubTreeAcrossFrame(rootNode, this, "");
1812 } 1812 }
1813 1813
1814 #endif 1814 #endif
1815 1815
1816 // -------- 1816 // --------
1817 1817
1818 Node* Node::enclosingLinkEventParentOrSelf() 1818 Element* Node::enclosingLinkEventParentOrSelf()
1819 { 1819 {
1820 for (Node* node = this; node; node = NodeRenderingTraversal::parent(node)) { 1820 for (Node* node = this; node; node = NodeRenderingTraversal::parent(node)) {
1821 // For imagemaps, the enclosing link node is the associated area element not the image itself. 1821 // For imagemaps, the enclosing link node is the associated area element not the image itself.
1822 // So we don't let images be the enclosingLinkNode, even though isLink s ometimes returns true 1822 // So we don't let images be the enclosingLinkNode, even though isLink s ometimes returns true
1823 // for them. 1823 // for them.
1824 if (node->isLink() && !isHTMLImageElement(*node)) 1824 if (node->isLink() && !isHTMLImageElement(*node)) {
1825 return node; 1825 // Casting to Element is safe because only HTMLAnchorElement, HTMLIm ageElement and
1826 // SVGAElement can return true for isLink().
1827 return toElement(node);
1828 }
1826 } 1829 }
1827 1830
1828 return 0; 1831 return 0;
1829 } 1832 }
1830 1833
1831 const AtomicString& Node::interfaceName() const 1834 const AtomicString& Node::interfaceName() const
1832 { 1835 {
1833 return EventTargetNames::Node; 1836 return EventTargetNames::Node;
1834 } 1837 }
1835 1838
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
2487 node->showTreeForThis(); 2490 node->showTreeForThis();
2488 } 2491 }
2489 2492
2490 void showNodePath(const blink::Node* node) 2493 void showNodePath(const blink::Node* node)
2491 { 2494 {
2492 if (node) 2495 if (node)
2493 node->showNodePathForThis(); 2496 node->showNodePathForThis();
2494 } 2497 }
2495 2498
2496 #endif 2499 #endif
OLDNEW
« 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