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

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

Issue 1716023002: Fix draggable elements are painted at incorrect position (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove comment. Created 4 years, 10 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/EventHandler.cpp
diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp
index 81e9c4711a67f2595fe4b3b9fc08609d8f820327..ca390ab536a73d4adc9659f7abb28acb50c5e5a5 100644
--- a/third_party/WebKit/Source/core/input/EventHandler.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -688,6 +688,14 @@ IntPoint EventHandler::lastKnownMousePosition() const
return m_lastKnownMousePosition;
}
+IntPoint EventHandler::dragDataTransferLocationForTesting()
+{
+ if (dragState().m_dragDataTransfer)
+ return dragState().m_dragDataTransfer->dragLocation();
+
+ return IntPoint();
+}
+
static LocalFrame* subframeForTargetNode(Node* node)
{
if (!node)
@@ -3327,8 +3335,8 @@ bool EventHandler::tryStartDrag(const MouseEventWithHitTestResults& event)
// image and offset
if (dragState().m_dragType == DragSourceActionDHTML) {
if (LayoutObject* layoutObject = dragState().m_dragSrc->layoutObject()) {
- FloatPoint absPos = layoutObject->localToAbsolute(FloatPoint(), UseTransforms);
- IntSize delta = m_mouseDownPos - roundedIntPoint(absPos);
+ IntRect boundingIncludingDescendants = layoutObject->absoluteBoundingBoxRectIncludingDescendants();
+ IntSize delta = m_mouseDownPos - boundingIncludingDescendants.location();
dragState().m_dragDataTransfer->setDragImageElement(dragState().m_dragSrc.get(), IntPoint(delta));
} else {
// The layoutObject has disappeared, this can happen if the onStartDrag handler has hidden
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.h ('k') | third_party/WebKit/Source/core/input/EventHandlerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698