Bug 203355 - EXIF orientation is ignored for some CSS images
Summary: EXIF orientation is ignored for some CSS images
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on:
Blocks: 89052
  Show dependency treegraph
 
Reported: 2019-10-23 22:31 PDT by Simon Fraser (smfr)
Modified: 2020-01-21 15:53 PST (History)
10 users (show)

See Also:


Attachments
Testcase (8.82 KB, application/zip)
2019-10-23 22:31 PDT, Simon Fraser (smfr)
no flags Details
Patch (19.96 KB, patch)
2020-01-16 15:47 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (28.22 KB, patch)
2020-01-17 15:07 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (28.31 KB, patch)
2020-01-17 15:34 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (28.30 KB, patch)
2020-01-17 16:49 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (30.23 KB, patch)
2020-01-20 11:14 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2019-10-23 22:31:57 PDT
Created attachment 381775 [details]
Testcase

We ignore EXIF orientation when hitting the rendering codepaths that go through GraphicsContext::drawTiledImage(), so fail to respect EXIF orientation for CSS images in tiled background-image, border-image etc.
Comment 1 Radar WebKit Bug Importer 2019-10-23 22:33:57 PDT
<rdar://problem/56568303>
Comment 2 Said Abou-Hallawa 2020-01-16 15:47:55 PST
Created attachment 387973 [details]
Patch
Comment 3 Said Abou-Hallawa 2020-01-17 15:07:36 PST
Created attachment 388093 [details]
Patch
Comment 4 Said Abou-Hallawa 2020-01-17 15:08:49 PST
(In reply to Said Abou-Hallawa from comment #3)
> Created attachment 388093 [details]
> Patch

In this patch the EXIF orientation is respected with css background images and css border images.
Comment 5 Said Abou-Hallawa 2020-01-17 15:34:24 PST
Created attachment 388097 [details]
Patch
Comment 6 Simon Fraser (smfr) 2020-01-17 16:31:01 PST
Comment on attachment 388097 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=388097&action=review

> Source/WebCore/platform/graphics/BitmapImage.cpp:162
> +    FloatRect rect = { IntPoint::zero(), size() };

It's a bit weird to initialize the location of a FloatRect with IntPoint::zero

Is size() computed respecting orientation? I.e. do we know this code won't distort the image?
Comment 7 Said Abou-Hallawa 2020-01-17 16:38:23 PST
Comment on attachment 388097 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=388097&action=review

>> Source/WebCore/platform/graphics/BitmapImage.cpp:162
>> +    FloatRect rect = { IntPoint::zero(), size() };
> 
> It's a bit weird to initialize the location of a FloatRect with IntPoint::zero
> 
> Is size() computed respecting orientation? I.e. do we know this code won't distort the image?

I will replace the IntPoint::zero() by FloatPoint().

Yes size() is computed respecting orientation since it takes an ImageOrientation argument which has a default value 'FromImage'. The definition of it in Image.h is

virtual FloatSize size(ImageOrientation = ImageOrientation::FromImage) const = 0;
Comment 8 Said Abou-Hallawa 2020-01-17 16:49:26 PST
Created attachment 388116 [details]
Patch
Comment 9 Said Abou-Hallawa 2020-01-20 11:14:35 PST
Created attachment 388248 [details]
Patch
Comment 10 WebKit Commit Bot 2020-01-20 18:54:27 PST
Comment on attachment 388248 [details]
Patch

Clearing flags on attachment: 388248

Committed r254841: <https://trac.webkit.org/changeset/254841>
Comment 11 WebKit Commit Bot 2020-01-20 18:54:28 PST
All reviewed patches have been landed.  Closing bug.
Comment 14 Said Abou-Hallawa 2020-01-21 15:53:51 PST
(In reply to Jonathan Bedard from comment #13)
> Oops, wrong tests:
> https://results.webkit.org/?suite=layout-tests&suite=layout-
> tests&test=fast%2Fimages%2Fexif-orientation-border-image.
> html&test=fast%2Fimages%2Fexif-orientation-background-image-no-repeat.html

Yes. The non CG ports have to skip these tests or to respect the EXIF image orientation when drawing the native image for CSS background and border.