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

Unified Diff: third_party/WebKit/Source/core/page/DragController.cpp

Issue 1361413004: Fix directly composited image path for CSS image-orientation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing Created 5 years, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/page/DragController.cpp
diff --git a/third_party/WebKit/Source/core/page/DragController.cpp b/third_party/WebKit/Source/core/page/DragController.cpp
index bef7db43ba5cda0f96b52880e5c9b909ed8e44ac..70493d61143cdd663012e717edd69c1d3716de71 100644
--- a/third_party/WebKit/Source/core/page/DragController.cpp
+++ b/third_party/WebKit/Source/core/page/DragController.cpp
@@ -71,6 +71,7 @@
#include "core/layout/LayoutImage.h"
#include "platform/DragImage.h"
#include "platform/geometry/IntRect.h"
+#include "platform/graphics/BitmapImage.h"
#include "platform/graphics/Image.h"
#include "platform/graphics/ImageOrientation.h"
#include "platform/network/ResourceRequest.h"
@@ -799,11 +800,16 @@ static PassOwnPtr<DragImage> dragImageForImage(Element* element, Image* image, c
IntPoint origin;
InterpolationQuality interpolationQuality = element->ensureComputedStyle()->imageRendering() == ImageRenderingPixelated ? InterpolationNone : InterpolationHigh;
+ RespectImageOrientationEnum shouldRespectImageOrientation = element->layoutObject() ? element->layoutObject()->shouldRespectImageOrientation() : DoNotRespectImageOrientation;
+ ImageOrientation orientation;
+
+ if (shouldRespectImageOrientation == RespectImageOrientation && image->isBitmapImage())
+ orientation = toBitmapImage(image)->currentFrameOrientation();
+
if (image->size().height() * image->size().width() <= MaxOriginalImageArea
- && (dragImage = DragImage::create(image,
- element->layoutObject() ? element->layoutObject()->shouldRespectImageOrientation() : DoNotRespectImageOrientation,
+ && (dragImage = DragImage::create(image, shouldRespectImageOrientation,
1 /* deviceScaleFactor */, interpolationQuality, DragImageAlpha,
- DragImage::clampedImageScale(*image, imageRect.size(), maxDragImageSize())))) {
+ DragImage::clampedImageScale(orientation.usesWidthAsHeight() ? image->size().transposedSize() : image->size(), imageRect.size(), maxDragImageSize())))) {
IntSize originalSize = imageRect.size();
origin = imageRect.location();

Powered by Google App Engine
This is Rietveld 408576698