shouldRespectImageOrientation should be a value in ImageOrientation
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Aug 2019 01:58:53 +0000 (01:58 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Aug 2019 01:58:53 +0000 (01:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=200553

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-08-13
Reviewed by Simon Fraser.

Source/WebCore:

This patch is a step towards implementing the css image-orientation.

Instead of having ImageOrientationEnum, ImageOrientationDescription,
ImageOrientation and RespectImageOrientationEnum we are going to have a
single structure named 'ImageOrientation' which is a wrapper for the enum
type "Orientation".

This structure will have a constructor and casting operator such that
assigning an enum value and comparing with an enum value will be done
implicitly.

RespectImageOrientation is represented as a new enum value 'FromImage'.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator ImageOrientation const):
(WebCore::CSSPrimitiveValue::operator ImageOrientationEnum const): Deleted.
* dom/DataTransfer.cpp:
(WebCore::DataTransfer::createDragImage const):
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::paint):
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::imageSizeForRenderer const):
* page/DragController.cpp:
(WebCore::DragController::doImageDrag):
* platform/DragImage.cpp:
(WebCore::createDragImageFromSnapshot):
(WebCore::createDragImageFromImage):
* platform/DragImage.h:
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::draw):
(WebCore::BitmapImage::drawPattern):
* platform/graphics/BitmapImage.h:
* platform/graphics/CrossfadeGeneratedImage.cpp:
(WebCore::CrossfadeGeneratedImage::draw):
* platform/graphics/CrossfadeGeneratedImage.h:
* platform/graphics/CustomPaintImage.cpp:
(WebCore::CustomPaintImage::draw):
* platform/graphics/CustomPaintImage.h:
* platform/graphics/GeneratedImage.h:
* platform/graphics/GradientImage.cpp:
(WebCore::GradientImage::draw):
* platform/graphics/GradientImage.h:
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawImage):
(WebCore::GraphicsContext::drawTiledImage):
* platform/graphics/GraphicsContext.h:
(WebCore::ImagePaintingOptions::ImagePaintingOptions):
* platform/graphics/GraphicsContextImpl.cpp:
(WebCore::GraphicsContextImpl::drawImageImpl):
(WebCore::GraphicsContextImpl::drawTiledImageImpl):
* platform/graphics/Image.cpp:
(WebCore::Image::drawTiled):
* platform/graphics/Image.h:
* platform/graphics/ImageFrame.h:
* platform/graphics/ImageOrientation.cpp: Removed.
* platform/graphics/ImageOrientation.h:
(WebCore::ImageOrientation::ImageOrientation):
(WebCore::ImageOrientation::fromEXIFValue):
(WebCore::ImageOrientation::operator Orientation const):
(WebCore::ImageOrientation::usesWidthAsHeight const):
(WebCore::ImageOrientation::transformFromDefault const):
(WebCore::ImageOrientation::isValidOrientation):
(WebCore::ImageOrientation::isValidEXIFOrientation):
(WebCore::ImageOrientationDescription::ImageOrientationDescription): Deleted.
(WebCore::ImageOrientationDescription::setRespectImageOrientation): Deleted.
(WebCore::ImageOrientationDescription::respectImageOrientation): Deleted.
(WebCore::ImageOrientationDescription::setImageOrientationEnum): Deleted.
(WebCore::ImageOrientationDescription::imageOrientation): Deleted.
(WebCore::ImageOrientation::operator ImageOrientationEnum const): Deleted.
(WebCore::ImageOrientation::operator== const): Deleted.
(WebCore::ImageOrientation::operator!= const): Deleted.
* platform/graphics/ImageSource.cpp:
(WebCore::ImageSource::dump):
* platform/graphics/NamedImageGeneratedImage.cpp:
(WebCore::NamedImageGeneratedImage::draw):
* platform/graphics/NamedImageGeneratedImage.h:
* platform/graphics/NativeImage.h:
* platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
(WebCore::ImageDecoderAVFObjC::frameOrientationAtIndex const):
* platform/graphics/cairo/CairoOperations.cpp:
(WebCore::Cairo::drawShadowLayerBuffer):
(WebCore::Cairo::drawShadowImage):
(WebCore::Cairo::drawNativeImage):
* platform/graphics/cairo/ImageBufferCairo.cpp:
(WebCore::ImageBuffer::draw):
* platform/graphics/cairo/NativeImageCairo.cpp:
(WebCore::drawNativeImage):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawNativeImage):
* platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::orientationFromProperties):
(WebCore::ImageDecoderCG::frameOrientationAtIndex const):
* platform/graphics/cg/NativeImageCG.cpp:
(WebCore::drawNativeImage):
* platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::draw):
* platform/graphics/cg/PDFDocumentImage.h:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::handleMessage):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::paint):
(WebCore::MediaPlayerPrivateGStreamerBase::setVideoSourceOrientation):
(WebCore::MediaPlayerPrivateGStreamerBase::updateTextureMapperFlags):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
* platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
(WebCore::VideoTextureCopierGStreamer::updateTextureSpaceMatrix):
(WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
* platform/graphics/gstreamer/VideoTextureCopierGStreamer.h:
* platform/graphics/win/Direct2DOperations.cpp:
(WebCore::Direct2D::drawNativeImage):
* platform/graphics/win/ImageCGWin.cpp:
(WebCore::BitmapImage::getHBITMAPOfSize):
(WebCore::BitmapImage::drawFrameMatchingSourceSize):
* platform/graphics/win/ImageCairoWin.cpp:
(WebCore::BitmapImage::getHBITMAPOfSize):
(WebCore::BitmapImage::drawFrameMatchingSourceSize):
* platform/graphics/win/ImageDecoderDirect2D.cpp:
(WebCore::ImageDecoderDirect2D::frameOrientationAtIndex const):
* platform/graphics/win/ImageDirect2D.cpp:
(WebCore::BitmapImage::drawFrameMatchingSourceSize):
* platform/graphics/win/NativeImageDirect2D.cpp:
(WebCore::drawNativeImage):
* platform/gtk/DragImageGtk.cpp:
(WebCore::createDragImageFromImage):
* platform/image-decoders/ScalableImageDecoderFrame.h:
* platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
(WebCore::readImageOrientation):
* platform/ios/DragImageIOS.mm:
(WebCore::createDragImageFromImage):
* platform/mac/DragImageMac.mm:
(WebCore::createDragImageFromImage):
* platform/win/DragImageCGWin.cpp:
(WebCore::createDragImageFromImage):
* platform/win/DragImageCairoWin.cpp:
(WebCore::createDragImageFromImage):
* platform/win/DragImageDirect2D.cpp:
(WebCore::createDragImageFromImage):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::imageOrientation const):
(WebCore::RenderElement::shouldRespectImageOrientation const): Deleted.
* rendering/RenderElement.h:
* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::paintSnapshotImage):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::paintReplaced):
(WebCore::RenderImage::paintIntoRect):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::isDirectlyCompositedImage const):
* rendering/RenderSnapshottedPlugIn.cpp:
(WebCore::RenderSnapshottedPlugIn::paintSnapshot):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setImageOrientation):
(WebCore::RenderStyle::initialImageOrientation):
(WebCore::RenderStyle::imageOrientation const):
* rendering/style/StyleRareInheritedData.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::drawForContainer):
(WebCore::SVGImage::nativeImageForCurrentFrame):
(WebCore::SVGImage::nativeImage):
(WebCore::SVGImage::draw):
* svg/graphics/SVGImage.h:
* svg/graphics/SVGImageForContainer.cpp:
(WebCore::SVGImageForContainer::draw):
* svg/graphics/SVGImageForContainer.h:

Source/WebKit:

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::imagePositionInformation):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248657 268f45cc-cd09-0410-ab3c-d52691b4dbfc

74 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/dom/DataTransfer.cpp
Source/WebCore/html/HTMLCanvasElement.cpp
Source/WebCore/loader/cache/CachedImage.cpp
Source/WebCore/page/DragController.cpp
Source/WebCore/platform/DragImage.cpp
Source/WebCore/platform/DragImage.h
Source/WebCore/platform/graphics/BitmapImage.cpp
Source/WebCore/platform/graphics/BitmapImage.h
Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp
Source/WebCore/platform/graphics/CrossfadeGeneratedImage.h
Source/WebCore/platform/graphics/CustomPaintImage.cpp
Source/WebCore/platform/graphics/CustomPaintImage.h
Source/WebCore/platform/graphics/GeneratedImage.h
Source/WebCore/platform/graphics/GradientImage.cpp
Source/WebCore/platform/graphics/GradientImage.h
Source/WebCore/platform/graphics/GraphicsContext.cpp
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/platform/graphics/GraphicsContextImpl.cpp
Source/WebCore/platform/graphics/Image.cpp
Source/WebCore/platform/graphics/Image.h
Source/WebCore/platform/graphics/ImageFrame.h
Source/WebCore/platform/graphics/ImageOrientation.cpp [deleted file]
Source/WebCore/platform/graphics/ImageOrientation.h
Source/WebCore/platform/graphics/ImageSource.cpp
Source/WebCore/platform/graphics/NamedImageGeneratedImage.cpp
Source/WebCore/platform/graphics/NamedImageGeneratedImage.h
Source/WebCore/platform/graphics/NativeImage.h
Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm
Source/WebCore/platform/graphics/cairo/CairoOperations.cpp
Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp
Source/WebCore/platform/graphics/cg/NativeImageCG.cpp
Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp
Source/WebCore/platform/graphics/cg/PDFDocumentImage.h
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h
Source/WebCore/platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp
Source/WebCore/platform/graphics/gstreamer/VideoTextureCopierGStreamer.h
Source/WebCore/platform/graphics/win/Direct2DOperations.cpp
Source/WebCore/platform/graphics/win/ImageCGWin.cpp
Source/WebCore/platform/graphics/win/ImageCairoWin.cpp
Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.cpp
Source/WebCore/platform/graphics/win/ImageDirect2D.cpp
Source/WebCore/platform/graphics/win/NativeImageDirect2D.cpp
Source/WebCore/platform/gtk/DragImageGtk.cpp
Source/WebCore/platform/image-decoders/ScalableImageDecoderFrame.h
Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
Source/WebCore/platform/ios/DragImageIOS.mm
Source/WebCore/platform/mac/DragImageMac.mm
Source/WebCore/platform/win/DragImageCGWin.cpp
Source/WebCore/platform/win/DragImageCairoWin.cpp
Source/WebCore/platform/win/DragImageDirect2D.cpp
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderElement.h
Source/WebCore/rendering/RenderEmbeddedObject.cpp
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/StyleRareInheritedData.h
Source/WebCore/svg/graphics/SVGImage.cpp
Source/WebCore/svg/graphics/SVGImage.h
Source/WebCore/svg/graphics/SVGImageForContainer.cpp
Source/WebCore/svg/graphics/SVGImageForContainer.h
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

