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

Unified Diff: third_party/WebKit/Source/core/input/EventHandlingUtil.cpp

Issue 2350433002: Extract more of the mouse logic from EventHandler (Closed)
Patch Set: Yet another rebase because of a presubmit rule bug Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
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 2a3fcca5797449ef880fa23c24d7a9b3043de31c..908de11084e01bf8a44b9de6c32cb8ae855d5339 100644
--- a/third_party/WebKit/Source/core/input/EventHandlingUtil.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandlingUtil.cpp
@@ -5,7 +5,10 @@
#include "core/input/EventHandlingUtil.h"
#include "core/frame/FrameView.h"
+#include "core/frame/LocalFrame.h"
#include "core/layout/api/LayoutViewItem.h"
+#include "core/paint/PaintLayer.h"
+#include "platform/scroll/ScrollableArea.h"
namespace blink {
namespace EventHandlingUtil {
@@ -63,5 +66,57 @@ WebInputEventResult toWebInputEventResult(DispatchEventResult result) {
}
}
+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 performMouseEventHitTest(
+ LocalFrame* frame,
+ const HitTestRequest& request,
+ const PlatformMouseEvent& mev) {
+ DCHECK(frame);
+ DCHECK(frame->document());
+
+ return frame->document()->performMouseEventHitTest(
+ request, contentPointFromRootFrame(frame, mev.position()), mev);
+}
+
} // namespace EventHandlingUtil
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandlingUtil.h ('k') | third_party/WebKit/Source/core/input/GestureManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698