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

Side by Side Diff: third_party/WebKit/Source/core/page/DragController.cpp

Issue 2469873002: [ImageResource 4] Split ImageResource into Resource and Image parts (Closed)
Patch Set: style Created 4 years 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) 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 28 matching lines...) Expand all
39 #include "core/dom/Node.h" 39 #include "core/dom/Node.h"
40 #include "core/dom/Text.h" 40 #include "core/dom/Text.h"
41 #include "core/dom/shadow/ShadowRoot.h" 41 #include "core/dom/shadow/ShadowRoot.h"
42 #include "core/editing/DragCaretController.h" 42 #include "core/editing/DragCaretController.h"
43 #include "core/editing/EditingUtilities.h" 43 #include "core/editing/EditingUtilities.h"
44 #include "core/editing/Editor.h" 44 #include "core/editing/Editor.h"
45 #include "core/editing/FrameSelection.h" 45 #include "core/editing/FrameSelection.h"
46 #include "core/editing/commands/DragAndDropCommand.h" 46 #include "core/editing/commands/DragAndDropCommand.h"
47 #include "core/editing/serializers/Serialization.h" 47 #include "core/editing/serializers/Serialization.h"
48 #include "core/events/TextEvent.h" 48 #include "core/events/TextEvent.h"
49 #include "core/fetch/ImageResource.h" 49 #include "core/fetch/ImageResourceContent.h"
50 #include "core/fetch/ResourceFetcher.h" 50 #include "core/fetch/ResourceFetcher.h"
51 #include "core/frame/FrameHost.h" 51 #include "core/frame/FrameHost.h"
52 #include "core/frame/FrameView.h" 52 #include "core/frame/FrameView.h"
53 #include "core/frame/LocalFrame.h" 53 #include "core/frame/LocalFrame.h"
54 #include "core/frame/Settings.h" 54 #include "core/frame/Settings.h"
55 #include "core/html/HTMLAnchorElement.h" 55 #include "core/html/HTMLAnchorElement.h"
56 #include "core/html/HTMLFormElement.h" 56 #include "core/html/HTMLFormElement.h"
57 #include "core/html/HTMLInputElement.h" 57 #include "core/html/HTMLInputElement.h"
58 #include "core/html/HTMLPlugInElement.h" 58 #include "core/html/HTMLPlugInElement.h"
59 #include "core/input/EventHandler.h" 59 #include "core/input/EventHandler.h"
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 node = startNode; 822 node = startNode;
823 } else { 823 } else {
824 // If the cursor isn't over a selection, then just drag the node we found 824 // If the cursor isn't over a selection, then just drag the node we found
825 // earlier. 825 // earlier.
826 DCHECK_EQ(dragType, DragSourceActionNone); 826 DCHECK_EQ(dragType, DragSourceActionNone);
827 dragType = candidateDragType; 827 dragType = candidateDragType;
828 } 828 }
829 return node; 829 return node;
830 } 830 }
831 831
832 static ImageResource* getImageResource(Element* element) { 832 static ImageResourceContent* getImageResource(Element* element) {
833 DCHECK(element); 833 DCHECK(element);
834 LayoutObject* layoutObject = element->layoutObject(); 834 LayoutObject* layoutObject = element->layoutObject();
835 if (!layoutObject || !layoutObject->isImage()) 835 if (!layoutObject || !layoutObject->isImage())
836 return nullptr; 836 return nullptr;
837 LayoutImage* image = toLayoutImage(layoutObject); 837 LayoutImage* image = toLayoutImage(layoutObject);
838 return image->cachedImage(); 838 return image->cachedImage();
839 } 839 }
840 840
841 static Image* getImage(Element* element) { 841 static Image* getImage(Element* element) {
842 DCHECK(element); 842 DCHECK(element);
843 ImageResource* cachedImage = getImageResource(element); 843 ImageResourceContent* cachedImage = getImageResource(element);
844 return (cachedImage && !cachedImage->errorOccurred()) 844 return (cachedImage && !cachedImage->errorOccurred())
845 ? cachedImage->getImage() 845 ? cachedImage->getImage()
846 : nullptr; 846 : nullptr;
847 } 847 }
848 848
849 static void prepareDataTransferForImageDrag(LocalFrame* source, 849 static void prepareDataTransferForImageDrag(LocalFrame* source,
850 DataTransfer* dataTransfer, 850 DataTransfer* dataTransfer,
851 Element* node, 851 Element* node,
852 const KURL& linkURL, 852 const KURL& linkURL,
853 const KURL& imageURL, 853 const KURL& imageURL,
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 } 1232 }
1233 1233
1234 DEFINE_TRACE(DragController) { 1234 DEFINE_TRACE(DragController) {
1235 visitor->trace(m_page); 1235 visitor->trace(m_page);
1236 visitor->trace(m_documentUnderMouse); 1236 visitor->trace(m_documentUnderMouse);
1237 visitor->trace(m_dragInitiator); 1237 visitor->trace(m_dragInitiator);
1238 visitor->trace(m_fileInputElementUnderMouse); 1238 visitor->trace(m_fileInputElementUnderMouse);
1239 } 1239 }
1240 1240
1241 } // namespace blink 1241 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698