haikuwebkit/LayoutTests/fast/images/exif-orientation-image-obje...

83 lines
2.5 KiB
HTML
Raw Permalink Normal View History

Source/WebCore: EXIF orientation should be respected when rendering images https://bugs.webkit.org/show_bug.cgi?id=201123 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-08-31 Reviewed by Simon Fraser. -- Image::size() will return the rendered size based on the image orientation. If image orientation is FromImage, ImageSource will query the actual image orientation from the ImageDecoder. The low level APIs might transpose the size just before calling the system API to draw the image. -- RenderElement::imageOrientation() will return ImageOrientation::FromImage for all images and for all ports till the CSS image-orientation specs is finalized. -- The default of ImagePaintingOptions argument of GraphicsContext::drawImage() will be changed to { ImageOrientation::FromImage }. -- Image element: RenderImage::paintIntoRect() will pass imageOrientation() which returns ImageOrientation::FromImage to GraphicsContext::drawImage(). -- CSS background image: RenderBoxModelObject::paintFillLayerExtended will pass ImageOrientation::FromImage by default to GraphicsContext::drawTiledImage(). -- Images on canvas: CanvasRenderingContext2DBase::drawImage() will pass ImageOrientation::FromImage by default to GraphicsContext::drawImage(). -- SVG images: RenderSVGImage::paintForeground() calls GraphicsContext::drawImage() with the default ImagePaintingOptions which is now { ImageOrientation::FromImage }. -- SVG feImage filters: FEImage::platformApplySoftware() calls GraphicsContext::drawImage() with the default ImagePaintingOptions which is now { ImageOrientation::FromImage }. -- ImageDocument: RenderElement::imageOrientation() returns FromImage always and for all ports. Tests: fast/images/exif-orientation-background.html fast/images/exif-orientation-canvas.html fast/images/exif-orientation-content.html fast/images/exif-orientation-element-object-fit.html fast/images/exif-orientation-element.html fast/images/exif-orientation-image-object.html fast/images/exif-orientation-svg-feimage.html fast/images/exif-orientation-svg-image.html * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::drawImage): * loader/cache/CachedImage.cpp: (WebCore::CachedImage::imageSizeForRenderer const): * platform/graphics/BitmapImage.h: * platform/graphics/CrossfadeGeneratedImage.h: * platform/graphics/GeneratedImage.h: * platform/graphics/GraphicsContext.h: (WebCore::GraphicsContext::drawImage): * platform/graphics/Image.h: * platform/graphics/ImageFrame.h: (WebCore::ImageFrame::sizeRespectingOrientation const): Deleted. * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::ImageSource): (WebCore::ImageSource::orientation): (WebCore::ImageSource::size): (WebCore::ImageSource::sizeRespectingOrientation): Deleted. * platform/graphics/ImageSource.h: * platform/graphics/cg/PDFDocumentImage.cpp: (WebCore::PDFDocumentImage::size const): * platform/graphics/cg/PDFDocumentImage.h: * platform/mac/DragImageMac.mm: (WebCore::createDragImageFromImage): * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintFillLayerExtended): * rendering/RenderElement.cpp: (WebCore::RenderElement::imageOrientation const): * rendering/RenderImage.cpp: (WebCore::RenderImage::paintIntoRect): * svg/graphics/SVGImage.h: * svg/graphics/SVGImageForContainer.cpp: (WebCore::SVGImageForContainer::size const): * svg/graphics/SVGImageForContainer.h: LayoutTests: EXIF orientation should be respected when rendering images https://bugs.webkit.org/show_bug.cgi?id=201123 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-08-31 Reviewed by Simon Fraser. Existing tests are made ref-tests. New tests were added to cover more cases for drawing images. * fast/images/exif-orientation-background-expected.html: Added. * fast/images/exif-orientation-background.html: Added. * fast/images/exif-orientation-canvas-expected.html: Added. * fast/images/exif-orientation-canvas.html: Added. * fast/images/exif-orientation-composited-expected.html: Added. * fast/images/exif-orientation-composited-expected.txt: Removed. * fast/images/exif-orientation-composited.html: * fast/images/exif-orientation-content-expected.html: Added. * fast/images/exif-orientation-content.html: Added. * fast/images/exif-orientation-css-expected.txt: Removed. * fast/images/exif-orientation-css.html: Removed. * fast/images/exif-orientation-element-expected.html: Added. * fast/images/exif-orientation-element-object-fit-expected.html: Added. * fast/images/exif-orientation-element-object-fit.html: Added. * fast/images/exif-orientation-element.html: Added. * fast/images/exif-orientation-expected.txt: Removed. * fast/images/exif-orientation-image-document-expected.html: Added. * fast/images/exif-orientation-image-document-expected.txt: Removed. * fast/images/exif-orientation-image-document.html: * fast/images/exif-orientation-image-object-expected.html: Added. * fast/images/exif-orientation-image-object.html: Added. * fast/images/exif-orientation-svg-feimage-expected.html: Added. * fast/images/exif-orientation-svg-feimage.html: Added. * fast/images/exif-orientation-svg-image-expected.html: Added. * fast/images/exif-orientation-svg-image.html: Added. * fast/images/exif-orientation.html: Removed. * platform/gtk/TestExpectations: * platform/mac/fast/images/exif-orientation-composited-expected.png: Removed. * platform/win/TestExpectations: Canonical link: https://commits.webkit.org/215033@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249364 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-01 00:47:39 +00:00
<!DOCTYPE html>
<style>
div.container {
display: inline-block;
margin-right: 20px;
margin-bottom: 10px;
width: 100px;
vertical-align: top;
}
div.horizontal {
width: 102px;
Source/WebCore: EXIF orientation should be respected when rendering images https://bugs.webkit.org/show_bug.cgi?id=201123 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-08-31 Reviewed by Simon Fraser. -- Image::size() will return the rendered size based on the image orientation. If image orientation is FromImage, ImageSource will query the actual image orientation from the ImageDecoder. The low level APIs might transpose the size just before calling the system API to draw the image. -- RenderElement::imageOrientation() will return ImageOrientation::FromImage for all images and for all ports till the CSS image-orientation specs is finalized. -- The default of ImagePaintingOptions argument of GraphicsContext::drawImage() will be changed to { ImageOrientation::FromImage }. -- Image element: RenderImage::paintIntoRect() will pass imageOrientation() which returns ImageOrientation::FromImage to GraphicsContext::drawImage(). -- CSS background image: RenderBoxModelObject::paintFillLayerExtended will pass ImageOrientation::FromImage by default to GraphicsContext::drawTiledImage(). -- Images on canvas: CanvasRenderingContext2DBase::drawImage() will pass ImageOrientation::FromImage by default to GraphicsContext::drawImage(). -- SVG images: RenderSVGImage::paintForeground() calls GraphicsContext::drawImage() with the default ImagePaintingOptions which is now { ImageOrientation::FromImage }. -- SVG feImage filters: FEImage::platformApplySoftware() calls GraphicsContext::drawImage() with the default ImagePaintingOptions which is now { ImageOrientation::FromImage }. -- ImageDocument: RenderElement::imageOrientation() returns FromImage always and for all ports. Tests: fast/images/exif-orientation-background.html fast/images/exif-orientation-canvas.html fast/images/exif-orientation-content.html fast/images/exif-orientation-element-object-fit.html fast/images/exif-orientation-element.html fast/images/exif-orientation-image-object.html fast/images/exif-orientation-svg-feimage.html fast/images/exif-orientation-svg-image.html * html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::drawImage): * loader/cache/CachedImage.cpp: (WebCore::CachedImage::imageSizeForRenderer const): * platform/graphics/BitmapImage.h: * platform/graphics/CrossfadeGeneratedImage.h: * platform/graphics/GeneratedImage.h: * platform/graphics/GraphicsContext.h: (WebCore::GraphicsContext::drawImage): * platform/graphics/Image.h: * platform/graphics/ImageFrame.h: (WebCore::ImageFrame::sizeRespectingOrientation const): Deleted. * platform/graphics/ImageSource.cpp: (WebCore::ImageSource::ImageSource): (WebCore::ImageSource::orientation): (WebCore::ImageSource::size): (WebCore::ImageSource::sizeRespectingOrientation): Deleted. * platform/graphics/ImageSource.h: * platform/graphics/cg/PDFDocumentImage.cpp: (WebCore::PDFDocumentImage::size const): * platform/graphics/cg/PDFDocumentImage.h: * platform/mac/DragImageMac.mm: (WebCore::createDragImageFromImage): * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintFillLayerExtended): * rendering/RenderElement.cpp: (WebCore::RenderElement::imageOrientation const): * rendering/RenderImage.cpp: (WebCore::RenderImage::paintIntoRect): * svg/graphics/SVGImage.h: * svg/graphics/SVGImageForContainer.cpp: (WebCore::SVGImageForContainer::size const): * svg/graphics/SVGImageForContainer.h: LayoutTests: EXIF orientation should be respected when rendering images https://bugs.webkit.org/show_bug.cgi?id=201123 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-08-31 Reviewed by Simon Fraser. Existing tests are made ref-tests. New tests were added to cover more cases for drawing images. * fast/images/exif-orientation-background-expected.html: Added. * fast/images/exif-orientation-background.html: Added. * fast/images/exif-orientation-canvas-expected.html: Added. * fast/images/exif-orientation-canvas.html: Added. * fast/images/exif-orientation-composited-expected.html: Added. * fast/images/exif-orientation-composited-expected.txt: Removed. * fast/images/exif-orientation-composited.html: * fast/images/exif-orientation-content-expected.html: Added. * fast/images/exif-orientation-content.html: Added. * fast/images/exif-orientation-css-expected.txt: Removed. * fast/images/exif-orientation-css.html: Removed. * fast/images/exif-orientation-element-expected.html: Added. * fast/images/exif-orientation-element-object-fit-expected.html: Added. * fast/images/exif-orientation-element-object-fit.html: Added. * fast/images/exif-orientation-element.html: Added. * fast/images/exif-orientation-expected.txt: Removed. * fast/images/exif-orientation-image-document-expected.html: Added. * fast/images/exif-orientation-image-document-expected.txt: Removed. * fast/images/exif-orientation-image-document.html: * fast/images/exif-orientation-image-object-expected.html: Added. * fast/images/exif-orientation-image-object.html: Added. * fast/images/exif-orientation-svg-feimage-expected.html: Added. * fast/images/exif-orientation-svg-feimage.html: Added. * fast/images/exif-orientation-svg-image-expected.html: Added. * fast/images/exif-orientation-svg-image.html: Added. * fast/images/exif-orientation.html: Removed. * platform/gtk/TestExpectations: * platform/mac/fast/images/exif-orientation-composited-expected.png: Removed. * platform/win/TestExpectations: Canonical link: https://commits.webkit.org/215033@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249364 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-01 00:47:39 +00:00
height: 52px;
}
div.vertical {
width: 52px;
height: 102px;
}
img {
border: 1px solid black;
}
</style>
<body>
<b>The images of the &lt;object&gt; elements should be rotated respecting their EXIF orientation.</b>
<br>
<br>
<div class="container">
<div class="horizontal">
<img src="resources/exif-orientation-1-ul.jpg">
</div>
<br>Normal
</div>
<div class="container">
<div class="horizontal">
<img src="resources/exif-orientation-1-ul.jpg" style="transform: scaleX(-1);">
</div>
<br>Flipped horizontally
</div>
<div class="container">
<div class="horizontal">
<img src="resources/exif-orientation-1-ul.jpg" style="transform: rotate(180deg);">
</div>
<br>Rotated 180&deg;
</div>
<div class="container">
<div class="horizontal">
<img src="resources/exif-orientation-1-ul.jpg" style="transform: scaleX(-1) rotate(180deg);">
</div>
<br>Flipped vertically
</div>
<br>
<div class="container">
<div class="vertical">
<img src="resources/exif-orientation-1-ul.jpg" style="transform: translate(-25px, 25px) rotate(90deg) scaleY(-1);">
</div>
<br>Rotated 90&deg; CCW and flipped vertically
</div>
<div class="container">
<div class="vertical">
<img src="resources/exif-orientation-1-ul.jpg" style="transform: translate(-25px, 25px) rotate(90deg);">
</div>
<br>Rotated 90&deg; CCW
</div>
<div class="container">
<div class="vertical">
<img src="resources/exif-orientation-1-ul.jpg" style="transform: translate(-25px, 25px) rotate(270deg) scaleY(-1);">
</div>
<br>Rotated 90&deg; CW and flipped vertically
</div>
<div class="container">
<div class="vertical">
<img src="resources/exif-orientation-1-ul.jpg" style="transform: translate(-25px, 25px) rotate(270deg);">
</div>
<br>Rotated 90&deg; CW
</div>
<br>
<div class="container">
<div class="horizontal">
<img src="resources/exif-orientation-1-ul.jpg">
</div>
<br>Undefined (invalid value)
</div>
</body>