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

Side by Side 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: Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 return false; 680 return false;
681 // FIXME: Broken for OOPI. 681 // FIXME: Broken for OOPI.
682 return toLocalFrame(parentFrame)->eventHandler().bubblingScroll(direction, g ranularity, m_frame->deprecatedLocalOwner()); 682 return toLocalFrame(parentFrame)->eventHandler().bubblingScroll(direction, g ranularity, m_frame->deprecatedLocalOwner());
683 } 683 }
684 684
685 IntPoint EventHandler::lastKnownMousePosition() const 685 IntPoint EventHandler::lastKnownMousePosition() const
686 { 686 {
687 return m_lastKnownMousePosition; 687 return m_lastKnownMousePosition;
688 } 688 }
689 689
690 IntPoint EventHandler::dragDataTransferLocationForTesting()
691 {
692 if (dragState().m_dragDataTransfer)
693 return dragState().m_dragDataTransfer->dragLocation();
694
695 return IntPoint();
696 }
697
690 static LocalFrame* subframeForTargetNode(Node* node) 698 static LocalFrame* subframeForTargetNode(Node* node)
691 { 699 {
692 if (!node) 700 if (!node)
693 return nullptr; 701 return nullptr;
694 702
695 LayoutObject* layoutObject = node->layoutObject(); 703 LayoutObject* layoutObject = node->layoutObject();
696 if (!layoutObject || !layoutObject->isLayoutPart()) 704 if (!layoutObject || !layoutObject->isLayoutPart())
697 return nullptr; 705 return nullptr;
698 706
699 Widget* widget = toLayoutPart(layoutObject)->widget(); 707 Widget* widget = toLayoutPart(layoutObject)->widget();
(...skipping 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after
3314 // The DataTransfer would only be non-empty if we missed a dragEnd. 3322 // The DataTransfer would only be non-empty if we missed a dragEnd.
3315 // Clear it anyway, just to make sure it gets numbified. 3323 // Clear it anyway, just to make sure it gets numbified.
3316 clearDragDataTransfer(); 3324 clearDragDataTransfer();
3317 3325
3318 dragState().m_dragDataTransfer = createDraggingDataTransfer(); 3326 dragState().m_dragDataTransfer = createDraggingDataTransfer();
3319 3327
3320 // Check to see if this a DOM based drag, if it is get the DOM specified dra g 3328 // Check to see if this a DOM based drag, if it is get the DOM specified dra g
3321 // image and offset 3329 // image and offset
3322 if (dragState().m_dragType == DragSourceActionDHTML) { 3330 if (dragState().m_dragType == DragSourceActionDHTML) {
3323 if (LayoutObject* layoutObject = dragState().m_dragSrc->layoutObject()) { 3331 if (LayoutObject* layoutObject = dragState().m_dragSrc->layoutObject()) {
3324 FloatPoint absPos = layoutObject->localToAbsolute(FloatPoint(), UseT ransforms); 3332 IntRect absoluteBoundingBox = layoutObject->absoluteBoundingBoxRect( );
fs 2016/02/24 12:51:16 Why did you switch this to absoluteBoundingBoxRect
hyunjunekim2 2016/02/24 13:06:36 |absoluteBoundingBoxRect| function was thought to
3325 IntSize delta = m_mouseDownPos - roundedIntPoint(absPos); 3333 IntSize delta = m_mouseDownPos - absoluteBoundingBox.location();
3326 dragState().m_dragDataTransfer->setDragImageElement(dragState().m_dr agSrc.get(), IntPoint(delta)); 3334 dragState().m_dragDataTransfer->setDragImageElement(dragState().m_dr agSrc.get(), IntPoint(delta));
3327 } else { 3335 } else {
3328 // The layoutObject has disappeared, this can happen if the onStartD rag handler has hidden 3336 // The layoutObject has disappeared, this can happen if the onStartD rag handler has hidden
3329 // the element in some way. In this case we just kill the drag. 3337 // the element in some way. In this case we just kill the drag.
3330 return false; 3338 return false;
3331 } 3339 }
3332 } 3340 }
3333 3341
3334 DragController& dragController = m_frame->page()->dragController(); 3342 DragController& dragController = m_frame->page()->dragController();
3335 if (!dragController.populateDragDataTransfer(m_frame, dragState(), m_mouseDo wnPos)) 3343 if (!dragController.populateDragDataTransfer(m_frame, dragState(), m_mouseDo wnPos))
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
3974 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 3982 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
3975 { 3983 {
3976 #if OS(MACOSX) 3984 #if OS(MACOSX)
3977 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 3985 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
3978 #else 3986 #else
3979 return PlatformEvent::AltKey; 3987 return PlatformEvent::AltKey;
3980 #endif 3988 #endif
3981 } 3989 }
3982 3990
3983 } // namespace blink 3991 } // namespace blink
OLDNEW
« 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