OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Google Inc. | 3 * Copyright (C) 2008 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 bool DragController::populateDragDataTransfer(LocalFrame* src, const DragState&
state, const IntPoint& dragOrigin) | 723 bool DragController::populateDragDataTransfer(LocalFrame* src, const DragState&
state, const IntPoint& dragOrigin) |
724 { | 724 { |
725 ASSERT(dragTypeIsValid(state.m_dragType)); | 725 ASSERT(dragTypeIsValid(state.m_dragType)); |
726 ASSERT(src); | 726 ASSERT(src); |
727 if (!src->view() || src->contentLayoutItem().isNull()) | 727 if (!src->view() || src->contentLayoutItem().isNull()) |
728 return false; | 728 return false; |
729 | 729 |
730 HitTestResult hitTestResult = src->eventHandler().hitTestResultAtPoint(dragO
rigin); | 730 HitTestResult hitTestResult = src->eventHandler().hitTestResultAtPoint(dragO
rigin); |
731 // FIXME: Can this even happen? I guess it's possible, but should verify | 731 // FIXME: Can this even happen? I guess it's possible, but should verify |
732 // with a layout test. | 732 // with a layout test. |
733 if (!state.m_dragSrc->containsIncludingShadowDOM(hitTestResult.innerNode()))
{ | 733 if (!state.m_dragSrc->isShadowIncludingInclusiveAncestorOf(hitTestResult.inn
erNode())) { |
734 // The original node being dragged isn't under the drag origin anymore..
. maybe it was | 734 // The original node being dragged isn't under the drag origin anymore..
. maybe it was |
735 // hidden or moved out from under the cursor. Regardless, we don't want
to start a drag on | 735 // hidden or moved out from under the cursor. Regardless, we don't want
to start a drag on |
736 // something that's not actually under the drag origin. | 736 // something that's not actually under the drag origin. |
737 return false; | 737 return false; |
738 } | 738 } |
739 const KURL& linkURL = hitTestResult.absoluteLinkURL(); | 739 const KURL& linkURL = hitTestResult.absoluteLinkURL(); |
740 const KURL& imageURL = hitTestResult.absoluteImageURL(); | 740 const KURL& imageURL = hitTestResult.absoluteImageURL(); |
741 | 741 |
742 DataTransfer* dataTransfer = state.m_dragDataTransfer.get(); | 742 DataTransfer* dataTransfer = state.m_dragDataTransfer.get(); |
743 Node* node = state.m_dragSrc.get(); | 743 Node* node = state.m_dragSrc.get(); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 } | 846 } |
847 | 847 |
848 bool DragController::startDrag(LocalFrame* src, const DragState& state, const Pl
atformMouseEvent& dragEvent, const IntPoint& dragOrigin) | 848 bool DragController::startDrag(LocalFrame* src, const DragState& state, const Pl
atformMouseEvent& dragEvent, const IntPoint& dragOrigin) |
849 { | 849 { |
850 ASSERT(dragTypeIsValid(state.m_dragType)); | 850 ASSERT(dragTypeIsValid(state.m_dragType)); |
851 ASSERT(src); | 851 ASSERT(src); |
852 if (!src->view() || src->contentLayoutItem().isNull()) | 852 if (!src->view() || src->contentLayoutItem().isNull()) |
853 return false; | 853 return false; |
854 | 854 |
855 HitTestResult hitTestResult = src->eventHandler().hitTestResultAtPoint(dragO
rigin); | 855 HitTestResult hitTestResult = src->eventHandler().hitTestResultAtPoint(dragO
rigin); |
856 if (!state.m_dragSrc->containsIncludingShadowDOM(hitTestResult.innerNode()))
{ | 856 if (!state.m_dragSrc->isShadowIncludingInclusiveAncestorOf(hitTestResult.inn
erNode())) { |
857 // The original node being dragged isn't under the drag origin anymore..
. maybe it was | 857 // The original node being dragged isn't under the drag origin anymore..
. maybe it was |
858 // hidden or moved out from under the cursor. Regardless, we don't want
to start a drag on | 858 // hidden or moved out from under the cursor. Regardless, we don't want
to start a drag on |
859 // something that's not actually under the drag origin. | 859 // something that's not actually under the drag origin. |
860 return false; | 860 return false; |
861 } | 861 } |
862 const KURL& linkURL = hitTestResult.absoluteLinkURL(); | 862 const KURL& linkURL = hitTestResult.absoluteLinkURL(); |
863 const KURL& imageURL = hitTestResult.absoluteImageURL(); | 863 const KURL& imageURL = hitTestResult.absoluteImageURL(); |
864 | 864 |
865 IntPoint mouseDraggedPoint = src->view()->rootFrameToContents(dragEvent.posi
tion()); | 865 IntPoint mouseDraggedPoint = src->view()->rootFrameToContents(dragEvent.posi
tion()); |
866 | 866 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 | 981 |
982 DEFINE_TRACE(DragController) | 982 DEFINE_TRACE(DragController) |
983 { | 983 { |
984 visitor->trace(m_page); | 984 visitor->trace(m_page); |
985 visitor->trace(m_documentUnderMouse); | 985 visitor->trace(m_documentUnderMouse); |
986 visitor->trace(m_dragInitiator); | 986 visitor->trace(m_dragInitiator); |
987 visitor->trace(m_fileInputElementUnderMouse); | 987 visitor->trace(m_fileInputElementUnderMouse); |
988 } | 988 } |
989 | 989 |
990 } // namespace blink | 990 } // namespace blink |
OLD | NEW |