index b33786b..417742f 100644 (file)
@@ -1,3 +1,180 @@
+2019-08-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        shouldRespectImageOrientation should be a value in ImageOrientation
+        https://bugs.webkit.org/show_bug.cgi?id=200553
+
+        Reviewed by Simon Fraser.
+
+        This patch is a step towards implementing the css image-orientation.
+
+        Instead of having ImageOrientationEnum, ImageOrientationDescription,
+        ImageOrientation and RespectImageOrientationEnum we are going to have a
+        single structure named 'ImageOrientation' which is a wrapper for the enum
+        type "Orientation".
+
+        This structure will have a constructor and casting operator such that
+        assigning an enum value and comparing with an enum value will be done
+        implicitly.
+
+        RespectImageOrientation is represented as a new enum value 'FromImage'.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator ImageOrientation const):
+        (WebCore::CSSPrimitiveValue::operator ImageOrientationEnum const): Deleted.
+        * dom/DataTransfer.cpp:
+        (WebCore::DataTransfer::createDragImage const):
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::paint):
+        * loader/cache/CachedImage.cpp:
+        (WebCore::CachedImage::imageSizeForRenderer const):
+        * page/DragController.cpp:
+        (WebCore::DragController::doImageDrag):
+        * platform/DragImage.cpp:
+        (WebCore::createDragImageFromSnapshot):
+        (WebCore::createDragImageFromImage):
+        * platform/DragImage.h:
+        * platform/graphics/BitmapImage.cpp:
+        (WebCore::BitmapImage::draw):
+        (WebCore::BitmapImage::drawPattern):
+        * platform/graphics/BitmapImage.h:
+        * platform/graphics/CrossfadeGeneratedImage.cpp:
+        (WebCore::CrossfadeGeneratedImage::draw):
+        * platform/graphics/CrossfadeGeneratedImage.h:
+        * platform/graphics/CustomPaintImage.cpp:
+        (WebCore::CustomPaintImage::draw):
+        * platform/graphics/CustomPaintImage.h:
+        * platform/graphics/GeneratedImage.h:
+        * platform/graphics/GradientImage.cpp:
+        (WebCore::GradientImage::draw):
+        * platform/graphics/GradientImage.h:
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::drawImage):
+        (WebCore::GraphicsContext::drawTiledImage):
+        * platform/graphics/GraphicsContext.h:
+        (WebCore::ImagePaintingOptions::ImagePaintingOptions):
+        * platform/graphics/GraphicsContextImpl.cpp:
+        (WebCore::GraphicsContextImpl::drawImageImpl):
+        (WebCore::GraphicsContextImpl::drawTiledImageImpl):
+        * platform/graphics/Image.cpp:
+        (WebCore::Image::drawTiled):
+        * platform/graphics/Image.h:
+        * platform/graphics/ImageFrame.h:
+        * platform/graphics/ImageOrientation.cpp: Removed.
+        * platform/graphics/ImageOrientation.h:
+        (WebCore::ImageOrientation::ImageOrientation):
+        (WebCore::ImageOrientation::fromEXIFValue):
+        (WebCore::ImageOrientation::operator Orientation const):
+        (WebCore::ImageOrientation::usesWidthAsHeight const):
+        (WebCore::ImageOrientation::transformFromDefault const):
+        (WebCore::ImageOrientation::isValidOrientation):
+        (WebCore::ImageOrientation::isValidEXIFOrientation):
+        (WebCore::ImageOrientationDescription::ImageOrientationDescription): Deleted.
+        (WebCore::ImageOrientationDescription::setRespectImageOrientation): Deleted.
+        (WebCore::ImageOrientationDescription::respectImageOrientation): Deleted.
+        (WebCore::ImageOrientationDescription::setImageOrientationEnum): Deleted.
+        (WebCore::ImageOrientationDescription::imageOrientation): Deleted.
+        (WebCore::ImageOrientation::operator ImageOrientationEnum const): Deleted.
+        (WebCore::ImageOrientation::operator== const): Deleted.
+        (WebCore::ImageOrientation::operator!= const): Deleted.
+        * platform/graphics/ImageSource.cpp:
+        (WebCore::ImageSource::dump):
+        * platform/graphics/NamedImageGeneratedImage.cpp:
+        (WebCore::NamedImageGeneratedImage::draw):
+        * platform/graphics/NamedImageGeneratedImage.h:
+        * platform/graphics/NativeImage.h:
+        * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
+        (WebCore::ImageDecoderAVFObjC::frameOrientationAtIndex const):
+        * platform/graphics/cairo/CairoOperations.cpp:
+        (WebCore::Cairo::drawShadowLayerBuffer):
+        (WebCore::Cairo::drawShadowImage):
+        (WebCore::Cairo::drawNativeImage):
+        * platform/graphics/cairo/ImageBufferCairo.cpp:
+        (WebCore::ImageBuffer::draw):
+        * platform/graphics/cairo/NativeImageCairo.cpp:
+        (WebCore::drawNativeImage):
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::drawNativeImage):
+        * platform/graphics/cg/ImageDecoderCG.cpp:
+        (WebCore::orientationFromProperties):
+        (WebCore::ImageDecoderCG::frameOrientationAtIndex const):
+        * platform/graphics/cg/NativeImageCG.cpp:
+        (WebCore::drawNativeImage):
+        * platform/graphics/cg/PDFDocumentImage.cpp:
+        (WebCore::PDFDocumentImage::draw):
+        * platform/graphics/cg/PDFDocumentImage.h:
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::paint):
+        (WebCore::MediaPlayerPrivateGStreamerBase::setVideoSourceOrientation):
+        (WebCore::MediaPlayerPrivateGStreamerBase::updateTextureMapperFlags):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
+        * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
+        (WebCore::VideoTextureCopierGStreamer::updateTextureSpaceMatrix):
+        (WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
+        * platform/graphics/gstreamer/VideoTextureCopierGStreamer.h:
+        * platform/graphics/win/Direct2DOperations.cpp:
+        (WebCore::Direct2D::drawNativeImage):
+        * platform/graphics/win/ImageCGWin.cpp:
+        (WebCore::BitmapImage::getHBITMAPOfSize):
+        (WebCore::BitmapImage::drawFrameMatchingSourceSize):
+        * platform/graphics/win/ImageCairoWin.cpp:
+        (WebCore::BitmapImage::getHBITMAPOfSize):
+        (WebCore::BitmapImage::drawFrameMatchingSourceSize):
+        * platform/graphics/win/ImageDecoderDirect2D.cpp:
+        (WebCore::ImageDecoderDirect2D::frameOrientationAtIndex const):
+        * platform/graphics/win/ImageDirect2D.cpp:
+        (WebCore::BitmapImage::drawFrameMatchingSourceSize):
+        * platform/graphics/win/NativeImageDirect2D.cpp:
+        (WebCore::drawNativeImage):
+        * platform/gtk/DragImageGtk.cpp:
+        (WebCore::createDragImageFromImage):
+        * platform/image-decoders/ScalableImageDecoderFrame.h:
+        * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
+        (WebCore::readImageOrientation):
+        * platform/ios/DragImageIOS.mm:
+        (WebCore::createDragImageFromImage):
+        * platform/mac/DragImageMac.mm:
+        (WebCore::createDragImageFromImage):
+        * platform/win/DragImageCGWin.cpp:
+        (WebCore::createDragImageFromImage):
+        * platform/win/DragImageCairoWin.cpp:
+        (WebCore::createDragImageFromImage):
+        * platform/win/DragImageDirect2D.cpp:
+        (WebCore::createDragImageFromImage):
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::imageOrientation const):
+        (WebCore::RenderElement::shouldRespectImageOrientation const): Deleted.
+        * rendering/RenderElement.h:
+        * rendering/RenderEmbeddedObject.cpp:
+        (WebCore::RenderEmbeddedObject::paintSnapshotImage):
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::paintReplaced):
+        (WebCore::RenderImage::paintIntoRect):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::isDirectlyCompositedImage const):
+        * rendering/RenderSnapshottedPlugIn.cpp:
+        (WebCore::RenderSnapshottedPlugIn::paintSnapshot):
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::setImageOrientation):
+        (WebCore::RenderStyle::initialImageOrientation):
+        (WebCore::RenderStyle::imageOrientation const):
+        * rendering/style/StyleRareInheritedData.h:
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::drawForContainer):
+        (WebCore::SVGImage::nativeImageForCurrentFrame):
+        (WebCore::SVGImage::nativeImage):
+        (WebCore::SVGImage::draw):
+        * svg/graphics/SVGImage.h:
+        * svg/graphics/SVGImageForContainer.cpp:
+        (WebCore::SVGImageForContainer::draw):
+        * svg/graphics/SVGImageForContainer.h:
+
 2019-08-13  Robin Morisset  <rmorisset@apple.com>
 
         [WHLSL] Move Qualifiers and Semantic from VariableDeclaration to VariableDeclaration::RareData
index b3db175..ca46142 100644 (file)
@@ -1820,7 +1820,6 @@ platform/graphics/Image.cpp
 platform/graphics/ImageBuffer.cpp
 platform/graphics/ImageDecoder.cpp
 platform/graphics/ImageFrame.cpp
-platform/graphics/ImageOrientation.cpp
 platform/graphics/ImageSource.cpp
 platform/graphics/IntPoint.cpp
 platform/graphics/IntRect.cpp
index ea9d553..b7be749 100644 (file)
                A871DFE10A15376B00B12A68 /* RenderWidget.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderWidget.cpp; sourceTree = "<group>"; };
                A8748BDF12CBF2DC001FBA41 /* HashTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashTools.h; sourceTree = "<group>"; };
                A8748D6612CC3763001FBA41 /* ImageOrientation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageOrientation.h; sourceTree = "<group>"; };
-               A8748D7412CC3F89001FBA41 /* ImageOrientation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageOrientation.cpp; sourceTree = "<group>"; };
                A8805AF116C96AEA000E9D98 /* InputStreamPreprocessor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InputStreamPreprocessor.h; sourceTree = "<group>"; };
                A882DA1F1593846A000115ED /* CSSToStyleMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSToStyleMap.cpp; sourceTree = "<group>"; };
                A882DA221593848D000115ED /* CSSToStyleMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSToStyleMap.h; sourceTree = "<group>"; };
                                5576A5621D88A70800CCC04C /* ImageFrame.cpp */,
                                5576A5631D88A70800CCC04C /* ImageFrame.h */,
                                BC7F44A70B9E324E00A9D081 /* ImageObserver.h */,
-                               A8748D7412CC3F89001FBA41 /* ImageOrientation.cpp */,
                                A8748D6612CC3763001FBA41 /* ImageOrientation.h */,
                                49291E4A134172C800E753DE /* ImageRenderingMode.h */,
                                554675771FD1FC1A003B10B0 /* ImageSource.cpp */,
index 9d120ca..8f63e0a 100644 (file)
@@ -4874,49 +4874,50 @@ template<> inline CSSPrimitiveValue::operator MaskType() const
 
 #if ENABLE(CSS_IMAGE_ORIENTATION)
 
-template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ImageOrientationEnum e)
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ImageOrientation e)
     : CSSValue(PrimitiveClass)
 {
     m_primitiveUnitType = CSS_DEG;
     switch (e) {
-    case OriginTopLeft:
+    case ImageOrientation::OriginTopLeft:
         m_value.num = 0;
         break;
-    case OriginRightTop:
+    case ImageOrientation::OriginRightTop:
         m_value.num = 90;
         break;
-    case OriginBottomRight:
+    case ImageOrientation::OriginBottomRight:
         m_value.num = 180;
         break;
-    case OriginLeftBottom:
+    case ImageOrientation::OriginLeftBottom:
         m_value.num = 270;
         break;
-    case OriginTopRight:
-    case OriginLeftTop:
-    case OriginBottomLeft:
-    case OriginRightBottom:
+    case ImageOrientation::FromImage:
+    case ImageOrientation::OriginTopRight:
+    case ImageOrientation::OriginLeftTop:
+    case ImageOrientation::OriginBottomLeft:
+    case ImageOrientation::OriginRightBottom:
         ASSERT_NOT_REACHED();
     }
 }
 
-template<> inline CSSPrimitiveValue::operator ImageOrientationEnum() const
+template<> inline CSSPrimitiveValue::operator ImageOrientation() const
 {
     ASSERT(isAngle());
     double quarters = 4 * doubleValue(CSS_TURN);
     int orientation = 3 & static_cast<int>(quarters < 0 ? floor(quarters) : ceil(quarters));
     switch (orientation) {
     case 0:
-        return OriginTopLeft;
+        return ImageOrientation::OriginTopLeft;
     case 1:
-        return OriginRightTop;
+        return ImageOrientation::OriginRightTop;
     case 2:
-        return OriginBottomRight;
+        return ImageOrientation::OriginBottomRight;
     case 3:
-        return OriginLeftBottom;
+        return ImageOrientation::OriginLeftBottom;
     }
 
     ASSERT_NOT_REACHED();
-    return OriginTopLeft;
+    return ImageOrientation::None;
 }
 
 #endif // ENABLE(CSS_IMAGE_ORIENTATION)
