Bug 225952 - [GTK][WebInspector] Value of 'imageSmoothingQuality' is 'medium' for platforms not using CG
Summary: [GTK][WebInspector] Value of 'imageSmoothingQuality' is 'medium' for platform...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Diego Pino
URL:
Keywords: InRadar
: 223301 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-05-18 18:41 PDT by Diego Pino
Modified: 2021-06-28 02:05 PDT (History)
10 users (show)

See Also:


Attachments
Patch (52.06 KB, patch)
2021-05-18 18:42 PDT, Diego Pino
no flags Details | Formatted Diff | Diff
Patch (4.34 KB, patch)
2021-05-20 00:20 PDT, Diego Pino
no flags Details | Formatted Diff | Diff
Patch (4.39 KB, patch)
2021-05-20 01:51 PDT, Diego Pino
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Pino 2021-05-18 18:41:36 PDT
[GTK][WebInspector] Value of 'imageSmoothingQuality' is 'medium' for platforms not using CG
Comment 1 Diego Pino 2021-05-18 18:42:52 PDT
Created attachment 429015 [details]
Patch
Comment 2 Diego Pino 2021-05-18 18:51:14 PDT
Right now several tests in 'inspector/canvas' are failing because of a wrong check of the 'imageSmoothingQuality' value. This value is 'low' for CG platforms and 'medium' otherwise [1]. The tests that are failing are the following:

  inspector/canvas/recording-2d-frameCount.html
  inspector/canvas/recording-2d-full.html
  inspector/canvas/recording-2d-memoryLimit.html
  inspector/canvas/recording-2d-saves.html
  inspector/canvas/recording-html-2d.html

The patch sets the default value accordingly and emits new specific baselines for GTK platform. Maybe emitting new baselines can be saved if the check of 'imageSmoothingQuality' value is done in a different way.

[1] https://webkit-search.igalia.com/webkit/source/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp#86
Comment 3 Sam Weinig 2021-05-19 08:14:24 PDT
Perhaps we should instead update non-CG platforms to use low as well, as that is what the spec says it should be these days: https://html.spec.whatwg.org/multipage/canvas.html#canvasimagesmoothing
Comment 4 Diego Pino 2021-05-20 00:20:53 PDT
Created attachment 429142 [details]
Patch
Comment 5 Diego Pino 2021-05-20 01:51:36 PDT
Created attachment 429148 [details]
Patch
Comment 6 Sam Weinig 2021-05-21 08:38:01 PDT
Comment on attachment 429148 [details]
Patch

Thanks!
Comment 7 EWS 2021-05-21 16:04:25 PDT
Committed r277896 (238031@main): <https://commits.webkit.org/238031@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 429148 [details].
Comment 8 Radar WebKit Bug Importer 2021-05-21 16:05:22 PDT
<rdar://problem/78333302>
Comment 9 Tim Horton 2021-05-23 00:01:22 PDT
FWIW this broke 

fast/canvas/canvas-imageSmoothingEnabled.html
fast/canvas/canvas-imageSmoothingQuality.html

on gtk
Comment 10 Tim Horton 2021-05-23 00:01:49 PDT
Also why the [WebInspector] prefix? This is a wide-ranging change :)
Comment 11 Tim Horton 2021-05-23 12:53:50 PDT
From my debugging before I found this bug yesterday, it kind of seemed like Cairo's "low quality" really means "not at all". Maybe that's why it was medium before?
Comment 12 Diego Pino 2021-06-15 15:55:52 PDT
(In reply to Tim Horton from comment #9)
> FWIW this broke 
> 
> fast/canvas/canvas-imageSmoothingEnabled.html
> fast/canvas/canvas-imageSmoothingQuality.html
> 
> on gtk

Right, fast/canvas/canvas-imageSmoothingEnabled.html has regressed:

-PASS left_of_center_pixel.data[0] !== 0 is true
-PASS left_of_center_pixel.data[1] !== 0 is true
-PASS left_of_center_pixel.data[2] !== 0 is true
+FAIL left_of_center_pixel.data[0] !== 0 should be true. Was false.
+FAIL left_of_center_pixel.data[1] !== 0 should be true. Was false.
+FAIL left_of_center_pixel.data[2] !== 0 should be true. Was false.

fast/canvas/canvas-imageSmoothingQuality.html has its own baseline for GTK. The test has now one test that went from FAIL to PASS and viceversa. I think updating the baseline is the right thing to do.

--- /home/buildbot/worker/gtk-linux-64-release-tests/build/layout-test-results/fast/canvas/canvas-imageSmoothingQuality-expected.txt
+++ /home/buildbot/worker/gtk-linux-64-release-tests/build/layout-test-results/fast/canvas/canvas-imageSmoothingQuality-actual.txt
@@ -8,14 +8,14 @@
 PASS mediumContext.imageSmoothingQuality is 'medium'
 PASS highContext.imageSmoothingQuality is 'high'
 
-PASS lowData is not mediumData
+FAIL lowData should not be {"0":0,"1":0,"2":0,"3":128}.
 PASS mediumData is not highData
 PASS lowData is not highData
 
 PASS sampleAlpha(lowData) is >= sampleAlpha(mediumData)
 PASS sampleAlpha(mediumData) is >= sampleAlpha(highData)
 
-FAIL defaultContext.imageSmoothingQuality should be low. Was medium.
+PASS defaultContext.imageSmoothingQuality is 'low'
 
 PASS highContext.imageSmoothingEnabled = false; highContext.imageSmoothingQuality is 'high'
 PASS highContext.imageSmoothingQuality = 'medium'; highContext.imageSmoothingQuality is 'medium'
Comment 13 Diego Pino 2021-06-15 16:05:04 PDT
(In reply to Tim Horton from comment #10)
> Also why the [WebInspector] prefix? This is a wide-ranging change :)

The first patch changed LayoutTests/inspector/canvas/recording-2d-saves.html to produce different imageSmoothingQuality values depending on platform. Since it only targeted a WebInspector test adding the WebInspector label made sense. Then, in the review process it was pointed out imageSmoothingQuality default value should be Low as defined by specification, but the original WebInspector label remained.
Comment 14 Diego Pino 2021-06-15 16:16:43 PDT
(In reply to Tim Horton from comment #11)
> From my debugging before I found this bug yesterday, it kind of seemed like
> Cairo's "low quality" really means "not at all". Maybe that's why it was
> medium before?

I will file a new bug to keep track of the tests that have regressed after this change:

fast/canvas/canvas-imageSmoothingEnabled.html
fast/canvas/canvas-imageSmoothingQuality.html

From my POV, and without looking into this issue yet, it makes sense to me to keep imageSmoothingQuality default value as 'Low' and try to solve this issue at Cairo level.
Comment 15 Diego Pino 2021-06-28 02:05:08 PDT
*** Bug 223301 has been marked as a duplicate of this bug. ***