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

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, 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 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::dragDataTransferLocation()
691 {
692 IntPoint loc;
693 if (dragState().m_dragDataTransfer) {
fs 2016/02/23 17:27:45 if (...) return ...; return IntPoint();
hyunjunekim2 2016/02/24 13:06:36 Done.
694 loc = dragState().m_dragDataTransfer->dragLocation();
695 }
696 return loc;
697 }
698
690 static LocalFrame* subframeForTargetNode(Node* node) 699 static LocalFrame* subframeForTargetNode(Node* node)
691 { 700 {
692 if (!node) 701 if (!node)
693 return nullptr; 702 return nullptr;
694 703
695 LayoutObject* layoutObject = node->layoutObject(); 704 LayoutObject* layoutObject = node->layoutObject();
696 if (!layoutObject || !layoutObject->isLayoutPart()) 705 if (!layoutObject || !layoutObject->isLayoutPart())
697 return nullptr; 706 return nullptr;
698 707
699 Widget* widget = toLayoutPart(layoutObject)->widget(); 708 Widget* widget = toLayoutPart(layoutObject)->widget();
(...skipping 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after
3312 bool EventHandler::tryStartDrag(const MouseEventWithHitTestResults& event) 3321 bool EventHandler::tryStartDrag(const MouseEventWithHitTestResults& event)
3313 { 3322 {
3314 // The DataTransfer would only be non-empty if we missed a dragEnd. 3323 // The DataTransfer would only be non-empty if we missed a dragEnd.
3315 // Clear it anyway, just to make sure it gets numbified. 3324 // Clear it anyway, just to make sure it gets numbified.
3316 clearDragDataTransfer(); 3325 clearDragDataTransfer();
3317 3326
3318 dragState().m_dragDataTransfer = createDraggingDataTransfer(); 3327 dragState().m_dragDataTransfer = createDraggingDataTransfer();
3319 3328
3320 // Check to see if this a DOM based drag, if it is get the DOM specified dra g 3329 // Check to see if this a DOM based drag, if it is get the DOM specified dra g
3321 // image and offset 3330 // image and offset
3322 if (dragState().m_dragType == DragSourceActionDHTML) { 3331 if (dragState().m_dragType == DragSourceActionDHTML) {
fs 2016/02/23 17:27:45 (I wonder why this code isn't in DragController::p
hyunjunekim2 2016/02/24 12:00:07 This is the report that is flow to draw dragged im
hyunjunekim2 2016/02/24 12:04:41 Did you say that this codes need to transfer on |D
fs 2016/02/24 12:47:48 No need to take any action on this - I was mostly
3323 if (LayoutObject* layoutObject = dragState().m_dragSrc->layoutObject()) { 3332 if (LayoutObject* layoutObject = dragState().m_dragSrc->layoutObject()) {
3324 FloatPoint absPos = layoutObject->localToAbsolute(FloatPoint(), UseT ransforms); 3333 IntRect boundingIncludingDescendants = layoutObject->absoluteBoundin gBoxRectIncludingDescendants();
fs 2016/02/23 17:27:45 I guess this makes sense since it's what LocalFram
3334 FloatPoint absPos(boundingIncludingDescendants.x(), boundingIncludin gDescendants.y());
fs 2016/02/23 17:27:45 No need to do int -> float and then round to int a
hyunjunekim2 2016/02/24 13:06:36 Done.
3325 IntSize delta = m_mouseDownPos - roundedIntPoint(absPos); 3335 IntSize delta = m_mouseDownPos - roundedIntPoint(absPos);
3326 dragState().m_dragDataTransfer->setDragImageElement(dragState().m_dr agSrc.get(), IntPoint(delta)); 3336 dragState().m_dragDataTransfer->setDragImageElement(dragState().m_dr agSrc.get(), IntPoint(delta));
3327 } else { 3337 } else {
3328 // The layoutObject has disappeared, this can happen if the onStartD rag handler has hidden 3338 // 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. 3339 // the element in some way. In this case we just kill the drag.
3330 return false; 3340 return false;
3331 } 3341 }
3332 } 3342 }
3333 3343
3334 DragController& dragController = m_frame->page()->dragController(); 3344 DragController& dragController = m_frame->page()->dragController();
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
3974 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 3984 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
3975 { 3985 {
3976 #if OS(MACOSX) 3986 #if OS(MACOSX)
3977 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 3987 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
3978 #else 3988 #else
3979 return PlatformEvent::AltKey; 3989 return PlatformEvent::AltKey;
3980 #endif 3990 #endif
3981 } 3991 }
3982 3992
3983 } // namespace blink 3993 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698