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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 if (!layoutObject || !layoutObject->isImage()) | 698 if (!layoutObject || !layoutObject->isImage()) |
699 return nullptr; | 699 return nullptr; |
700 LayoutImage* image = toLayoutImage(layoutObject); | 700 LayoutImage* image = toLayoutImage(layoutObject); |
701 return image->cachedImage(); | 701 return image->cachedImage(); |
702 } | 702 } |
703 | 703 |
704 static Image* getImage(Element* element) | 704 static Image* getImage(Element* element) |
705 { | 705 { |
706 ASSERT(element); | 706 ASSERT(element); |
707 ImageResource* cachedImage = getImageResource(element); | 707 ImageResource* cachedImage = getImageResource(element); |
708 // Don't use cachedImage->imageForLayoutObject() here as that may return Bit
mapImages for cached SVG Images. | |
709 // Users of getImage() want access to the SVGImage, in order to figure out t
he filename extensions, | |
710 // which would be empty when asking the cached BitmapImages. | |
711 return (cachedImage && !cachedImage->errorOccurred()) ? | 708 return (cachedImage && !cachedImage->errorOccurred()) ? |
712 cachedImage->image() : nullptr; | 709 cachedImage->image() : nullptr; |
713 } | 710 } |
714 | 711 |
715 static void prepareDataTransferForImageDrag(LocalFrame* source, DataTransfer* da
taTransfer, Element* node, const KURL& linkURL, const KURL& imageURL, const Stri
ng& label) | 712 static void prepareDataTransferForImageDrag(LocalFrame* source, DataTransfer* da
taTransfer, Element* node, const KURL& linkURL, const KURL& imageURL, const Stri
ng& label) |
716 { | 713 { |
717 if (node->isContentRichlyEditable()) { | 714 if (node->isContentRichlyEditable()) { |
718 RefPtrWillBeRawPtr<Range> range = source->document()->createRange(); | 715 RefPtrWillBeRawPtr<Range> range = source->document()->createRange(); |
719 range->selectNode(node, ASSERT_NO_EXCEPTION); | 716 range->selectNode(node, ASSERT_NO_EXCEPTION); |
720 source->selection().setSelection(VisibleSelection(EphemeralRange(range.g
et()))); | 717 source->selection().setSelection(VisibleSelection(EphemeralRange(range.g
et()))); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 | 961 |
965 DEFINE_TRACE(DragController) | 962 DEFINE_TRACE(DragController) |
966 { | 963 { |
967 visitor->trace(m_page); | 964 visitor->trace(m_page); |
968 visitor->trace(m_documentUnderMouse); | 965 visitor->trace(m_documentUnderMouse); |
969 visitor->trace(m_dragInitiator); | 966 visitor->trace(m_dragInitiator); |
970 visitor->trace(m_fileInputElementUnderMouse); | 967 visitor->trace(m_fileInputElementUnderMouse); |
971 } | 968 } |
972 | 969 |
973 } // namespace blink | 970 } // namespace blink |
OLD | NEW |