Bug 231934

Summary: Image::orientation() shouldn't return ImageOrientation::FromImage
Product: WebKit Reporter: Cameron McCormack (:heycam) <heycam>
Component: ImagesAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: sabouhallawa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   

Cameron McCormack (:heycam)
Reported 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.
Attachments
Radar WebKit Bug Importer
Comment 1 2021-10-25 19:57:18 PDT
Note You need to log in before you can comment on or make changes to this bug.