index cb75232..e793f20 100644 (file)
@@ -544,7 +544,7 @@ DragImageRef DataTransfer::createDragImage(IntPoint& location) const
     location = m_dragLocation;
 
     if (m_dragImage)
-        return createDragImageFromImage(m_dragImage->image(), ImageOrientationDescription());
+        return createDragImageFromImage(m_dragImage->image(), ImageOrientation::None);
 
     if (m_dragImageElement) {
         if (Frame* frame = m_dragImageElement->document().frame())
index a9bb4fb..07715cb 100644 (file)
@@ -610,17 +610,10 @@ void HTMLCanvasElement::paint(GraphicsContext& context, const LayoutRect& r)
 
         if (shouldPaint) {
             if (hasCreatedImageBuffer()) {
-                ImageBuffer* imageBuffer = buffer();
-                if (imageBuffer) {
-                    if (m_presentedImage) {
-                        ImageOrientationDescription orientationDescription;
-#if ENABLE(CSS_IMAGE_ORIENTATION)
-                        orientationDescription.setImageOrientationEnum(renderer()->style().imageOrientation());
-#endif
-                        context.drawImage(*m_presentedImage, snappedIntRect(r), ImagePaintingOptions(orientationDescription));
-                    } else
-                        context.drawImageBuffer(*imageBuffer, snappedIntRect(r));
-                }
+                if (m_presentedImage)
+                    context.drawImage(*m_presentedImage, snappedIntRect(r), renderer()->imageOrientation());
+                else if (ImageBuffer* imageBuffer = buffer())
+                    context.drawImageBuffer(*imageBuffer, snappedIntRect(r));
             }
 
             if (isGPUBased())
index f312907..8368a95 100644 (file)
@@ -280,7 +280,7 @@ FloatSize CachedImage::imageSizeForRenderer(const RenderElement* renderer, SizeT
     if (!m_image)
         return { };
 
-    if (is<BitmapImage>(*m_image) && renderer && renderer->shouldRespectImageOrientation() == RespectImageOrientation)
+    if (is<BitmapImage>(*m_image) && renderer && renderer->imageOrientation() == ImageOrientation::FromImage)
         return downcast<BitmapImage>(*m_image).sizeRespectingOrientation();
 
     if (is<SVGImage>(*m_image) && sizeType == UsedSize)
index af9b8f3..d5cf3da 100644 (file)
@@ -1197,10 +1197,10 @@ void DragController::doImageDrag(Element& element, const IntPoint& dragOrigin, c
     if (!element.renderer())
         return;
 
-    ImageOrientationDescription orientationDescription(element.renderer()->shouldRespectImageOrientation(), element.renderer()->style().imageOrientation());
+    ImageOrientation orientation = element.renderer()->imageOrientation();
 
     Image* image = getImage(element);
-    if (image && !layoutRect.isEmpty() && shouldUseCachedImageForDragImage(*image) && (dragImage = DragImage { createDragImageFromImage(image, element.renderer() ? orientationDescription : ImageOrientationDescription()) })) {
+    if (image && !layoutRect.isEmpty() && shouldUseCachedImageForDragImage(*image) && (dragImage = DragImage { createDragImageFromImage(image, orientation) })) {
         dragImage = DragImage { fitDragImageToMaxSize(dragImage.get(), layoutRect.size(), maxDragImageSize()) };
         IntSize fittedSize = dragImageSize(dragImage.get());
 
index 112b789..00ac98f 100644 (file)
@@ -102,20 +102,15 @@ static DragImageRef createDragImageFromSnapshot(std::unique_ptr<ImageBuffer> sna
     if (!snapshot)
         return nullptr;
 
-    ImageOrientationDescription orientation;
-#if ENABLE(CSS_IMAGE_ORIENTATION)
+    ImageOrientation orientation;
     if (node) {
         RenderObject* renderer = node->renderer();
         if (!renderer || !is<RenderElement>(renderer))
             return nullptr;
 
-        auto& renderElement = downcast<RenderElement>(*renderer);
-        orientation.setRespectImageOrientation(renderElement.shouldRespectImageOrientation());
-        orientation.setImageOrientationEnum(renderElement.style().imageOrientation());
+        orientation = downcast<RenderElement>(*renderer).imageOrientation();
     }
-#else
-    UNUSED_PARAM(node);
-#endif
+
     RefPtr<Image> image = ImageBuffer::sinkIntoImage(WTFMove(snapshot), PreserveResolution::Yes);
     if (!image)
         return nullptr;
@@ -305,7 +300,7 @@ DragImageRef dissolveDragImageToFraction(DragImageRef, float)
     return nullptr;
 }
 
-DragImageRef createDragImageFromImage(Image*, ImageOrientationDescription)
+DragImageRef createDragImageFromImage(Image*, ImageOrientation)
 {
     notImplemented();
     return nullptr;
index a102e34..d050875 100644 (file)
@@ -84,7 +84,7 @@ DragImageRef scaleDragImage(DragImageRef, FloatSize scale);
 DragImageRef platformAdjustDragImageForDeviceScaleFactor(DragImageRef, float deviceScaleFactor);
 DragImageRef dissolveDragImageToFraction(DragImageRef, float delta);
 
-DragImageRef createDragImageFromImage(Image*, ImageOrientationDescription);
+DragImageRef createDragImageFromImage(Image*, ImageOrientation);
 DragImageRef createDragImageIconForCachedImageFilename(const String&);
 
 WEBCORE_EXPORT DragImageRef createDragImageForNode(Frame&, Node&);
index a23e219..f1c90e5 100644 (file)
@@ -183,7 +183,7 @@ bool BitmapImage::notSolidColor()
 }
 #endif
 
-ImageDrawResult BitmapImage::draw(GraphicsContext& context, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode mode, DecodingMode decodingMode, ImageOrientationDescription description)
+ImageDrawResult BitmapImage::draw(GraphicsContext& context, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode mode, DecodingMode decodingMode, ImageOrientation orientation)
 {
     if (destRect.isEmpty() || srcRect.isEmpty())
         return ImageDrawResult::DidNothing;
@@ -268,8 +268,7 @@ ImageDrawResult BitmapImage::draw(GraphicsContext& context, const FloatRect& des
         return result;
     }
 
-    ImageOrientation orientation(description.imageOrientation());
-    if (description.respectImageOrientation() == RespectImageOrientation)
+    if (orientation == ImageOrientation::FromImage)
         orientation = frameOrientationAtIndex(m_currentFrame);
 
     drawNativeImage(image, context, destRect, srcRect, IntSize(size()), op, mode, orientation);
@@ -306,7 +305,7 @@ void BitmapImage::drawPattern(GraphicsContext& ctxt, const FloatRect& destRect,
         // Temporarily reset image observer, we don't want to receive any changeInRect() calls due to this relayout.
         setImageObserver(nullptr);
 
-        draw(buffer->context(), tileRect, tileRect, op, blendMode, DecodingMode::Synchronous, ImageOrientationDescription());
+        draw(buffer->context(), tileRect, tileRect, op, blendMode, DecodingMode::Synchronous, ImageOrientation::None);
 
         setImageObserver(observer);
         buffer->convertToLuminanceMask();
index 851d5bc..5aef61d 100644 (file)
@@ -161,7 +161,7 @@ protected:
     // |destroyAll| along.
     void destroyDecodedDataIfNecessary(bool destroyAll = true);
 
-    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientationDescription) override;
+    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientation) override;
     void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendMode::Normal) override;
 #if PLATFORM(WIN)
     void drawFrameMatchingSourceSize(GraphicsContext&, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator) override;
index ec856c8..ea64b1d 100644 (file)
@@ -86,7 +86,7 @@ void CrossfadeGeneratedImage::drawCrossfade(GraphicsContext& context)
     context.endTransparencyLayer();
 }
 
-ImageDrawResult CrossfadeGeneratedImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode, DecodingMode, ImageOrientationDescription)
+ImageDrawResult CrossfadeGeneratedImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode, DecodingMode, ImageOrientation)
 {
     GraphicsContextStateSaver stateSaver(context);
     context.setCompositeOperation(compositeOp, blendMode);
index 73208aa..21e1323 100644 (file)
@@ -47,7 +47,7 @@ public:
     FloatSize size() const override { return m_crossfadeSize; }
 
 protected:
-    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientationDescription) override;
+    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientation) override;
     void drawPattern(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode) override;
 
     CrossfadeGeneratedImage(Image& fromImage, Image& toImage, float percentage, const FloatSize& crossfadeSize, const FloatSize&);
index df156f8..faa0bf0 100644 (file)
@@ -170,7 +170,7 @@ ImageDrawResult CustomPaintImage::doCustomPaint(GraphicsContext& destContext, co
     return ImageDrawResult::DidDraw;
 }
 
-ImageDrawResult CustomPaintImage::draw(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode, DecodingMode, ImageOrientationDescription)
+ImageDrawResult CustomPaintImage::draw(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode, DecodingMode, ImageOrientation)
 {
     GraphicsContextStateSaver stateSaver(destContext);
     destContext.setCompositeOperation(compositeOp, blendMode);
index 9db60cb..4e8e589 100644 (file)
@@ -52,7 +52,7 @@ private:
 
     ImageDrawResult doCustomPaint(GraphicsContext&, const FloatSize&);
 
-    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientationDescription) final;
+    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientation) final;
     void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode) final;
 
     WeakPtr<PaintWorkletGlobalScope::PaintDefinition> m_paintDefinition;
index de95d80..3a859c3 100644 (file)
@@ -46,7 +46,7 @@ public:
     void destroyDecodedData(bool /*destroyAll*/ = true) override { }
 
 protected:
-    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientationDescription) override = 0;
+    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientation) override = 0;
     void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform,
         const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode) override = 0;
 
index 8d388c6..5d4ee28 100644 (file)
@@ -39,7 +39,7 @@ GradientImage::GradientImage(Gradient& generator, const FloatSize& size)
 
 GradientImage::~GradientImage() = default;
 
-ImageDrawResult GradientImage::draw(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode, DecodingMode, ImageOrientationDescription)
+ImageDrawResult GradientImage::draw(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode, DecodingMode, ImageOrientation)
 {
     GraphicsContextStateSaver stateSaver(destContext);
     destContext.setCompositeOperation(compositeOp, blendMode);
index d74d578..1d9dd90 100644 (file)
@@ -46,7 +46,7 @@ public:
 private:
     GradientImage(Gradient&, const FloatSize&);
 
-    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientationDescription) final;
+    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientation) final;
     void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode) final;
     bool isGradientImage() const final { return true; }
     void dump(WTF::TextStream&) const final;
index 7d1db7d..7af9eae 100644 (file)
@@ -733,7 +733,7 @@ ImageDrawResult GraphicsContext::drawImage(Image& image, const FloatRect& destin
         return m_impl->drawImage(image, destination, source, imagePaintingOptions);
 
     InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality);
-    return image.draw(*this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_decodingMode, imagePaintingOptions.m_orientationDescription);
+    return image.draw(*this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_decodingMode, imagePaintingOptions.m_orientation);
 }
 
 ImageDrawResult GraphicsContext::drawTiledImage(Image& image, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& imagePaintingOptions)
@@ -745,7 +745,7 @@ ImageDrawResult GraphicsContext::drawTiledImage(Image& image, const FloatRect& d
         return m_impl->drawTiledImage(image, destination, source, tileSize, spacing, imagePaintingOptions);
 
     InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality);
