Bug 200726

Summary: [iOS](REGRESSION: r200487): WebKit.RequestActivatedElementInfoForRotatedImage fails on iOS 13
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: ImagesAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, simon.fraser, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Said Abou-Hallawa
Reported 2019-08-14 11:46:42 PDT
The API test WebKit.RequestActivatedElementInfoForRotatedImage has been failing on iOS 13. It fails because it gets the image pixels by copying the data of the image data provider. I mistakenly was assuming that the data provider has to be point directly to pixels data which is not necessarily true. The iOS 13 underlying components have changed such that the data provider is not an array of the pixels' colors anymore. To get the pixels as an array of colors, the image should be drawn to a memory context instead. Then the backing memory buffer can be accessed to get the image pixels' colors.
Attachments
Patch (4.47 KB, patch)
2019-08-14 11:48 PDT, Said Abou-Hallawa
no flags
Patch (4.44 KB, patch)
2019-08-14 14:43 PDT, Said Abou-Hallawa
no flags
Said Abou-Hallawa
Comment 1 2019-08-14 11:48:08 PDT
Said Abou-Hallawa
Comment 2 2019-08-14 11:49:30 PDT
Simon Fraser (smfr)
Comment 3 2019-08-14 12:20:53 PDT
Comment on attachment 376285 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=376285&action=review > Tools/ChangeLog:3 > + [iOS](REGRESSION: r200487): Get the CGImage pixels by drawing it into a memory context This title is confusing. It says REGRESSION but then the title describes the fix? > Tools/ChangeLog:10 > + To get the pixels as an array of colors, draw the image into a memory > + context. The backing memory buffer can then be accessed to get the image > + pixels' colors. What was wrong with the previous version? > Tools/TestWebKitAPI/Tests/WebKitCocoa/WKRequestActivatedElementInfo.mm:126 > + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); RetainPtr<> > Tools/TestWebKitAPI/Tests/WebKitCocoa/WKRequestActivatedElementInfo.mm:127 > + CGContextRef context = CGBitmapContextCreate(pixels.data(), width, height, bitsPerComponent, bytesPerRow, colorSpace, kCGImageAlphaPremultipliedFirst | kCGImageByteOrder32Little); RetainPtr<>
Said Abou-Hallawa
Comment 4 2019-08-14 14:43:43 PDT
Said Abou-Hallawa
Comment 5 2019-08-14 15:13:42 PDT
Comment on attachment 376285 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=376285&action=review >> Tools/ChangeLog:3 >> + [iOS](REGRESSION: r200487): Get the CGImage pixels by drawing it into a memory context > > This title is confusing. It says REGRESSION but then the title describes the fix? The tile was change to say what the bug is. >> Tools/ChangeLog:10 >> + pixels' colors. > > What was wrong with the previous version? Nothing was wrong with the previous version. I had the wrong assumption about the image data provider. I was assuming it has to point to the first pixel color. This assumption was true on iOS 12 but it is not true anymore on iOS 13. >> Tools/TestWebKitAPI/Tests/WebKitCocoa/WKRequestActivatedElementInfo.mm:126 >> + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); > > RetainPtr<> Done. >> Tools/TestWebKitAPI/Tests/WebKitCocoa/WKRequestActivatedElementInfo.mm:127 >> + CGContextRef context = CGBitmapContextCreate(pixels.data(), width, height, bitsPerComponent, bytesPerRow, colorSpace, kCGImageAlphaPremultipliedFirst | kCGImageByteOrder32Little); > > RetainPtr<> Done.
WebKit Commit Bot
Comment 6 2019-08-14 18:17:37 PDT
Comment on attachment 376315 [details] Patch Clearing flags on attachment: 376315 Committed r248701: <https://trac.webkit.org/changeset/248701>
WebKit Commit Bot
Comment 7 2019-08-14 18:17:38 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.