[iOS] Position image information should respect the image orientation
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Aug 2019 19:13:11 +0000 (19:13 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Aug 2019 19:13:11 +0000 (19:13 +0000)
commit39e611a8f177a73027e4ae097002ab9b1d0c83aa
treeff753fc100a82bab5247a561b425d55e3747d0fc
parenta6bd8fcc1d060f72e621c96956ca6f3840c930ee
[iOS] Position image information should respect the image orientation
https://bugs.webkit.org/show_bug.cgi?id=200487

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

Source/WebCore:

Re-factor CachedImage::imageSizeForRenderer() into another overriding
function which does not scale the imageSize. Therefore the new function
returns FloatSize while the original function returns LayoutSize.

* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::imageSizeForRenderer const):
* loader/cache/CachedImage.h:
* rendering/RenderElement.h:

Source/WebKit:

imagePositionInformation() should respect the image orientation when
drawing an Image to a ShareableBitmap context.

boundsPositionInformation() already takes care of the image orientation
because it gets RenderImage::enclosingBoundingBox().

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

Tools:

Add an API test to verify the position image information is drawn rotated
because of respecting its image orientation.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/WKRequestActivatedElementInfo.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/exif-orientation-8-llo.jpg: Added.
* TestWebKitAPI/Tests/WebKitCocoa/img-with-rotated-image.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248438 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/loader/cache/CachedImage.cpp
Source/WebCore/loader/cache/CachedImage.h
Source/WebCore/rendering/RenderElement.h
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKRequestActivatedElementInfo.mm
Tools/TestWebKitAPI/Tests/WebKitCocoa/exif-orientation-8-llo.jpg [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKitCocoa/img-with-rotated-image.html [new file with mode: 0644]