-    return image.drawTiled(*this, destination, source, tileSize, spacing, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_decodingMode);
+    return image.drawTiled(*this, destination, source, tileSize, spacing, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_decodingMode, imagePaintingOptions.m_orientation);
 }
 
 ImageDrawResult GraphicsContext::drawTiledImage(Image& image, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor,
index ddc7cac..408cfb7 100644 (file)
@@ -211,29 +211,29 @@ struct GraphicsContextState {
 };
 
 struct ImagePaintingOptions {
-    ImagePaintingOptions(CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendMode::Normal, DecodingMode decodingMode = DecodingMode::Synchronous, ImageOrientationDescription orientationDescription = ImageOrientationDescription(), InterpolationQuality interpolationQuality = InterpolationDefault)
+    ImagePaintingOptions(CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendMode::Normal, DecodingMode decodingMode = DecodingMode::Synchronous, ImageOrientation orientation = ImageOrientation::None, InterpolationQuality interpolationQuality = InterpolationDefault)
         : m_compositeOperator(compositeOperator)
         , m_blendMode(blendMode)
         , m_decodingMode(decodingMode)
-        , m_orientationDescription(orientationDescription)
+        , m_orientation(orientation)
         , m_interpolationQuality(interpolationQuality)
     {
     }
 
-    ImagePaintingOptions(ImageOrientationDescription orientationDescription, InterpolationQuality interpolationQuality = InterpolationDefault, CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendMode::Normal, DecodingMode decodingMode = DecodingMode::Synchronous)
+    ImagePaintingOptions(ImageOrientation orientation, InterpolationQuality interpolationQuality = InterpolationDefault, CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendMode::Normal, DecodingMode decodingMode = DecodingMode::Synchronous)
         : m_compositeOperator(compositeOperator)
         , m_blendMode(blendMode)
         , m_decodingMode(decodingMode)
-        , m_orientationDescription(orientationDescription)
+        , m_orientation(orientation)
         , m_interpolationQuality(interpolationQuality)
     {
     }
 
-    ImagePaintingOptions(InterpolationQuality interpolationQuality, ImageOrientationDescription orientationDescription = ImageOrientationDescription(), CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendMode::Normal, DecodingMode decodingMode = DecodingMode::Synchronous)
+    ImagePaintingOptions(InterpolationQuality interpolationQuality, ImageOrientation orientation = ImageOrientation::None, CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendMode::Normal, DecodingMode decodingMode = DecodingMode::Synchronous)
         : m_compositeOperator(compositeOperator)
         , m_blendMode(blendMode)
         , m_decodingMode(decodingMode)
-        , m_orientationDescription(orientationDescription)
+        , m_orientation(orientation)
         , m_interpolationQuality(interpolationQuality)
     {
     }
@@ -243,7 +243,7 @@ struct ImagePaintingOptions {
     CompositeOperator m_compositeOperator;
     BlendMode m_blendMode;
     DecodingMode m_decodingMode;
-    ImageOrientationDescription m_orientationDescription;
+    ImageOrientation m_orientation;
     InterpolationQuality m_interpolationQuality;
 };
 
@@ -347,7 +347,7 @@ public:
     const GraphicsContextState& state() const { return m_state; }
 
 #if USE(CG) || USE(DIRECT2D) || USE(CAIRO)
-    WEBCORE_EXPORT void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator = CompositeSourceOver, BlendMode = BlendMode::Normal, ImageOrientation = ImageOrientation());
+    WEBCORE_EXPORT void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator = CompositeSourceOver, BlendMode = BlendMode::Normal, ImageOrientation = ImageOrientation::None);
 #endif
 
 #if USE(CG) || USE(DIRECT2D)
index 86ad417..963649f 100644 (file)
@@ -40,13 +40,13 @@ GraphicsContextImpl::~GraphicsContextImpl()
 ImageDrawResult GraphicsContextImpl::drawImageImpl(GraphicsContext& context, Image& image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& imagePaintingOptions)
 {
     InterpolationQualityMaintainer interpolationQualityForThisScope(context, imagePaintingOptions.m_interpolationQuality);
-    return image.draw(context, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_decodingMode, imagePaintingOptions.m_orientationDescription);
+    return image.draw(context, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_decodingMode, imagePaintingOptions.m_orientation);
 }
 
 ImageDrawResult GraphicsContextImpl::drawTiledImageImpl(GraphicsContext& context, Image& image, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& imagePaintingOptions)
 {
     InterpolationQualityMaintainer interpolationQualityForThisScope(context, imagePaintingOptions.m_interpolationQuality);
-    return image.drawTiled(context, destination, source, tileSize, spacing, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_decodingMode);
+    return image.drawTiled(context, destination, source, tileSize, spacing, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_decodingMode, imagePaintingOptions.m_orientation);
 }
 
 ImageDrawResult GraphicsContextImpl::drawTiledImageImpl(GraphicsContext& context, Image& image, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions& imagePaintingOptions)
index e44a61e..8ecf33f 100644 (file)
@@ -149,7 +149,7 @@ void Image::drawPattern(GraphicsContext& ctxt, const FloatRect& destRect, const
         imageObserver()->didDraw(*this);
 }
 
-ImageDrawResult Image::drawTiled(GraphicsContext& ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& scaledTileSize, const FloatSize& spacing, CompositeOperator op, BlendMode blendMode, DecodingMode decodingMode)
+ImageDrawResult Image::drawTiled(GraphicsContext& ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& scaledTileSize, const FloatSize& spacing, CompositeOperator op, BlendMode blendMode, DecodingMode decodingMode, ImageOrientation orientation)
 {
     Color color = singlePixelSolidColor();
     if (color.isValid()) {
@@ -184,7 +184,7 @@ ImageDrawResult Image::drawTiled(GraphicsContext& ctxt, const FloatRect& destRec
         visibleSrcRect.setY((destRect.y() - oneTileRect.y()) / scale.height());
         visibleSrcRect.setWidth(destRect.width() / scale.width());
         visibleSrcRect.setHeight(destRect.height() / scale.height());
-        return draw(ctxt, destRect, visibleSrcRect, op, blendMode, decodingMode, ImageOrientationDescription());
+        return draw(ctxt, destRect, visibleSrcRect, op, blendMode, decodingMode, orientation);
     }
 
 #if PLATFORM(IOS_FAMILY)
@@ -196,7 +196,7 @@ ImageDrawResult Image::drawTiled(GraphicsContext& ctxt, const FloatRect& destRec
             visibleSrcRect.setY((destRect.y() - oneTileRect.y()) / scale.height());
             visibleSrcRect.setWidth(1);
             visibleSrcRect.setHeight(destRect.height() / scale.height());
-            return draw(ctxt, destRect, visibleSrcRect, op, BlendMode::Normal, decodingMode, ImageOrientationDescription());
+            return draw(ctxt, destRect, visibleSrcRect, op, BlendMode::Normal, decodingMode, orientation);
         }
         if (size().height() == 1 && intersection(oneTileRect, destRect).width() == destRect.width()) {
             FloatRect visibleSrcRect;
@@ -204,7 +204,7 @@ ImageDrawResult Image::drawTiled(GraphicsContext& ctxt, const FloatRect& destRec
             visibleSrcRect.setY(0);
             visibleSrcRect.setWidth(destRect.width() / scale.width());
             visibleSrcRect.setHeight(1);
-            return draw(ctxt, destRect, visibleSrcRect, op, BlendMode::Normal, decodingMode, ImageOrientationDescription());
+            return draw(ctxt, destRect, visibleSrcRect, op, BlendMode::Normal, decodingMode, orientation);
         }
     }
 #endif
@@ -236,7 +236,7 @@ ImageDrawResult Image::drawTiled(GraphicsContext& ctxt, const FloatRect& destRec
                 FloatRect fromRect(toFloatPoint(currentTileRect.location() - oneTileRect.location()), currentTileRect.size());
                 fromRect.scale(1 / scale.width(), 1 / scale.height());
 
-                result = draw(ctxt, toRect, fromRect, op, BlendMode::Normal, decodingMode, ImageOrientationDescription());
+                result = draw(ctxt, toRect, fromRect, op, BlendMode::Normal, decodingMode, orientation);
                 if (result == ImageDrawResult::DidRequestDecoding)
                     return result;
                 toX += currentTileRect.width();
index ce505b9..36997c8 100644 (file)
@@ -190,8 +190,8 @@ protected:
 #if PLATFORM(WIN)
     virtual void drawFrameMatchingSourceSize(GraphicsContext&, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator) { }
 #endif
-    virtual ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientationDescription) = 0;
-    ImageDrawResult drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize, const FloatSize& spacing, CompositeOperator, BlendMode, DecodingMode);
+    virtual ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientation) = 0;
+    ImageDrawResult drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize, const FloatSize& spacing, CompositeOperator, BlendMode, DecodingMode, ImageOrientation);
     ImageDrawResult drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, CompositeOperator);
 
     // Supporting tiled drawing
index 70355b8..2dfefae 100644 (file)
@@ -91,7 +91,7 @@ private:
     SubsamplingLevel m_subsamplingLevel { SubsamplingLevel::Default };
     DecodingOptions m_decodingOptions;
 
-    ImageOrientation m_orientation { DefaultImageOrientation };
+    ImageOrientation m_orientation { ImageOrientation::None };
     Seconds m_duration;
     bool m_hasAlpha { true };
 };
