Chromium Code Reviews| Index: Source/core/rendering/HitTestResult.cpp |
| diff --git a/Source/core/rendering/HitTestResult.cpp b/Source/core/rendering/HitTestResult.cpp |
| index 384e6ddb4c82bec90a37491eea82a6b5e0cb85e8..300cf40d8c5cd6d6e3bc78344b48afcc2b5e0f47 100644 |
| --- a/Source/core/rendering/HitTestResult.cpp |
| +++ b/Source/core/rendering/HitTestResult.cpp |
| @@ -26,6 +26,7 @@ |
| #include "SVGNames.h" |
| #include "XLinkNames.h" |
| #include "core/dom/DocumentMarkerController.h" |
| +#include "core/dom/NodeRenderingTraversal.h" |
| #include "core/dom/shadow/ShadowRoot.h" |
| #include "core/editing/FrameSelection.h" |
| #include "core/html/HTMLAnchorElement.h" |
| @@ -472,11 +473,17 @@ Node* HitTestResult::targetNode() const |
| Element* HitTestResult::innerElement() const |
| { |
| - for (Node* node = m_innerNode.get(); node; node = node->parentNode()) { |
| + Node* node = m_innerNode.get(); |
| + if (!node) |
| + return 0; |
| + |
| + if (node->isElementNode()) |
| + return toElement(node); |
| + |
| + NodeRenderingTraversal::ParentDetails details; |
| + for (node = NodeRenderingTraversal::parent(node, &details); node; node = node->parentOrShadowHostNode()) |
|
hayato
2013/06/03 09:03:47
Could you help me to understand why we don't alway
tasak
2013/06/03 11:18:25
Done.
I guess, we need to check only parentNode t
|
| if (node->isElementNode()) |
| return toElement(node); |
| - } |
| - |
| return 0; |
| } |