Index: third_party/WebKit/Source/core/input/EventHandlingUtil.cpp |
diff --git a/third_party/WebKit/Source/core/input/EventHandlingUtil.cpp b/third_party/WebKit/Source/core/input/EventHandlingUtil.cpp |
index 2ae4665c82a002a4953cdc4729abd10cddf36626..5b183876a38531405e3c417e255badd0596cdb7d 100644 |
--- a/third_party/WebKit/Source/core/input/EventHandlingUtil.cpp |
+++ b/third_party/WebKit/Source/core/input/EventHandlingUtil.cpp |
@@ -6,6 +6,7 @@ |
#include "core/frame/LocalFrame.h" |
#include "core/frame/LocalFrameView.h" |
+#include "core/layout/LayoutEmbeddedContent.h" |
#include "core/layout/api/LayoutViewItem.h" |
#include "core/paint/PaintLayer.h" |
#include "platform/scroll/ScrollableArea.h" |
@@ -128,5 +129,28 @@ MouseEventWithHitTestResults PerformMouseEventHitTest( |
mev); |
} |
+LocalFrame* SubframeForTargetNode(Node* node) { |
+ if (!node) |
+ return nullptr; |
+ |
+ LayoutObject* layout_object = node->GetLayoutObject(); |
+ if (!layout_object || !layout_object->IsLayoutEmbeddedContent()) |
+ return nullptr; |
+ |
+ LocalFrameView* frame_view = |
+ ToLayoutEmbeddedContent(layout_object)->ChildFrameView(); |
+ if (!frame_view) |
+ return nullptr; |
+ |
+ return &frame_view->GetFrame(); |
+} |
+ |
+LocalFrame* SubframeForHitTestResult( |
+ const MouseEventWithHitTestResults& hit_test_result) { |
+ if (!hit_test_result.IsOverEmbeddedContentView()) |
+ return nullptr; |
+ return SubframeForTargetNode(hit_test_result.InnerNode()); |
+} |
+ |
} // namespace EventHandlingUtil |
} // namespace blink |