diff --git a/Source/WebCore/platform/graphics/ImageOrientation.cpp b/Source/WebCore/platform/graphics/ImageOrientation.cpp
deleted file mode 100644 (file)
index ab9424c..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ImageOrientation.h"
-
-#include "AffineTransform.h"
-#include "FloatSize.h"
-
-namespace WebCore {
-
-AffineTransform ImageOrientation::transformFromDefault(const FloatSize& drawnSize) const
-{
-    float w = drawnSize.width();
-    float h = drawnSize.height();
-
-    switch (m_orientation) {
-    case OriginTopLeft:
-        return AffineTransform();
-    case OriginTopRight:
-        return AffineTransform(-1,  0,  0,  1,  w, 0);
-    case OriginBottomRight:
-        return AffineTransform(-1,  0,  0, -1,  w, h);
-    case OriginBottomLeft:
-        return AffineTransform( 1,  0,  0, -1,  0, h);
-    case OriginLeftTop:
-        return AffineTransform( 0,  1,  1,  0,  0, 0);
-    case OriginRightTop:
-        return AffineTransform( 0,  1, -1,  0,  w, 0);
-    case OriginRightBottom:
-        return AffineTransform( 0, -1, -1,  0,  w, h);
-    case OriginLeftBottom:
-        return AffineTransform( 0, -1,  1,  0,  0, h);
-    }
-
-    ASSERT_NOT_REACHED();
-    return AffineTransform();
-}
-
-} // namespace WebCore
index 2b39106..559e5b3 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2012-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef ImageOrientation_h
-#define ImageOrientation_h
+#pragma once
+
+#include "AffineTransform.h"
+#include "FloatSize.h"
 
 namespace WebCore {
 
-class AffineTransform;
-class FloatSize;
-
-// This enum intentionally matches the orientation values from the EXIF spec.
-// See JEITA CP-3451, page 18. http://www.exif.org/Exif2-2.PDF
-enum ImageOrientationEnum {
-    // "TopLeft" means that the 0 row starts at the Top, the 0 column starts at the Left.
-    OriginTopLeft = 1, // default
-    OriginTopRight = 2, // mirror along y-axis
-    OriginBottomRight = 3, // 180 degree rotation
-    OriginBottomLeft = 4, // mirror along the x-axis
-    OriginLeftTop = 5, // mirror along x-axis + 270 degree CW rotation
-    OriginRightTop = 6, // 90 degree CW rotation
-    OriginRightBottom = 7, // mirror along x-axis + 90 degree CW rotation
-    OriginLeftBottom = 8, // 270 degree CW rotation
-    // All other values are "reserved" as of EXIF 2.2
-    DefaultImageOrientation = OriginTopLeft,
-};
+struct ImageOrientation {
+    enum Orientation {
+        FromImage         = 0, // Orientation from the image should be respected.
 
-enum RespectImageOrientationEnum {
-    DoNotRespectImageOrientation = 0,
-    RespectImageOrientation = 1
-};
+        // This range intentionally matches the orientation values from the EXIF spec.
+        // See JEITA CP-3451, page 18. http://www.exif.org/Exif2-2.PDF
+        OriginTopLeft     = 1, // default
+        OriginTopRight    = 2, // mirror along y-axis
+        OriginBottomRight = 3, // 180 degree rotation
+        OriginBottomLeft  = 4, // mirror along the x-axis
+        OriginLeftTop     = 5, // mirror along x-axis + 270 degree CW rotation
+        OriginRightTop    = 6, // 90 degree CW rotation
+        OriginRightBottom = 7, // mirror along x-axis + 90 degree CW rotation
+        OriginLeftBottom  = 8, // 270 degree CW rotation
 
-struct ImageOrientationDescription {
-    ImageOrientationDescription(RespectImageOrientationEnum shouldRespectImageOrientation,
-        ImageOrientationEnum orientation)
-        : m_respectOrientation(shouldRespectImageOrientation)
-        , m_orientation(orientation)
-    {
-    }
+        None              = OriginTopLeft
+    };
+
+    ImageOrientation() = default;
 
-    ImageOrientationDescription()
-        : m_respectOrientation(DoNotRespectImageOrientation)
-        , m_orientation(DefaultImageOrientation)
+    ImageOrientation(Orientation orientation)
+        : m_orientation(orientation)
     {
     }
 
-    ImageOrientationDescription(RespectImageOrientationEnum shouldRespectImageOrientation)
-        : m_respectOrientation(shouldRespectImageOrientation)
-        , m_orientation(DefaultImageOrientation)
+    static Orientation fromEXIFValue(int exifValue)
     {
+        return isValidEXIFOrientation(exifValue) ? static_cast<Orientation>(exifValue) : None;
     }
 
-    void setRespectImageOrientation(RespectImageOrientationEnum shouldRespectImageOrientation) { m_respectOrientation = shouldRespectImageOrientation; }
-    RespectImageOrientationEnum respectImageOrientation() { return m_respectOrientation; }
-
-    void setImageOrientationEnum(ImageOrientationEnum orientation) { m_orientation = orientation; }
-    ImageOrientationEnum imageOrientation() { return m_orientation; }
+    operator Orientation() const { return m_orientation; }
 
-    RespectImageOrientationEnum m_respectOrientation;
-    ImageOrientationEnum m_orientation;
-};
-
-class ImageOrientation {
-public:
-    ImageOrientation()
-        : m_orientation(DefaultImageOrientation)
+    bool usesWidthAsHeight() const
     {
+        ASSERT(isValidEXIFOrientation(m_orientation));
+        // Values 5 through 8 all flip the width/height.
+        return m_orientation >= OriginLeftTop && m_orientation <= OriginLeftBottom;
     }
 
-    explicit ImageOrientation(ImageOrientationEnum orientation)
-        : m_orientation(orientation)
+    AffineTransform transformFromDefault(const FloatSize& drawnSize) const
     {
+        float w = drawnSize.width();
+        float h = drawnSize.height();
+
+        switch (m_orientation) {
+        case FromImage:
+            ASSERT_NOT_REACHED();
+            return AffineTransform();
+        case OriginTopLeft:
+            return AffineTransform();
+        case OriginTopRight:
+            return AffineTransform(-1,  0,  0,  1,  w, 0);
+        case OriginBottomRight:
+            return AffineTransform(-1,  0,  0, -1,  w, h);
+        case OriginBottomLeft:
+            return AffineTransform( 1,  0,  0, -1,  0, h);
+        case OriginLeftTop:
+            return AffineTransform( 0,  1,  1,  0,  0, 0);
+        case OriginRightTop:
+            return AffineTransform( 0,  1, -1,  0,  w, 0);
+        case OriginRightBottom:
+            return AffineTransform( 0, -1, -1,  0,  w, h);
+        case OriginLeftBottom:
+            return AffineTransform( 0, -1,  1,  0,  0, h);
+        }
+
+        ASSERT_NOT_REACHED();
+        return AffineTransform();
     }
 
-    bool usesWidthAsHeight() const
+private:
+    static const Orientation EXIFFirst = OriginTopLeft;
+    static const Orientation EXIFLast = OriginLeftBottom;
+    static const Orientation First = FromImage;
+    static const Orientation Last = EXIFLast;
+
+    static bool isValidOrientation(int orientation)
     {
-        // Values 5 through 8 all flip the width/height.
-        return m_orientation >= OriginLeftTop;
+        return orientation >= static_cast<int>(First) && orientation <= static_cast<int>(Last);
     }
 
-    // ImageOrientationEnum currently matches EXIF values, however code outside
-    // this function should never assume that.
-    static ImageOrientation fromEXIFValue(int exifValue)
+    static bool isValidEXIFOrientation(int orientation)
     {
-        // Values direct from images may be invalid, in which case we use the default.
-        if (exifValue < OriginTopLeft || exifValue > OriginLeftBottom)
-            return ImageOrientation();
-        return ImageOrientation(static_cast<ImageOrientationEnum>(exifValue));
+        return orientation >= static_cast<int>(EXIFFirst) && orientation <= static_cast<int>(EXIFLast);
     }
 
-    // This transform can be used for drawing an image according to the orientation.
-    // It should be used in a right-handed coordinate system.
-    AffineTransform transformFromDefault(const FloatSize& drawnSize) const;
-
-    inline operator ImageOrientationEnum() const { return m_orientation; }
-    
-    inline bool operator==(const ImageOrientation& other) const { return other.m_orientation == m_orientation; }
-    inline bool operator!=(const ImageOrientation& other) const { return !(*this == other); }
-
-private:
-    // FIXME: This only needs to be one byte.
-    ImageOrientationEnum m_orientation;
+    Orientation m_orientation { None };
 };
 
 } // namespace WebCore
-
-#endif // ImageOrientation_h
index 213066d..752c474 100644 (file)
@@ -689,7 +689,7 @@ void ImageSource::dump(TextStream& ts)
     ts.dumpProperty("solid-color", singlePixelSolidColor());
 
     ImageOrientation orientation = frameOrientationAtIndex(0);
-    if (orientation != OriginTopLeft)
+    if (orientation != ImageOrientation::None)
         ts.dumpProperty("orientation", orientation);
 }
 
index 806fd6c..9a6b018 100644 (file)
@@ -40,7 +40,7 @@ NamedImageGeneratedImage::NamedImageGeneratedImage(String name, const FloatSize&
     setContainerSize(size);
 }
 
-ImageDrawResult NamedImageGeneratedImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode, DecodingMode, ImageOrientationDescription)
+ImageDrawResult NamedImageGeneratedImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode, DecodingMode, ImageOrientation)
 {
 #if USE(NEW_THEME) || PLATFORM(IOS_FAMILY)
     GraphicsContextStateSaver stateSaver(context);
index 1ac825f..3e7c96d 100644 (file)
@@ -39,7 +39,7 @@ public:
     }
 
 protected:
-    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientationDescription) override;
+    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientation) override;
     void drawPattern(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode) override;
 
     NamedImageGeneratedImage(String name, const FloatSize&);
index 525bf0d..d0ff67e 100644 (file)
@@ -66,7 +66,7 @@ IntSize nativeImageSize(const NativeImagePtr&);
 bool nativeImageHasAlpha(const NativeImagePtr&);
 Color nativeImageSinglePixelSolidColor(const NativeImagePtr&);
 
-void drawNativeImage(const NativeImagePtr&, GraphicsContext&, const FloatRect&, const FloatRect&, const IntSize&, CompositeOperator, BlendMode, const ImageOrientation&);
+void drawNativeImage(const NativeImagePtr&, GraphicsContext&, const FloatRect&, const FloatRect&, const IntSize&, CompositeOperator, BlendMode, ImageOrientation);
 void clearNativeImageSubimages(const NativeImagePtr&);
     
 }
index 2fe2524..54820d2 100644 (file)
@@ -531,7 +531,7 @@ bool ImageDecoderAVFObjC::frameIsCompleteAtIndex(size_t index) const
 
 ImageOrientation ImageDecoderAVFObjC::frameOrientationAtIndex(size_t) const
 {
-    return ImageOrientation();
+    return ImageOrientation::None;
 }
 
 Seconds ImageDecoderAVFObjC::frameDurationAtIndex(size_t index) const
