| 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 if (src->selection().contains(dragOrigin)) { | 627 if (src->selection().contains(dragOrigin)) { |
| 628 dragType = DragSourceActionSelection; | 628 dragType = DragSourceActionSelection; |
| 629 if (selectionDragPolicy == ImmediateSelectionDragResolution) | 629 if (selectionDragPolicy == ImmediateSelectionDragResolution) |
| 630 return startNode; | 630 return startNode; |
| 631 } else { | 631 } else { |
| 632 dragType = DragSourceActionNone; | 632 dragType = DragSourceActionNone; |
| 633 } | 633 } |
| 634 | 634 |
| 635 Node* node = nullptr; | 635 Node* node = nullptr; |
| 636 DragSourceAction candidateDragType = DragSourceActionNone; | 636 DragSourceAction candidateDragType = DragSourceActionNone; |
| 637 for (const RenderObject* renderer = startNode->renderer(); renderer; rendere
r = renderer->parent()) { | 637 for (const LayoutObject* renderer = startNode->renderer(); renderer; rendere
r = renderer->parent()) { |
| 638 node = renderer->nonPseudoNode(); | 638 node = renderer->nonPseudoNode(); |
| 639 if (!node) { | 639 if (!node) { |
| 640 // Anonymous render blocks don't correspond to actual DOM nodes, so
we skip over them | 640 // Anonymous render blocks don't correspond to actual DOM nodes, so
we skip over them |
| 641 // for the purposes of finding a draggable node. | 641 // for the purposes of finding a draggable node. |
| 642 continue; | 642 continue; |
| 643 } | 643 } |
| 644 if (dragType != DragSourceActionSelection && node->isTextNode() && node-
>canStartSelection()) { | 644 if (dragType != DragSourceActionSelection && node->isTextNode() && node-
>canStartSelection()) { |
| 645 // In this case we have a click in the unselected portion of text. I
f this text is | 645 // In this case we have a click in the unselected portion of text. I
f this text is |
| 646 // selectable, we want to start the selection process instead of loo
king for a parent | 646 // selectable, we want to start the selection process instead of loo
king for a parent |
| 647 // to try to drag. | 647 // to try to drag. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 // If the cursor isn't over a selection, then just drag the node we foun
d earlier. | 690 // If the cursor isn't over a selection, then just drag the node we foun
d earlier. |
| 691 ASSERT(dragType == DragSourceActionNone); | 691 ASSERT(dragType == DragSourceActionNone); |
| 692 dragType = candidateDragType; | 692 dragType = candidateDragType; |
| 693 } | 693 } |
| 694 return node; | 694 return node; |
| 695 } | 695 } |
| 696 | 696 |
| 697 static ImageResource* getImageResource(Element* element) | 697 static ImageResource* getImageResource(Element* element) |
| 698 { | 698 { |
| 699 ASSERT(element); | 699 ASSERT(element); |
| 700 RenderObject* renderer = element->renderer(); | 700 LayoutObject* renderer = element->renderer(); |
| 701 if (!renderer || !renderer->isImage()) | 701 if (!renderer || !renderer->isImage()) |
| 702 return nullptr; | 702 return nullptr; |
| 703 RenderImage* image = toRenderImage(renderer); | 703 RenderImage* image = toRenderImage(renderer); |
| 704 return image->cachedImage(); | 704 return image->cachedImage(); |
| 705 } | 705 } |
| 706 | 706 |
| 707 static Image* getImage(Element* element) | 707 static Image* getImage(Element* element) |
| 708 { | 708 { |
| 709 ASSERT(element); | 709 ASSERT(element); |
| 710 ImageResource* cachedImage = getImageResource(element); | 710 ImageResource* cachedImage = getImageResource(element); |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 | 986 |
| 987 void DragController::trace(Visitor* visitor) | 987 void DragController::trace(Visitor* visitor) |
| 988 { | 988 { |
| 989 visitor->trace(m_page); | 989 visitor->trace(m_page); |
| 990 visitor->trace(m_documentUnderMouse); | 990 visitor->trace(m_documentUnderMouse); |
| 991 visitor->trace(m_dragInitiator); | 991 visitor->trace(m_dragInitiator); |
| 992 visitor->trace(m_fileInputElementUnderMouse); | 992 visitor->trace(m_fileInputElementUnderMouse); |
| 993 } | 993 } |
| 994 | 994 |
| 995 } // namespace blink | 995 } // namespace blink |
| OLD | NEW |