Chromium Code Reviews| 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 01231c1ead02de6c96e69bcd60ed4bd8a7f881b7..37a5693ce43d91ca22a100dbd5c15be36f065ece 100644 |
| --- a/third_party/WebKit/Source/core/input/EventHandlingUtil.cpp |
| +++ b/third_party/WebKit/Source/core/input/EventHandlingUtil.cpp |
| @@ -59,5 +59,58 @@ WebInputEventResult toWebInputEventResult( |
| } |
| } |
| +PaintLayer* layerForNode(Node* node) |
| +{ |
| + if (!node) |
| + return nullptr; |
| + |
| + LayoutObject* layoutObject = node->layoutObject(); |
| + if (!layoutObject) |
| + return nullptr; |
| + |
| + PaintLayer* layer = layoutObject->enclosingLayer(); |
| + if (!layer) |
| + return nullptr; |
| + |
| + return layer; |
| +} |
| + |
| +ScrollableArea* associatedScrollableArea(const PaintLayer* layer) |
| +{ |
| + if (PaintLayerScrollableArea* scrollableArea = layer->getScrollableArea()) { |
| + if (scrollableArea->scrollsOverflow()) |
| + return scrollableArea; |
| + } |
| + |
| + return nullptr; |
| +} |
| + |
| +ContainerNode* parentForClickEvent(const Node& node) |
| +{ |
| + // IE doesn't dispatch click events for mousedown/mouseup events across form |
| + // controls. |
| + if (node.isHTMLElement() && toHTMLElement(node).isInteractiveContent()) |
| + return nullptr; |
| + |
| + return FlatTreeTraversal::parent(node); |
| +} |
| + |
| +LayoutPoint contentPointFromRootFrame(LocalFrame* frame, const IntPoint& pointInRootFrame) |
| +{ |
| + FrameView* view = frame->view(); |
| + // FIXME: Is it really OK to use the wrong coordinates here when view is 0? |
| + // Historically the code would just crash; this is clearly no worse than that. |
| + return view ? view->rootFrameToContents(pointInRootFrame) : pointInRootFrame; |
| +} |
| + |
| +MouseEventWithHitTestResults prepareMouseEvent(LocalFrame* frame, |
|
mustaq
2016/09/21 17:28:14
This has been a misnomer. Please rename to somethi
Navid Zolghadr
2016/09/22 12:24:29
How about the same name? Document::performMouseEve
Navid Zolghadr
2016/09/23 11:11:16
Done.
|
| + const HitTestRequest& request, const PlatformMouseEvent& mev) |
| +{ |
| + DCHECK(frame); |
| + DCHECK(frame->document()); |
| + |
| + return frame->document()->prepareMouseEvent(request, contentPointFromRootFrame(frame, mev.position()), mev); |
| +} |
| + |
| } // namespace EventHandlingUtil |
| } // namespace blink |