index 68e46c8..74640f7 100644 (file)
@@ -179,7 +179,7 @@ static void drawShadowLayerBuffer(PlatformContextCairo& platformContext, ImageBu
         return;
 
     if (auto surface = image->nativeImageForCurrentFrame()) {
-        drawNativeImage(platformContext, surface.get(), FloatRect(roundedIntPoint(layerOrigin), layerSize), FloatRect(FloatPoint(), layerSize), shadowState.globalCompositeOperator, BlendMode::Normal, ImageOrientation(),
+        drawNativeImage(platformContext, surface.get(), FloatRect(roundedIntPoint(layerOrigin), layerSize), FloatRect(FloatPoint(), layerSize), shadowState.globalCompositeOperator, BlendMode::Normal, ImageOrientation::None,
             InterpolationDefault, shadowState.globalAlpha, ShadowState());
     }
 }
@@ -192,7 +192,7 @@ static void drawShadowImage(PlatformContextCairo& platformContext, ImageBuffer&
         return;
 
     if (auto surface = image->nativeImageForCurrentFrame()) {
-        drawNativeImage(platformContext, surface.get(), destRect, srcRect, shadowState.globalCompositeOperator, BlendMode::Normal, ImageOrientation(),
+        drawNativeImage(platformContext, surface.get(), destRect, srcRect, shadowState.globalCompositeOperator, BlendMode::Normal, ImageOrientation::None,
             InterpolationDefault, shadowState.globalAlpha, ShadowState());
     }
 }
@@ -889,7 +889,7 @@ void drawNativeImage(PlatformContextCairo& platformContext, cairo_surface_t* sur
         Cairo::State::setCompositeOperation(platformContext, compositeOperator, blendMode);
 
     FloatRect dst = destRect;
-    if (orientation != DefaultImageOrientation) {
+    if (orientation != ImageOrientation::None) {
         // ImageOrientation expects the origin to be at (0, 0).
         Cairo::translate(platformContext, dst.x(), dst.y());
         dst.setLocation(FloatPoint());
index 188e7bc..137415f 100644 (file)
@@ -354,7 +354,7 @@ void ImageBuffer::draw(GraphicsContext& destinationContext, const FloatRect& des
 {
     BackingStoreCopy copyMode = &destinationContext == &context() ? CopyBackingStore : DontCopyBackingStore;
     RefPtr<Image> image = copyImage(copyMode);
-    destinationContext.drawImage(*image, destRect, srcRect, ImagePaintingOptions(op, blendMode, DecodingMode::Synchronous, ImageOrientationDescription()));
+    destinationContext.drawImage(*image, destRect, srcRect, ImagePaintingOptions(op, blendMode, DecodingMode::Synchronous, ImageOrientation::None));
 }
 
 void ImageBuffer::drawPattern(GraphicsContext& context, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform,
index ed04fff..823ff0c 100644 (file)
@@ -57,7 +57,7 @@ Color nativeImageSinglePixelSolidColor(const NativeImagePtr& image)
     return colorFromPremultipliedARGB(*pixel);
 }
 
-void drawNativeImage(const NativeImagePtr& image, GraphicsContext& context, const FloatRect& destRect, const FloatRect& srcRect, const IntSize& imageSize, CompositeOperator compositeOperator, BlendMode blendMode, const ImageOrientation& orientation)
+void drawNativeImage(const NativeImagePtr& image, GraphicsContext& context, const FloatRect& destRect, const FloatRect& srcRect, const IntSize& imageSize, CompositeOperator compositeOperator, BlendMode blendMode, ImageOrientation orientation)
 {
     context.drawNativeImage(image, imageSize, destRect, srcRect, compositeOperator, blendMode, orientation);
 }
index 8adf801..e3fb384 100644 (file)
@@ -364,7 +364,7 @@ void GraphicsContext::drawNativeImage(const RetainPtr<CGImageRef>& image, const
     CGContextTranslateCTM(context, adjustedDestRect.x(), adjustedDestRect.y());
     adjustedDestRect.setLocation(FloatPoint());
 
-    if (orientation != DefaultImageOrientation) {
+    if (orientation != ImageOrientation::None) {
         CGContextConcatCTM(context, orientation.transformFromDefault(adjustedDestRect.size()));
         if (orientation.usesWidthAsHeight()) {
             // The destination rect will have it's width and height already reversed for the orientation of
index af74ef2..c2abd19 100644 (file)
@@ -156,7 +156,7 @@ static ImageOrientation orientationFromProperties(CFDictionaryRef imagePropertie
     ASSERT(imageProperties);
     CFNumberRef orientationProperty = (CFNumberRef)CFDictionaryGetValue(imageProperties, kCGImagePropertyOrientation);
     if (!orientationProperty)
-        return ImageOrientation();
+        return ImageOrientation::None;
     
     int exifValue;
     CFNumberGetValue(orientationProperty, kCFNumberIntType, &exifValue);
@@ -350,7 +350,7 @@ ImageOrientation ImageDecoderCG::frameOrientationAtIndex(size_t index) const
 {
     RetainPtr<CFDictionaryRef> properties = adoptCF(CGImageSourceCopyPropertiesAtIndex(m_nativeDecoder.get(), index, imageSourceOptions().get()));
     if (!properties)
-        return ImageOrientation();
+        return ImageOrientation::None;
     
     return orientationFromProperties(properties.get());
 }
index 987536b..f02d5d5 100644 (file)
@@ -69,7 +69,7 @@ Color nativeImageSinglePixelSolidColor(const NativeImagePtr& image)
     return Color(pixel[0] * 255 / pixel[3], pixel[1] * 255 / pixel[3], pixel[2] * 255 / pixel[3], pixel[3]);
 }
 
-void drawNativeImage(const NativeImagePtr& image, GraphicsContext& context, const FloatRect& destRect, const FloatRect& srcRect, const IntSize& srcSize, CompositeOperator op, BlendMode mode, const ImageOrientation& orientation)
+void drawNativeImage(const NativeImagePtr& image, GraphicsContext& context, const FloatRect& destRect, const FloatRect& srcRect, const IntSize& srcSize, CompositeOperator op, BlendMode mode, ImageOrientation orientation)
 {
     // Subsampling may have given us an image that is smaller than size().
     IntSize subsampledImageSize = nativeImageSize(image);
index 7893c8e..3d43cfb 100644 (file)
@@ -257,7 +257,7 @@ void PDFDocumentImage::updateCachedImageIfNeeded(GraphicsContext& context, const
     decodedSizeChanged(internalSize.unclampedArea() * 4);
 }
 
-ImageDrawResult PDFDocumentImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator op, BlendMode, DecodingMode, ImageOrientationDescription)
+ImageDrawResult PDFDocumentImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator op, BlendMode, DecodingMode, ImageOrientation)
 {
     if (!m_document || !m_hasPage)
         return ImageDrawResult::DidNothing;
index 90d7069..9bf167c 100644 (file)
@@ -78,7 +78,7 @@ private:
     void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) override;
     FloatSize size() const override;
 
-    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientationDescription) override;
+    ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientation) override;
 
     // FIXME: Implement this to be less conservative.
     bool currentFrameKnownToBeOpaque() const override { return false; }
index f4a4ba1..4a9fdec 100644 (file)
@@ -1411,11 +1411,11 @@ void MediaPlayerPrivateGStreamer::handleMessage(GstMessage* message)
         gst_message_parse_tag(message, &tags);
         if (gst_tag_list_get_string(tags, GST_TAG_IMAGE_ORIENTATION, &tag.outPtr())) {
             if (!g_strcmp0(tag.get(), "rotate-90"))
-                setVideoSourceOrientation(ImageOrientation(OriginRightTop));
+                setVideoSourceOrientation(ImageOrientation::OriginRightTop);
             else if (!g_strcmp0(tag.get(), "rotate-180"))
-                setVideoSourceOrientation(ImageOrientation(OriginBottomRight));
+                setVideoSourceOrientation(ImageOrientation::OriginBottomRight);
             else if (!g_strcmp0(tag.get(), "rotate-270"))
-                setVideoSourceOrientation(ImageOrientation(OriginLeftBottom));
+                setVideoSourceOrientation(ImageOrientation::OriginLeftBottom);
         }
         gst_tag_list_unref(tags);
         break;
index 0728eeb..c578eee 100644 (file)
@@ -887,7 +887,7 @@ void MediaPlayerPrivateGStreamerBase::paint(GraphicsContext& context, const Floa
 
     ImagePaintingOptions paintingOptions(CompositeCopy);
     if (m_renderingCanBeAccelerated)
-        paintingOptions.m_orientationDescription.setImageOrientationEnum(m_videoSourceOrientation);
+        paintingOptions.m_orientation = m_videoSourceOrientation;
 
     auto gstImage = ImageGStreamer::createImage(m_sample.get());
     if (!gstImage)
@@ -965,7 +965,7 @@ NativeImagePtr MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime()
 }
 #endif // USE(GSTREAMER_GL)
 
-void MediaPlayerPrivateGStreamerBase::setVideoSourceOrientation(const ImageOrientation& orientation)
+void MediaPlayerPrivateGStreamerBase::setVideoSourceOrientation(ImageOrientation orientation)
 {
     if (m_videoSourceOrientation == orientation)
         return;
@@ -980,16 +980,16 @@ void MediaPlayerPrivateGStreamerBase::setVideoSourceOrientation(const ImageOrien
 void MediaPlayerPrivateGStreamerBase::updateTextureMapperFlags()
 {
     switch (m_videoSourceOrientation) {
-    case DefaultImageOrientation:
+    case ImageOrientation::OriginTopLeft:
         m_textureMapperFlags = 0;
         break;
-    case OriginRightTop:
+    case ImageOrientation::OriginRightTop:
         m_textureMapperFlags = TextureMapperGL::ShouldRotateTexture90;
         break;
-    case OriginBottomRight:
+    case ImageOrientation::OriginBottomRight:
         m_textureMapperFlags = TextureMapperGL::ShouldRotateTexture180;
         break;
-    case OriginLeftBottom:
+    case ImageOrientation::OriginLeftBottom:
         m_textureMapperFlags = TextureMapperGL::ShouldRotateTexture270;
         break;
     default:
index 8079a5f..7ae7ece 100644 (file)
@@ -185,7 +185,7 @@ public:
     NativeImagePtr nativeImageForCurrentTime() override;
 #endif
 
-    void setVideoSourceOrientation(const ImageOrientation&);
+    void setVideoSourceOrientation(ImageOrientation);
     GstElement* pipeline() const { return m_pipeline.get(); }
 
     virtual bool handleSyncMessage(GstMessage*);
index f519b03..ff33818 100644 (file)
@@ -97,17 +97,17 @@ void VideoTextureCopierGStreamer::updateTextureSpaceMatrix()
     m_textureSpaceMatrix.makeIdentity();
 
     switch (m_orientation) {
-    case DefaultImageOrientation:
+    case ImageOrientation::OriginTopLeft:
         break;
-    case OriginRightTop:
+    case ImageOrientation::OriginRightTop:
         m_textureSpaceMatrix.rotate(-90);
         m_textureSpaceMatrix.translate(-1, 0);
         break;
-    case OriginBottomRight:
+    case ImageOrientation::OriginBottomRight:
         m_textureSpaceMatrix.rotate(180);
         m_textureSpaceMatrix.translate(-1, -1);
         break;
-    case OriginLeftBottom:
+    case ImageOrientation::OriginLeftBottom:
         m_textureSpaceMatrix.rotate(-270);
         m_textureSpaceMatrix.translate(0, -1);
         break;
@@ -137,7 +137,7 @@ void VideoTextureCopierGStreamer::updateTransformationMatrix()
         -1, 1, -(farValue + nearValue) / (farValue - nearValue), 1);
 }
 
-bool VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture(GLuint inputTexture, IntSize& frameSize, GLuint outputTexture, GLenum outputTarget, GLint level, GLenum internalFormat, GLenum format, GLenum type, bool flipY, ImageOrientation& sourceOrientation)
+bool VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture(GLuint inputTexture, IntSize& frameSize, GLuint outputTexture, GLenum outputTarget, GLint level, GLenum internalFormat, GLenum format, GLenum type, bool flipY, ImageOrientation sourceOrientation)
 {
     if (!m_shaderProgram || !m_framebuffer || !m_vbo || frameSize.isEmpty())
         return false;
index 20fb663..51fd9b2 100644 (file)
@@ -43,7 +43,7 @@ public:
     VideoTextureCopierGStreamer(ColorConversion);
     ~VideoTextureCopierGStreamer();
 
-    bool copyVideoTextureToPlatformTexture(GLuint inputTexture, IntSize& frameSize, GLuint outputTexture, GLenum outputTarget, GLint level, GLenum internalFormat, GLenum format, GLenum type, bool flipY, ImageOrientation& sourceOrientation);
+    bool copyVideoTextureToPlatformTexture(GLuint inputTexture, IntSize& frameSize, GLuint outputTexture, GLenum outputTarget, GLint level, GLenum internalFormat, GLenum format, GLenum type, bool flipY, ImageOrientation sourceOrientation);
     void updateColorConversionMatrix(ColorConversion);
     void updateTextureSpaceMatrix();
     void updateTransformationMatrix();
index 1885301..c83b450 100644 (file)
@@ -813,7 +813,7 @@ void drawNativeImage(PlatformContextDirect2D& platformContext, ID2D1Bitmap* imag
     context->SetTransform(transform);
     adjustedDestRect.setLocation(FloatPoint());
 
-    if (orientation != DefaultImageOrientation) {
+    if (orientation != ImageOrientation::None) {
         concatCTM(platformContext, orientation.transformFromDefault(adjustedDestRect.size()));
         if (orientation.usesWidthAsHeight()) {
             // The destination rect will have it's width and height already reversed for the orientation of
index c6ff663..14119eb 100644 (file)
@@ -79,7 +79,7 @@ bool BitmapImage::getHBITMAPOfSize(HBITMAP bmp, const IntSize* size)
     if (size)
         drawFrameMatchingSourceSize(gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), *size, CompositeCopy);
     else
-        draw(gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), CompositeCopy, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
+        draw(gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), CompositeCopy, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientation::None);
 
     // Do cleanup
     CGContextRelease(cgContext);
@@ -95,7 +95,7 @@ void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext& ctxt, const Float
         if (image && CGImageGetHeight(image) == static_cast<size_t>(srcSize.height()) && CGImageGetWidth(image) == static_cast<size_t>(srcSize.width())) {
             size_t currentFrame = m_currentFrame;
             m_currentFrame = i;
-            draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, srcSize.width(), srcSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
+            draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, srcSize.width(), srcSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientation::None);
             m_currentFrame = currentFrame;
             return;
         }
@@ -103,7 +103,7 @@ void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext& ctxt, const Float
 
     // No image of the correct size was found, fallback to drawing the current frame
     FloatSize imageSize = BitmapImage::size();
-    draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
+    draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientation::None);
 }
 
 } // namespace WebCore
index 3029540..24ec5bc 100644 (file)
@@ -81,7 +81,7 @@ bool BitmapImage::getHBITMAPOfSize(HBITMAP bmp, const IntSize* size)
     if (size)
         drawFrameMatchingSourceSize(gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), *size, CompositeCopy);
     else
-        draw(gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), CompositeCopy, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
+        draw(gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), CompositeCopy, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientation::None);
 
     // Do cleanup
     cairo_destroy(targetRef);
@@ -100,7 +100,7 @@ void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext& ctxt, const Float
         if (cairo_image_surface_get_height(surface.get()) == static_cast<size_t>(srcSize.height()) && cairo_image_surface_get_width(surface.get()) == static_cast<size_t>(srcSize.width())) {
             size_t currentFrame = m_currentFrame;
             m_currentFrame = i;
-            draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, srcSize.width(), srcSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
+            draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, srcSize.width(), srcSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientation::None);
             m_currentFrame = currentFrame;
             return;
         }
@@ -108,7 +108,7 @@ void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext& ctxt, const Float
 
     // No image of the correct size was found, fallback to drawing the current frame
     FloatSize imageSize = BitmapImage::size();
-    draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
+    draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientation::None);
 }
 
 } // namespace WebCore
index c65eda5..bb3df8c 100644 (file)
@@ -159,20 +159,20 @@ bool ImageDecoderDirect2D::frameIsCompleteAtIndex(size_t index) const
 ImageOrientation ImageDecoderDirect2D::frameOrientationAtIndex(size_t index) const
 {
     if (!m_nativeDecoder)
-        return ImageOrientation();
+        return ImageOrientation::None;
 
     COMPtr<IWICBitmapFrameDecode> frame;
     HRESULT hr = m_nativeDecoder->GetFrame(index, &frame);
     if (!SUCCEEDED(hr))
-        return ImageOrientation();
+        return ImageOrientation::None;
 
     COMPtr<IWICMetadataQueryReader> metadata;
     hr = frame->GetMetadataQueryReader(&metadata);
     if (!SUCCEEDED(hr))
-        return ImageOrientation();
+        return ImageOrientation::None;
 
     // FIXME: Identify image type, and ask proper orientation.
-    return ImageOrientation();
+    return ImageOrientation::None;
 }
 
 Seconds ImageDecoderDirect2D::frameDurationAtIndex(size_t index) const
index 2989a09..0af549f 100644 (file)
@@ -81,7 +81,7 @@ void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext& ctxt, const Float
         if (image && clampTo<int>(imageSize.height()) == static_cast<int>(srcSize.height()) && clampTo<int>(imageSize.width()) == static_cast<int>(srcSize.width())) {
             size_t currentFrame = m_currentFrame;
             m_currentFrame = i;
-            draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, srcSize.width(), srcSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
+            draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, srcSize.width(), srcSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientation::None);
             m_currentFrame = currentFrame;
             return;
         }
@@ -89,7 +89,7 @@ void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext& ctxt, const Float
 
     // No image of the correct size was found, fallback to drawing the current frame
     FloatSize imageSize = BitmapImage::size();
-    draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
+    draw(ctxt, dstRect, FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), compositeOp, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientation::None);
 }
 
 } // namespace WebCore
