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

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: Remove comment. 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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 return false; 681 return false;
682 // FIXME: Broken for OOPI. 682 // FIXME: Broken for OOPI.
683 return toLocalFrame(parentFrame)->eventHandler().bubblingScroll(direction, g ranularity, m_frame->deprecatedLocalOwner()); 683 return toLocalFrame(parentFrame)->eventHandler().bubblingScroll(direction, g ranularity, m_frame->deprecatedLocalOwner());
684 } 684 }
685 685
686 IntPoint EventHandler::lastKnownMousePosition() const 686 IntPoint EventHandler::lastKnownMousePosition() const
687 { 687 {
688 return m_lastKnownMousePosition; 688 return m_lastKnownMousePosition;
689 } 689 }
690 690
691 IntPoint EventHandler::dragDataTransferLocationForTesting()
692 {
693 if (dragState().m_dragDataTransfer)
694 return dragState().m_dragDataTransfer->dragLocation();
695
696 return IntPoint();
697 }
698
691 static LocalFrame* subframeForTargetNode(Node* node) 699 static LocalFrame* subframeForTargetNode(Node* node)
692 { 700 {
693 if (!node) 701 if (!node)
694 return nullptr; 702 return nullptr;
695 703
696 LayoutObject* layoutObject = node->layoutObject(); 704 LayoutObject* layoutObject = node->layoutObject();
697 if (!layoutObject || !layoutObject->isLayoutPart()) 705 if (!layoutObject || !layoutObject->isLayoutPart())
698 return nullptr; 706 return nullptr;
699 707
700 Widget* widget = toLayoutPart(layoutObject)->widget(); 708 Widget* widget = toLayoutPart(layoutObject)->widget();
(...skipping 2619 matching lines...) Expand 10 before | Expand all | Expand 10 after
3320 // The DataTransfer would only be non-empty if we missed a dragEnd. 3328 // The DataTransfer would only be non-empty if we missed a dragEnd.
3321 // Clear it anyway, just to make sure it gets numbified. 3329 // Clear it anyway, just to make sure it gets numbified.
3322 clearDragDataTransfer(); 3330 clearDragDataTransfer();
3323 3331
3324 dragState().m_dragDataTransfer = createDraggingDataTransfer(); 3332 dragState().m_dragDataTransfer = createDraggingDataTransfer();
3325 3333
3326 // Check to see if this a DOM based drag, if it is get the DOM specified dra g 3334 // Check to see if this a DOM based drag, if it is get the DOM specified dra g
3327 // image and offset 3335 // image and offset
3328 if (dragState().m_dragType == DragSourceActionDHTML) { 3336 if (dragState().m_dragType == DragSourceActionDHTML) {
3329 if (LayoutObject* layoutObject = dragState().m_dragSrc->layoutObject()) { 3337 if (LayoutObject* layoutObject = dragState().m_dragSrc->layoutObject()) {
3330 FloatPoint absPos = layoutObject->localToAbsolute(FloatPoint(), UseT ransforms); 3338 IntRect boundingIncludingDescendants = layoutObject->absoluteBoundin gBoxRectIncludingDescendants();
3331 IntSize delta = m_mouseDownPos - roundedIntPoint(absPos); 3339 IntSize delta = m_mouseDownPos - boundingIncludingDescendants.locati on();
3332 dragState().m_dragDataTransfer->setDragImageElement(dragState().m_dr agSrc.get(), IntPoint(delta)); 3340 dragState().m_dragDataTransfer->setDragImageElement(dragState().m_dr agSrc.get(), IntPoint(delta));
3333 } else { 3341 } else {
3334 // The layoutObject has disappeared, this can happen if the onStartD rag handler has hidden 3342 // The layoutObject has disappeared, this can happen if the onStartD rag handler has hidden
3335 // the element in some way. In this case we just kill the drag. 3343 // the element in some way. In this case we just kill the drag.
3336 return false; 3344 return false;
3337 } 3345 }
3338 } 3346 }
3339 3347
3340 DragController& dragController = m_frame->page()->dragController(); 3348 DragController& dragController = m_frame->page()->dragController();
3341 if (!dragController.populateDragDataTransfer(m_frame, dragState(), m_mouseDo wnPos)) 3349 if (!dragController.populateDragDataTransfer(m_frame, dragState(), m_mouseDo wnPos))
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
3980 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 3988 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
3981 { 3989 {
3982 #if OS(MACOSX) 3990 #if OS(MACOSX)
3983 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 3991 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
3984 #else 3992 #else
3985 return PlatformEvent::AltKey; 3993 return PlatformEvent::AltKey;
3986 #endif 3994 #endif
3987 } 3995 }
3988 3996
3989 } // namespace blink 3997 } // 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