Bug 217829

Summary: [Cairo] REGRESSION(r268176): media/video-orientation-canvas.html is failing
Product: WebKit Reporter: Diego Pino <dpino>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: jer.noble, lmoura, magomez, pnormand, pvollan, smoley, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Example with tranposed video and transposed image drawn to canvas none

Description Diego Pino 2020-10-16 09:00:46 PDT
media/video-orientation-canvas.html [ Failure ]

wk-testhunter reports test started failing in interval: [r268176-r268179]. I bisected the interval an r268176 seems to be the cause for the test failure.

Diff: https://build.webkit.org/results/GTK-Linux-64-bit-Release-Tests/r268575%20(16457)/media/video-orientation-canvas-diff.txt

--- /home/buildbot/worker/gtk-linux-64-release-tests/build/layout-test-results/media/video-orientation-canvas-expected.txt
+++ /home/buildbot/worker/gtk-linux-64-release-tests/build/layout-test-results/media/video-orientation-canvas-actual.txt
@@ -1,6 +1,6 @@
 
-EXPECTED (context.getImageData(88, 115, 1, 1).data == [208,0,0,255] with tolerance 5 OK
+EXPECTED (context.getImageData(88, 115, 1, 1).data == [208,0,0,255] with tolerance 5, OBSERVED '[0,0,0,255]' FAIL
 EXPECTED (context.getImageData(237, 88, 1, 1).data == [208,0,0,255] with tolerance 5 OK
-EXPECTED (context.getImageData(200, 237, 1, 1).data == [208,0,0,255] with tolerance 5 OK
+EXPECTED (context.getImageData(200, 237, 1, 1).data == [208,0,0,255] with tolerance 5, OBSERVED '[0,0,0,255]' FAIL
 END OF TEST
Comment 1 Radar WebKit Bug Importer 2020-10-23 09:01:23 PDT
<rdar://problem/70621171>
Comment 2 Philippe Normand 2020-10-26 07:51:08 PDT
Setting didUseWidthAsHeight to false in CairoOperations.cpp line 919 makes the test pass again.
Comment 3 Lauro Moura 2020-10-26 21:58:08 PDT
Checking the (In reply to Philippe Normand from comment #2)
> Setting didUseWidthAsHeight to false in CairoOperations.cpp line 919 makes
> the test pass again.

An initial investigation showed that Cairo::drawNativeImage somehow was invoked differently when the 90deg rotated video is drawn to the canvas in comparison to a 90deg image.

For the image (subject of the original patch), both destination and source rect already arrived with the same orientation (same height and width), so the `ifs` check inside drawNativeImage transposed the destination rect to the expected orientation so drawSurface could scale/pad correctly.

Now with video, the orientation information is there too (The source data is rotated 90deg) but the destination rect arrives already transposed. This causes the same if block to transpose again, leading to drawNativeSurface to scale/pad the video incorrectly.

Next I'll check how the destination rects are provided to drawNativeImage.
Comment 4 Lauro Moura 2020-10-26 21:58:49 PDT
Created attachment 412388 [details]
Example with tranposed video and transposed image drawn to canvas
Comment 5 Philippe Normand 2021-02-22 08:28:09 PST

*** This bug has been marked as a duplicate of bug 218580 ***