Bug 231934 - Image::orientation() shouldn't return ImageOrientation::FromImage
Summary: Image::orientation() shouldn't return ImageOrientation::FromImage
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-10-18 19:56 PDT by Cameron McCormack (:heycam)
Modified: 2021-10-25 19:57 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron McCormack (:heycam) 2021-10-18 19:56:37 PDT
It's a bit weird that Image::orientation() has a default implementation that returns ImageOrientation::FromImage.  I think Image::orientation() should return the image's native orientation metadata, and so for image types that don't have any orientation metadata, a better default would be ImageOrientation::None.  There are places in the code where we check for FromImage and turn it into None, because we need a concrete orientation value to call e.g. swapsWidthAndHeight() on.

We could:

1. Rename Image::orientation() to say nativeOrientation(), make it protected, and add a new public Image::orientation() accessor that calls nativeOrientation() and asserts that its return value is not FromImage.
2. Have two types -- ImageOrientation, as it is now, and a new type (NativeImageOrientation? ResolvedImageOrientation? Orientation?) that doesn't have a FromImage value.  Then update functions to take the appropriate type.
Comment 1 Radar WebKit Bug Importer 2021-10-25 19:57:18 PDT
<rdar://problem/84643755>