- Revision
- 153797
- Author
- [email protected]
- Date
- 2013-08-07 12:52:37 -0700 (Wed, 07 Aug 2013)
Log Message
Fall out of simple image layer optimization if the image has EXIF rotation
https://bugs.webkit.org/show_bug.cgi?id=119535
<rdar://problem/14071174>
Reviewed by Simon Fraser.
Test: fast/images/exif-orientation-composited.html
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::frameOrientationAtIndex):
Ensure that the frame is cached if we're requesting the orientation,
so we can acquire orientation information at any given time.
* platform/mac/DragImageMac.mm:
(WebCore::createDragImageFromImage):
* platform/graphics/BitmapImage.h:
Rename currentFrameOrientation to frameOrientationForCurrentFrame to match
the similarly-behaving nativeImageForCurrentFrame.
* platform/graphics/Image.h:
(WebCore::Image::orientationForCurrentFrame): Added. Virtual, overriden by BitmapImage.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::isDirectlyCompositedImage):
If the given image has a non-default image orientation, don't use direct compositing.
Add a test that ensures that composited images with EXIF orientation paint correctly.
* fast/images/exif-orientation-composited-expected.txt: Added.
* fast/images/exif-orientation-composited.html: Added.
* platform/mac/fast/images/exif-orientation-composited-expected.png: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (153796 => 153797)
--- trunk/LayoutTests/ChangeLog 2013-08-07 19:13:29 UTC (rev 153796)
+++ trunk/LayoutTests/ChangeLog 2013-08-07 19:52:37 UTC (rev 153797)
@@ -1,3 +1,17 @@
+2013-08-07 Tim Horton <[email protected]>
+
+ Fall out of simple image layer optimization if the image has EXIF rotation
+ https://bugs.webkit.org/show_bug.cgi?id=119535
+ <rdar://problem/14071174>
+
+ Reviewed by Simon Fraser.
+
+ Add a test that ensures that composited images with EXIF orientation paint correctly.
+
+ * fast/images/exif-orientation-composited-expected.txt: Added.
+ * fast/images/exif-orientation-composited.html: Added.
+ * platform/mac/fast/images/exif-orientation-composited-expected.png: Added.
+
2013-08-07 Allan Sandfeld Jensen <[email protected]>
[Qt] Skip background-blending-mode tests
Added: trunk/LayoutTests/fast/images/exif-orientation-composited-expected.txt (0 => 153797)
--- trunk/LayoutTests/fast/images/exif-orientation-composited-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/images/exif-orientation-composited-expected.txt 2013-08-07 19:52:37 UTC (rev 153797)
@@ -0,0 +1,18 @@
+The images should be rotated respecting their EXIF orientation. This test can only be run with testRunner (or by manually setting WebKitShouldRespectImageOrientation to true).
+
+
+Flipped horizontally
+Rotated 180°
+Flipped vertically
+
+Rotated 90° CCW and flipped vertically
+Rotated 90° CCW
+Rotated 90° CW and flipped vertically
+Rotated 90° CW
+img1 size = 100px by 50px
+img2 size = 100px by 50px
+img3 size = 100px by 50px
+img4 size = 50px by 100px
+img5 size = 50px by 100px
+img6 size = 50px by 100px
+img7 size = 50px by 100px
Added: trunk/LayoutTests/fast/images/exif-orientation-composited.html (0 => 153797)
--- trunk/LayoutTests/fast/images/exif-orientation-composited.html (rev 0)
+++ trunk/LayoutTests/fast/images/exif-orientation-composited.html 2013-08-07 19:52:37 UTC (rev 153797)
@@ -0,0 +1,46 @@
+<html>
+<head>
+<script>
+if (window.testRunner) {
+ testRunner.overridePreference('WebKitShouldRespectImageOrientation', 1);
+ testRunner.dumpAsText(true);
+}
+
+function log(str) {
+ var li = document.createElement("li");
+ li.appendChild(document.createTextNode(str));
+ var console = document.getElementById("console");
+ console.appendChild(li);
+}
+
+function imageSize(el) {
+ var computedStyle = window.getComputedStyle(el);
+ return computedStyle.width + " by " + computedStyle.height;
+}
+
+
+function load() {
+ for(var i = 1; i <= 7; i++)
+ log("img" + i + " size = " + imageSize(document.getElementById("img" + i)))
+}
+
+</script>
+<style>
+img { -webkit-transform: translateZ(0); }
+div { display: inline-block; margin-right: 20px; margin-bottom: 10px; width: 100px; vertical-align: top; }
+</style>
+</head>
+<body _onload_="load()">
+<b>The images should be rotated respecting their EXIF orientation. This test can only be run with testRunner (or by manually setting WebKitShouldRespectImageOrientation to true).</b><br><br>
+<div><img id="img1" src="" horizontally</div>
+<div><img id="img2" src="" 180°</div>
+<div><img id="img3" src="" vertically</div>
+<br>
+<div><img id="img4" src="" 90° CCW and flipped vertically</div>
+<div><img id="img5" src="" 90° CCW</div>
+<div><img id="img6" src="" 90° CW and flipped vertically </div>
+<div><img id="img7" src="" 90° CW</div>
+<br>
+<ul id="console"></ul>
+</body>
+</html>
Added: trunk/LayoutTests/platform/mac/fast/images/exif-orientation-composited-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/images/exif-orientation-composited-expected.png
___________________________________________________________________
Added: svn:mime-type
Modified: trunk/Source/WebCore/ChangeLog (153796 => 153797)
--- trunk/Source/WebCore/ChangeLog 2013-08-07 19:13:29 UTC (rev 153796)
+++ trunk/Source/WebCore/ChangeLog 2013-08-07 19:52:37 UTC (rev 153797)
@@ -1,3 +1,31 @@
+2013-08-07 Tim Horton <[email protected]>
+
+ Fall out of simple image layer optimization if the image has EXIF rotation
+ https://bugs.webkit.org/show_bug.cgi?id=119535
+ <rdar://problem/14071174>
+
+ Reviewed by Simon Fraser.
+
+ Test: fast/images/exif-orientation-composited.html
+
+ * platform/graphics/BitmapImage.cpp:
+ (WebCore::BitmapImage::frameOrientationAtIndex):
+ Ensure that the frame is cached if we're requesting the orientation,
+ so we can acquire orientation information at any given time.
+
+ * platform/mac/DragImageMac.mm:
+ (WebCore::createDragImageFromImage):
+ * platform/graphics/BitmapImage.h:
+ Rename currentFrameOrientation to frameOrientationForCurrentFrame to match
+ the similarly-behaving nativeImageForCurrentFrame.
+
+ * platform/graphics/Image.h:
+ (WebCore::Image::orientationForCurrentFrame): Added. Virtual, overriden by BitmapImage.
+
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::isDirectlyCompositedImage):
+ If the given image has a non-default image orientation, don't use direct compositing.
+
2013-08-07 Antti Koivisto <[email protected]>
fast/frames/seamless/seamless-custom-font-pruning-crash.html asserts
Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.cpp (153796 => 153797)
--- trunk/Source/WebCore/platform/graphics/BitmapImage.cpp 2013-08-07 19:13:29 UTC (rev 153796)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.cpp 2013-08-07 19:52:37 UTC (rev 153797)
@@ -338,14 +338,9 @@
return !frameHasAlphaAtIndex(currentFrame());
}
-ImageOrientation BitmapImage::currentFrameOrientation()
-{
- return frameOrientationAtIndex(currentFrame());
-}
-
ImageOrientation BitmapImage::frameOrientationAtIndex(size_t index)
{
- if (m_frames.size() <= index)
+ if (!ensureFrameIsCached(index))
return DefaultImageOrientation;
if (m_frames[index].m_haveMetadata)
Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.h (153796 => 153797)
--- trunk/Source/WebCore/platform/graphics/BitmapImage.h 2013-08-07 19:13:29 UTC (rev 153796)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.h 2013-08-07 19:52:37 UTC (rev 153797)
@@ -162,11 +162,10 @@
#endif
virtual PassNativeImagePtr nativeImageForCurrentFrame() OVERRIDE;
+ virtual ImageOrientation orientationForCurrentFrame() OVERRIDE { return frameOrientationAtIndex(currentFrame()); }
virtual bool currentFrameKnownToBeOpaque() OVERRIDE;
- ImageOrientation currentFrameOrientation();
-
#if !ASSERT_DISABLED
virtual bool notSolidColor();
#endif
Modified: trunk/Source/WebCore/platform/graphics/Image.h (153796 => 153797)
--- trunk/Source/WebCore/platform/graphics/Image.h 2013-08-07 19:13:29 UTC (rev 153796)
+++ trunk/Source/WebCore/platform/graphics/Image.h 2013-08-07 19:52:37 UTC (rev 153797)
@@ -143,6 +143,7 @@
enum TileRule { StretchTile, RoundTile, SpaceTile, RepeatTile };
virtual PassNativeImagePtr nativeImageForCurrentFrame() { return 0; }
+ virtual ImageOrientation orientationForCurrentFrame() { return ImageOrientation(); }
#if PLATFORM(MAC)
// Accessors for native image formats.
Modified: trunk/Source/WebCore/platform/mac/DragImageMac.mm (153796 => 153797)
--- trunk/Source/WebCore/platform/mac/DragImageMac.mm 2013-08-07 19:13:29 UTC (rev 153796)
+++ trunk/Source/WebCore/platform/mac/DragImageMac.mm 2013-08-07 19:52:37 UTC (rev 153797)
@@ -87,7 +87,7 @@
IntSize sizeRespectingOrientation = bitmapImage->sizeRespectingOrientation();
if (shouldRespectImageOrientation == RespectImageOrientation)
- orientation = bitmapImage->currentFrameOrientation();
+ orientation = bitmapImage->orientationForCurrentFrame();
if (orientation != DefaultImageOrientation) {
// Construct a correctly-rotated copy of the image to use as the drag image.
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (153796 => 153797)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2013-08-07 19:13:29 UTC (rev 153796)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2013-08-07 19:52:37 UTC (rev 153797)
@@ -1707,6 +1707,9 @@
if (!image->isBitmapImage())
return false;
+ if (image->orientationForCurrentFrame() != DefaultImageOrientation)
+ return false;
+
return m_graphicsLayer->shouldDirectlyCompositeImage(image);
}