index 3016329..4e4d88d 100644 (file)
@@ -102,7 +102,7 @@ Color nativeImageSinglePixelSolidColor(const NativeImagePtr& image)
     return Color();
 }
 
-void drawNativeImage(const NativeImagePtr& image, GraphicsContext& context, const FloatRect& destRect, const FloatRect& srcRect, const IntSize& srcSize, CompositeOperator compositeOp, BlendMode blendMode, const ImageOrientation& orientation)
+void drawNativeImage(const NativeImagePtr& image, GraphicsContext& context, const FloatRect& destRect, const FloatRect& srcRect, const IntSize& srcSize, CompositeOperator compositeOp, BlendMode blendMode, ImageOrientation orientation)
 {
     auto platformContext = context.platformContext();
 
index f7d184f..845fdaa 100644 (file)
@@ -82,7 +82,7 @@ DragImageRef dissolveDragImageToFraction(DragImageRef image, float fraction)
     return image;
 }
 
-DragImageRef createDragImageFromImage(Image* image, ImageOrientationDescription)
+DragImageRef createDragImageFromImage(Image* image, ImageOrientation)
 {
     return image->nativeImageForCurrentFrame();
 }
index d843a06..b9e79b1 100644 (file)
@@ -82,7 +82,7 @@ private:
     std::unique_ptr<ImageBackingStore> m_backingStore;
     DisposalMethod m_disposalMethod { DisposalMethod::Unspecified };
 
-    ImageOrientation m_orientation { DefaultImageOrientation };
+    ImageOrientation m_orientation { ImageOrientation::None };
     Seconds m_duration;
     bool m_hasAlpha { true };
 };
index b72c55a..ebfe453 100644 (file)
@@ -193,7 +193,7 @@ static ImageOrientation readImageOrientation(jpeg_decompress_struct* info)
         }
     }
 
-    return ImageOrientation();
+    return ImageOrientation::None;
 }
 
 class JPEGImageReader {
index e9852f4..147c2d0 100644 (file)
@@ -78,7 +78,7 @@ DragImageRef scaleDragImage(DragImageRef image, FloatSize scale)
 
 static float maximumAllowedDragImageArea = 600 * 1024;
 
-DragImageRef createDragImageFromImage(Image* image, ImageOrientationDescription orientation)
+DragImageRef createDragImageFromImage(Image* image, ImageOrientation orientation)
 {
     if (!image || !image->width() || !image->height())
         return nil;
@@ -96,9 +96,7 @@ DragImageRef createDragImageFromImage(Image* image, ImageOrientationDescription
         GraphicsContext context(rendererContext.CGContext);
         context.translate(0, imageSize.height);
         context.scale({ adjustedImageScale, -adjustedImageScale });
-        ImagePaintingOptions paintingOptions;
-        paintingOptions.m_orientationDescription = orientation;
-        context.drawImage(*image, FloatPoint(), paintingOptions);
+        context.drawImage(*image, FloatPoint(), ImagePaintingOptions(orientation));
     }];
     return imageCopy.CGImage;
 }
@@ -274,7 +272,7 @@ RetainPtr<CGImageRef> scaleDragImage(RetainPtr<CGImageRef>, FloatSize)
     return nullptr;
 }
 
-RetainPtr<CGImageRef> createDragImageFromImage(Image*, ImageOrientationDescription)
+RetainPtr<CGImageRef> createDragImageFromImage(Image*, ImageOrientation)
 {
     return nullptr;
 }
index bcbbac5..436f772 100644 (file)
@@ -92,19 +92,18 @@ RetainPtr<NSImage> dissolveDragImageToFraction(RetainPtr<NSImage> image, float d
     return dissolvedImage;
 }
         
