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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 static const IntSize maxDragImageSize(200, 200); | 819 static const IntSize maxDragImageSize(200, 200); |
820 #endif | 820 #endif |
821 return maxDragImageSize; | 821 return maxDragImageSize; |
822 } | 822 } |
823 | 823 |
824 static PassOwnPtr<DragImage> dragImageForImage(Element* element, Image* image, c
onst IntPoint& dragOrigin, const IntRect& imageRect, IntPoint& dragLocation) | 824 static PassOwnPtr<DragImage> dragImageForImage(Element* element, Image* image, c
onst IntPoint& dragOrigin, const IntRect& imageRect, IntPoint& dragLocation) |
825 { | 825 { |
826 OwnPtr<DragImage> dragImage; | 826 OwnPtr<DragImage> dragImage; |
827 IntPoint origin; | 827 IntPoint origin; |
828 | 828 |
| 829 InterpolationQuality interpolationQuality = element->computedStyle()->imageR
endering() == ImageRenderingPixelated ? InterpolationNone : InterpolationHigh; |
829 if (image->size().height() * image->size().width() <= MaxOriginalImageArea | 830 if (image->size().height() * image->size().width() <= MaxOriginalImageArea |
830 && (dragImage = DragImage::create(image, element->renderer() ? element->
renderer()->shouldRespectImageOrientation() : DoNotRespectImageOrientation))) { | 831 && (dragImage = DragImage::create(image, element->renderer() ? element->
renderer()->shouldRespectImageOrientation() : DoNotRespectImageOrientation, 1 /*
deviceScaleFactor */, interpolationQuality))) { |
831 IntSize originalSize = imageRect.size(); | 832 IntSize originalSize = imageRect.size(); |
832 origin = imageRect.location(); | 833 origin = imageRect.location(); |
833 | 834 |
834 dragImage->fitToMaxSize(imageRect.size(), maxDragImageSize()); | 835 dragImage->fitToMaxSize(imageRect.size(), maxDragImageSize()); |
835 dragImage->dissolveToFraction(DragImageAlpha); | 836 dragImage->dissolveToFraction(DragImageAlpha); |
836 IntSize newSize = dragImage->size(); | 837 IntSize newSize = dragImage->size(); |
837 | 838 |
838 // Properly orient the drag image and orient it differently if it's smal
ler than the original | 839 // Properly orient the drag image and orient it differently if it's smal
ler than the original |
839 float scale = newSize.width() / (float)originalSize.width(); | 840 float scale = newSize.width() / (float)originalSize.width(); |
840 float dx = origin.x() - dragOrigin.x(); | 841 float dx = origin.x() - dragOrigin.x(); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 | 987 |
987 void DragController::trace(Visitor* visitor) | 988 void DragController::trace(Visitor* visitor) |
988 { | 989 { |
989 visitor->trace(m_page); | 990 visitor->trace(m_page); |
990 visitor->trace(m_documentUnderMouse); | 991 visitor->trace(m_documentUnderMouse); |
991 visitor->trace(m_dragInitiator); | 992 visitor->trace(m_dragInitiator); |
992 visitor->trace(m_fileInputElementUnderMouse); | 993 visitor->trace(m_fileInputElementUnderMouse); |
993 } | 994 } |
994 | 995 |
995 } // namespace blink | 996 } // namespace blink |
OLD | NEW |