Index: Source/core/rendering/HitTestResult.cpp |
diff --git a/Source/core/rendering/HitTestResult.cpp b/Source/core/rendering/HitTestResult.cpp |
index 7b0694461feee95e26ae01e508e2d19c008bc7d1..7da6a3a5260606d241f1e00694ada3e79ee81203 100644 |
--- a/Source/core/rendering/HitTestResult.cpp |
+++ b/Source/core/rendering/HitTestResult.cpp |
@@ -24,6 +24,7 @@ |
#include "HTMLNames.h" |
#include "core/dom/DocumentMarkerController.h" |
+#include "core/dom/shadow/ShadowRoot.h" |
#include "core/editing/Editor.h" |
#include "core/editing/FrameSelection.h" |
#include "core/html/HTMLAnchorElement.h" |
@@ -112,16 +113,34 @@ HitTestResult& HitTestResult::operator=(const HitTestResult& other) |
return *this; |
} |
-void HitTestResult::setToNonShadowAncestor() |
+void HitTestResult::setToNodesInDocumentTreeScope() |
dglazkov
2013/05/13 16:11:42
It's not necessarily document tree scope, right? Y
|
{ |
- Node* node = innerNode(); |
- if (node) |
+ if (Node* node = innerNode()) { |
node = node->document()->ancestorInThisScope(node); |
Hajime Morrita
2013/05/14 00:13:53
This asks document()->ancestorInThisScope(), which
|
- setInnerNode(node); |
- node = innerNonSharedNode(); |
- if (node) |
+ setInnerNode(node); |
+ } |
+ |
+ if (Node* node = innerNonSharedNode()) { |
node = node->document()->ancestorInThisScope(node); |
- setInnerNonSharedNode(node); |
+ setInnerNonSharedNode(node); |
+ } |
+} |
+ |
+void HitTestResult::setToShadowHostIfInUserAgentShadowRoot() |
+{ |
+ if (Node* node = innerNode()) { |
+ if (ShadowRoot* containingShadowRoot = node->containingShadowRoot()) { |
+ if (containingShadowRoot->type() == ShadowRoot::UserAgentShadowRoot) |
+ setInnerNode(node->shadowHost()); |
+ } |
+ } |
+ |
+ if (Node* node = innerNonSharedNode()) { |
+ if (ShadowRoot* containingShadowRoot = node->containingShadowRoot()) { |
+ if (containingShadowRoot->type() == ShadowRoot::UserAgentShadowRoot) |
+ setInnerNonSharedNode(node->shadowHost()); |
+ } |
+ } |
} |
void HitTestResult::setInnerNode(Node* n) |