-RetainPtr<NSImage> createDragImageFromImage(Image* image, ImageOrientationDescription description)
+RetainPtr<NSImage> createDragImageFromImage(Image* image, ImageOrientation orientation)
 {
     FloatSize size = image->size();
 
     if (is<BitmapImage>(*image)) {
-        ImageOrientation orientation;
         BitmapImage& bitmapImage = downcast<BitmapImage>(*image);
         IntSize sizeRespectingOrientation = bitmapImage.sizeRespectingOrientation();
 
-        if (description.respectImageOrientation() == RespectImageOrientation)
+        if (orientation == ImageOrientation::FromImage)
             orientation = bitmapImage.orientationForCurrentFrame();
 
-        if (orientation != DefaultImageOrientation) {
+        if (orientation != ImageOrientation::None) {
             // Construct a correctly-rotated copy of the image to use as the drag image.
             FloatRect destRect(FloatPoint(), sizeRespectingOrientation);
 
index d6cc339..1dbed36 100644 (file)
@@ -118,7 +118,7 @@ exit:
     return hbmp.leak();
 }
     
-DragImageRef createDragImageFromImage(Image* img, ImageOrientationDescription)
+DragImageRef createDragImageFromImage(Image* img, ImageOrientation)
 {
     HWndDC dc(0);
     auto workingDC = adoptGDIObject(::CreateCompatibleDC(dc));
index 7313769..3a5e00b 100644 (file)
@@ -146,7 +146,7 @@ exit:
     return hbmp.leak();
 }
     
-DragImageRef createDragImageFromImage(Image* img, ImageOrientationDescription)
+DragImageRef createDragImageFromImage(Image* img, ImageOrientation)
 {
     HWndDC dc(0);
     auto workingDC = adoptGDIObject(::CreateCompatibleDC(dc));
index 7b21beb..db2920e 100644 (file)
@@ -89,7 +89,7 @@ DragImageRef scaleDragImage(DragImageRef imageRef, FloatSize scale)
     return hbmp.leak();
 }
 
-DragImageRef createDragImageFromImage(Image* img, ImageOrientationDescription)
+DragImageRef createDragImageFromImage(Image* img, ImageOrientation)
 {
     HWndDC dc(nullptr);
     auto workingDC = adoptGDIObject(::CreateCompatibleDC(dc));
index 42430df..bcba7b4 100644 (file)
@@ -955,7 +955,7 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
 
             auto interpolation = chooseInterpolationQuality(context, *image, &bgLayer, geometry.tileSize());
             auto decodingMode = decodingModeForImageDraw(*image, paintInfo);
-            auto drawResult = context.drawTiledImage(*image, geometry.destRect(), toLayoutPoint(geometry.relativePhase()), geometry.tileSize(), geometry.spaceSize(), ImagePaintingOptions(compositeOp, bgLayer.blendMode(), decodingMode, ImageOrientationDescription(), interpolation));
+            auto drawResult = context.drawTiledImage(*image, geometry.destRect(), toLayoutPoint(geometry.relativePhase()), geometry.tileSize(), geometry.spaceSize(), ImagePaintingOptions(compositeOp, bgLayer.blendMode(), decodingMode, ImageOrientation::None, interpolation));
             if (drawResult == ImageDrawResult::DidRequestDecoding) {
                 ASSERT(bgImage->isCachedImage());
                 bgImage->cachedImage()->addClientWaitingForAsyncDecoding(*this);
index e2914f6..393033c 100644 (file)
@@ -2030,16 +2030,18 @@ bool RenderElement::checkForRepaintDuringLayout() const
     return !settings().repaintOutsideLayoutEnabled();
 }
 
-RespectImageOrientationEnum RenderElement::shouldRespectImageOrientation() const
+ImageOrientation RenderElement::imageOrientation() const
 {
 #if USE(CG) || USE(CAIRO) || USE(DIRECT2D)
     // This can only be enabled for ports which honor the orientation flag in their drawing code.
     if (document().isImageDocument())
-        return RespectImageOrientation;
+        return ImageOrientation::FromImage;
 #endif
     // Respect the image's orientation if it's being used as a full-page image or it's
     // an <img> and the setting to respect it everywhere is set.
-    return settings().shouldRespectImageOrientation() && is<HTMLImageElement>(element()) ? RespectImageOrientation : DoNotRespectImageOrientation;
+    if (settings().shouldRespectImageOrientation() && is<HTMLImageElement>(element()))
+        return ImageOrientation::FromImage;
+    return style().imageOrientation();
 }
 
 void RenderElement::adjustFragmentedFlowStateOnContainingBlockChangeIfNeeded()
index 63824e4..0e64dc0 100644 (file)
@@ -204,7 +204,7 @@ public:
     RenderBlock* containingBlockForFixedPosition() const;
     RenderBlock* containingBlockForAbsolutePosition() const;
 
-    WEBCORE_EXPORT RespectImageOrientationEnum shouldRespectImageOrientation() const;
+    WEBCORE_EXPORT ImageOrientation imageOrientation() const;
 
     void removeFromRenderFragmentedFlow();
     virtual void resetEnclosingFragmentedFlowAndChildInfoIncludingDescendants(RenderFragmentedFlow*);
index 062ebb1..913bb41 100644 (file)
@@ -224,8 +224,7 @@ void RenderEmbeddedObject::paintSnapshotImage(PaintInfo& paintInfo, const Layout
         return;
 
     InterpolationQuality interpolation = chooseInterpolationQuality(context, image, &image, alignedRect.size());
-    ImageOrientationDescription orientationDescription(shouldRespectImageOrientation(), style().imageOrientation());
-    context.drawImage(image, alignedRect, ImagePaintingOptions(orientationDescription, interpolation));
+    context.drawImage(image, alignedRect, ImagePaintingOptions(imageOrientation(), interpolation));
 }
 
 void RenderEmbeddedObject::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
index f6cb561..8913e76 100644 (file)
@@ -469,11 +469,7 @@ void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOf
                     centerY = 0;
                 imageOffset = LayoutSize(leftBorder + leftPad + centerX + missingImageBorderWidth, topBorder + topPad + centerY + missingImageBorderWidth);
 
-                ImageOrientationDescription orientationDescription(shouldRespectImageOrientation());
-#if ENABLE(CSS_IMAGE_ORIENTATION)
-                orientationDescription.setImageOrientationEnum(style().imageOrientation());
-#endif
-                context.drawImage(*image, snapRectToDevicePixels(LayoutRect(paintOffset + imageOffset, imageSize), deviceScaleFactor), orientationDescription);
+                context.drawImage(*image, snapRectToDevicePixels(LayoutRect(paintOffset + imageOffset, imageSize), deviceScaleFactor), imageOrientation());
                 errorPictureDrawn = true;
             }
 
@@ -635,9 +631,8 @@ ImageDrawResult RenderImage::paintIntoRect(PaintInfo& paintInfo, const FloatRect
     if (is<BitmapImage>(image))
         downcast<BitmapImage>(*image).updateFromSettings(settings());
 
-    ImageOrientationDescription orientationDescription(shouldRespectImageOrientation(), style().imageOrientation());
     auto decodingMode = decodingModeForImageDraw(*image, paintInfo);
-    auto drawResult = paintInfo.context().drawImage(*img, rect, ImagePaintingOptions(compositeOperator, BlendMode::Normal, decodingMode, orientationDescription, interpolation));
+    auto drawResult = paintInfo.context().drawImage(*img, rect, ImagePaintingOptions(compositeOperator, BlendMode::Normal, decodingMode, imageOrientation(), interpolation));
     if (drawResult == ImageDrawResult::DidRequestDecoding)
         imageResource().cachedImage()->addClientWaitingForAsyncDecoding(*this);
 
index 7f14366..22ed6dd 100644 (file)
@@ -2476,7 +2476,7 @@ bool RenderLayerBacking::isDirectlyCompositedImage() const
         if (!is<BitmapImage>(image))
             return false;
 
-        if (downcast<BitmapImage>(*image).orientationForCurrentFrame() != DefaultImageOrientation)
+        if (downcast<BitmapImage>(*image).orientationForCurrentFrame() != ImageOrientation::None)
             return false;
 
 #if (PLATFORM(GTK) || PLATFORM(WPE))
index 3faafa1..6d56b5e 100644 (file)
@@ -145,8 +145,7 @@ void RenderSnapshottedPlugIn::paintSnapshot(PaintInfo& paintInfo, const LayoutPo
         return;
 
     InterpolationQuality interpolation = chooseInterpolationQuality(context, *image, image, alignedRect.size());
-    ImageOrientationDescription orientationDescription(shouldRespectImageOrientation(), style().imageOrientation());
-    context.drawImage(*image, alignedRect, ImagePaintingOptions(orientationDescription, interpolation));
+    context.drawImage(*image, alignedRect, ImagePaintingOptions(imageOrientation(), interpolation));
 }
 
 CursorDirective RenderSnapshottedPlugIn::getCursor(const LayoutPoint& point, Cursor& overrideCursor) const
index 70defad..c361207 100644 (file)
@@ -752,7 +752,7 @@ public:
     bool isFlippedLinesWritingMode() const { return WebCore::isFlippedLinesWritingMode(writingMode()); }
     bool isFlippedBlocksWritingMode() const { return WebCore::isFlippedWritingMode(writingMode()); }
 
-    ImageOrientationEnum imageOrientation() const;
+    ImageOrientation imageOrientation() const;
 
     ImageRendering imageRendering() const { return static_cast<ImageRendering>(m_rareInheritedData->imageRendering); }
 
@@ -951,7 +951,7 @@ public:
 #endif
 
 #if ENABLE(CSS_IMAGE_ORIENTATION)
-    void setImageOrientation(ImageOrientationEnum v) { SET_VAR(m_rareInheritedData, imageOrientation, static_cast<int>(v)); }
+    void setImageOrientation(ImageOrientation v) { SET_VAR(m_rareInheritedData, imageOrientation, static_cast<int>(v)); }
 #endif
 
     void setImageRendering(ImageRendering v) { SET_VAR(m_rareInheritedData, imageRendering, static_cast<unsigned>(v)); }
@@ -1582,7 +1582,7 @@ public:
     static OptionSet<TextEmphasisPosition> initialTextEmphasisPosition() { return { TextEmphasisPosition::Over, TextEmphasisPosition::Right }; }
     static RubyPosition initialRubyPosition() { return RubyPosition::Before; }
     static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; }
-    static ImageOrientationEnum initialImageOrientation() { return OriginTopLeft; }
+    static ImageOrientation initialImageOrientation() { return ImageOrientation::None; }
     static ImageRendering initialImageRendering() { return ImageRendering::Auto; }
     static ImageResolutionSource initialImageResolutionSource() { return ImageResolutionSource::Specified; }
     static ImageResolutionSnap initialImageResolutionSnap() { return ImageResolutionSnap::None; }
@@ -2091,12 +2091,12 @@ inline bool RenderStyle::hasInlineColumnAxis() const
     return axis == ColumnAxis::Auto || isHorizontalWritingMode() == (axis == ColumnAxis::Horizontal);
 }
 
-inline ImageOrientationEnum RenderStyle::imageOrientation() const
+inline ImageOrientation RenderStyle::imageOrientation() const
 {
 #if ENABLE(CSS_IMAGE_ORIENTATION)
-    return static_cast<ImageOrientationEnum>(m_rareInheritedData->imageOrientation);
+    return ImageOrientation(m_rareInheritedData->imageOrientation);
 #else
-    return DefaultImageOrientation;
+    return ImageOrientation::None;
 #endif
 }
 
index 5ae993f..3ddbbd0 100644 (file)
@@ -121,7 +121,7 @@ public:
     unsigned lineBoxContain: 7; // LineBoxContain
     // CSS Image Values Level 3
 #if ENABLE(CSS_IMAGE_ORIENTATION)
-    unsigned imageOrientation : 4; // ImageOrientationEnum
+    unsigned imageOrientation : 4; // ImageOrientation
 #endif
     unsigned imageRendering : 3; // ImageRendering
     unsigned lineSnap : 2; // LineSnap
index 40ee991..809aff5 100644 (file)
@@ -202,7 +202,7 @@ ImageDrawResult SVGImage::drawForContainer(GraphicsContext& context, const Float
 
     frameView()->scrollToFragment(initialFragmentURL);
 
-    ImageDrawResult result = draw(context, dstRect, scaledSrc, compositeOp, blendMode, DecodingMode::Synchronous, ImageOrientationDescription());
+    ImageDrawResult result = draw(context, dstRect, scaledSrc, compositeOp, blendMode, DecodingMode::Synchronous, ImageOrientation::None);
 
     setImageObserver(observer);
     return result;
@@ -221,7 +221,7 @@ NativeImagePtr SVGImage::nativeImageForCurrentFrame(const GraphicsContext*)
     if (!buffer) // failed to allocate image
         return nullptr;
 
-    draw(buffer->context(), rect(), rect(), CompositeSourceOver, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
+    draw(buffer->context(), rect(), rect(), CompositeSourceOver, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientation::None);
 
     // FIXME: WK(Bug 113657): We should use DontCopyBackingStore here.
     return buffer->copyImage(CopyBackingStore)->nativeImageForCurrentFrame();
@@ -247,7 +247,7 @@ NativeImagePtr SVGImage::nativeImage(const GraphicsContext* targetContext)
     PlatformContextDirect2D platformContext(nativeImageTarget.get());
     GraphicsContext localContext(&platformContext, GraphicsContext::BitmapRenderingContextType::GPUMemory);
 
-    draw(localContext, rect(), rect(), CompositeSourceOver, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientationDescription());
+    draw(localContext, rect(), rect(), CompositeSourceOver, BlendMode::Normal, DecodingMode::Synchronous, ImageOrientation::None);
 
     return nativeImage;
 }
@@ -289,7 +289,7 @@ void SVGImage::drawPatternForContainer(GraphicsContext& context, const FloatSize
     image->drawPattern(context, dstRect, scaledSrcRect, unscaledPatternTransform, phase, spacing, compositeOp, blendMode);
 }
 
-ImageDrawResult SVGImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode, DecodingMode, ImageOrientationDescription)
+ImageDrawResult SVGImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode, DecodingMode, ImageOrientation)
 {
     if (!m_page)
         return ImageDrawResult::DidNothing;
index cd3fd0d..075424f 100644 (file)
@@ -94,7 +94,7 @@ private:
     void startAnimationTimerFired();
 
     explicit SVGImage(ImageObserver&);
-    ImageDrawResult draw(GraphicsContext&, const FloatRect& fromRect, const FloatRect& toRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientationDescription) final;
+    ImageDrawResult draw(GraphicsContext&, const FloatRect& fromRect, const FloatRect& toRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientation) final;
     ImageDrawResult drawForContainer(GraphicsContext&, const FloatSize containerSize, float containerZoom, const URL& initialFragmentURL, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode);
     void drawPatternForContainer(GraphicsContext&, const FloatSize& containerSize, float containerZoom, const URL& initialFragmentURL, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing,
         CompositeOperator, const FloatRect&, BlendMode);
index 5b0ee93..cf8cc3e 100644 (file)
@@ -35,7 +35,7 @@ FloatSize SVGImageForContainer::size() const
 }
 
 ImageDrawResult SVGImageForContainer::draw(GraphicsContext& context, const FloatRect& dstRect,
-    const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode, DecodingMode, ImageOrientationDescription)
+    const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode, DecodingMode, ImageOrientation)
 {
     return m_image->drawForContainer(context, m_containerSize, m_containerZoom, m_initialFragmentURL, dstRect, srcRect, compositeOp, blendMode);
 }
index 4cfce8d..869d097 100644 (file)
@@ -53,7 +53,7 @@ public:
         m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio);
     }
 
-    ImageDrawResult draw(GraphicsContext&, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode, DecodingMode, ImageOrientationDescription) final;
+    ImageDrawResult draw(GraphicsContext&, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode, DecodingMode, ImageOrientation) final;
 
     void drawPattern(GraphicsContext&, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, const FloatSize&, CompositeOperator, BlendMode) final;
 
index d01a2c7..c6e71ae 100644 (file)
@@ -1,3 +1,13 @@
+2019-08-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        shouldRespectImageOrientation should be a value in ImageOrientation
+        https://bugs.webkit.org/show_bug.cgi?id=200553
+
+        Reviewed by Simon Fraser.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::imagePositionInformation):
+
 2019-08-13  John Wilander  <wilander@apple.com>
 
         Resource Load Statistics: Switch NSURLSession on top navigation to prevalent resource with user interaction
index ccb349f..e4c6427 100644 (file)
@@ -2639,8 +2639,7 @@ static void imagePositionInformation(WebPage& page, Element& element, const Inte
     if (!graphicsContext)
         return;
 
-    auto shouldRespectImageOrientation = renderImage.shouldRespectImageOrientation();
-    graphicsContext->drawImage(*image, FloatRect(0, 0, bitmapSize.width(), bitmapSize.height()), ImageOrientationDescription(shouldRespectImageOrientation));
+    graphicsContext->drawImage(*image, FloatRect(0, 0, bitmapSize.width(), bitmapSize.height()), renderImage.imageOrientation());
     info.image = sharedBitmap;
 }