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

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: comments 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 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 node = startNode; 821 node = startNode;
822 } else { 822 } else {
823 // If the cursor isn't over a selection, then just drag the node we found 823 // If the cursor isn't over a selection, then just drag the node we found
824 // earlier. 824 // earlier.
825 DCHECK_EQ(dragType, DragSourceActionNone); 825 DCHECK_EQ(dragType, DragSourceActionNone);
826 dragType = candidateDragType; 826 dragType = candidateDragType;
827 } 827 }
828 return node; 828 return node;
829 } 829 }
830 830
831 static ImageResource* getImageResource(Element* element) { 831 static ImageResourceContent* getImageResource(Element* element) {
832 DCHECK(element); 832 DCHECK(element);
833 LayoutObject* layoutObject = element->layoutObject(); 833 LayoutObject* layoutObject = element->layoutObject();
834 if (!layoutObject || !layoutObject->isImage()) 834 if (!layoutObject || !layoutObject->isImage())
835 return nullptr; 835 return nullptr;
836 LayoutImage* image = toLayoutImage(layoutObject); 836 LayoutImage* image = toLayoutImage(layoutObject);
837 return image->cachedImage(); 837 return image->cachedImage();
838 } 838 }
839 839
840 static Image* getImage(Element* element) { 840 static Image* getImage(Element* element) {
841 DCHECK(element); 841 DCHECK(element);
842 ImageResource* cachedImage = getImageResource(element); 842 ImageResourceContent* cachedImage = getImageResource(element);
843 return (cachedImage && !cachedImage->errorOccurred()) 843 return (cachedImage && !cachedImage->errorOccurred())
844 ? cachedImage->getImage() 844 ? cachedImage->getImage()
845 : nullptr; 845 : nullptr;
846 } 846 }
847 847
848 static void prepareDataTransferForImageDrag(LocalFrame* source, 848 static void prepareDataTransferForImageDrag(LocalFrame* source,
849 DataTransfer* dataTransfer, 849 DataTransfer* dataTransfer,
850 Element* node, 850 Element* node,
851 const KURL& linkURL, 851 const KURL& linkURL,
852 const KURL& imageURL, 852 const KURL& imageURL,
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 } 1221 }
1222 1222
1223 DEFINE_TRACE(DragController) { 1223 DEFINE_TRACE(DragController) {
1224 visitor->trace(m_page); 1224 visitor->trace(m_page);
1225 visitor->trace(m_documentUnderMouse); 1225 visitor->trace(m_documentUnderMouse);
1226 visitor->trace(m_dragInitiator); 1226 visitor->trace(m_dragInitiator);
1227 visitor->trace(m_fileInputElementUnderMouse); 1227 visitor->trace(m_fileInputElementUnderMouse);
1228 } 1228 }
1229 1229
1230 } // namespace blink 1230 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698