- Revision
- 287345
- Author
- simon.fra...@apple.com
- Date
- 2021-12-21 21:15:33 -0800 (Tue, 21 Dec 2021)
Log Message
Fuzzy pixel data need to be computed in terms of CSS pixels
https://bugs.webkit.org/show_bug.cgi?id=232525
Reviewed by Tim Horton.
Tools:
Pixel tolerance is computed in CSS pixels, so have ImageDiff divide the total number of
differing pixels by the square of the scale factor (a single different pixel at 1x becomes 4
different pixels at 2x).
* ImageDiff/ImageDiff.cpp:
(processImages):
* ImageDiff/PlatformImage.cpp:
(ImageDiff::PlatformImage::isCompatible const):
(ImageDiff::PlatformImage::difference):
LayoutTests:
Add a hidpi pixel tolerance test.
* fast/harness/image-diff/hidpi-pixel-tolerance-expected.html: Added.
* fast/harness/image-diff/hidpi-pixel-tolerance.html: Added.
* platform/ios-wk2/TestExpectations: Remove fast/harness/image-diff/fuzz-2-25.html.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (287344 => 287345)
--- trunk/LayoutTests/ChangeLog 2021-12-22 04:52:39 UTC (rev 287344)
+++ trunk/LayoutTests/ChangeLog 2021-12-22 05:15:33 UTC (rev 287345)
@@ -1,3 +1,16 @@
+2021-12-21 Simon Fraser <simon.fra...@apple.com>
+
+ Fuzzy pixel data need to be computed in terms of CSS pixels
+ https://bugs.webkit.org/show_bug.cgi?id=232525
+
+ Reviewed by Tim Horton.
+
+ Add a hidpi pixel tolerance test.
+
+ * fast/harness/image-diff/hidpi-pixel-tolerance-expected.html: Added.
+ * fast/harness/image-diff/hidpi-pixel-tolerance.html: Added.
+ * platform/ios-wk2/TestExpectations: Remove fast/harness/image-diff/fuzz-2-25.html.
+
2021-12-21 Alan Bujtas <za...@apple.com>
[LFC][IFC] Compute visual geometry for InlineDisplay::Line
Added: trunk/LayoutTests/fast/harness/image-diff/hidpi-pixel-tolerance-expected.html (0 => 287345)
--- trunk/LayoutTests/fast/harness/image-diff/hidpi-pixel-tolerance-expected.html (rev 0)
+++ trunk/LayoutTests/fast/harness/image-diff/hidpi-pixel-tolerance-expected.html 2021-12-22 05:15:33 UTC (rev 287345)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ .box {
+ position: relative;
+ width: 100px;
+ height: 100px;
+ background-color: rgb(0, 128, 0);
+ }
+ </style>
+</head>
+<body>
+ <div class="box"></div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/harness/image-diff/hidpi-pixel-tolerance.html (0 => 287345)
--- trunk/LayoutTests/fast/harness/image-diff/hidpi-pixel-tolerance.html (rev 0)
+++ trunk/LayoutTests/fast/harness/image-diff/hidpi-pixel-tolerance.html 2021-12-22 05:15:33 UTC (rev 287345)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta name="fuzzy" content="maxDifference=2;totalPixels=25">
+ <style>
+ .box {
+ position: relative;
+ width: 100px;
+ height: 100px;
+ background-color: rgb(0, 128, 0);
+ }
+
+ .mismatch-box {
+ position: absolute;
+ margin: 10px;
+ width: 5px;
+ height: 5px;
+ background-color: rgb(0, 126, 0);
+ }
+ </style>
+</head>
+<body>
+ <div class="box">
+ <div class="mismatch-box"></div>
+ </div>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/ios-wk2/TestExpectations (287344 => 287345)
--- trunk/LayoutTests/platform/ios-wk2/TestExpectations 2021-12-22 04:52:39 UTC (rev 287344)
+++ trunk/LayoutTests/platform/ios-wk2/TestExpectations 2021-12-22 05:15:33 UTC (rev 287345)
@@ -1112,8 +1112,6 @@
webkit.org/b/157589 fast/text-autosizing/ios/text-autosizing-after-back.html [ Pass Timeout ]
-webkit.org/b/232525 fast/harness/image-diff/fuzz-2-25.html [ ImageOnlyFailure ]
-
# started to fail after new snapshotting in r202532
webkit.org/b/150942 animations/multiple-backgrounds.html [ Pass ImageOnlyFailure ]
compositing/overlap-blending/reflection-opacity-huge.html [ ImageOnlyFailure ]
Modified: trunk/Tools/ChangeLog (287344 => 287345)
--- trunk/Tools/ChangeLog 2021-12-22 04:52:39 UTC (rev 287344)
+++ trunk/Tools/ChangeLog 2021-12-22 05:15:33 UTC (rev 287345)
@@ -1,3 +1,20 @@
+2021-12-21 Simon Fraser <simon.fra...@apple.com>
+
+ Fuzzy pixel data need to be computed in terms of CSS pixels
+ https://bugs.webkit.org/show_bug.cgi?id=232525
+
+ Reviewed by Tim Horton.
+
+ Pixel tolerance is computed in CSS pixels, so have ImageDiff divide the total number of
+ differing pixels by the square of the scale factor (a single different pixel at 1x becomes 4
+ different pixels at 2x).
+
+ * ImageDiff/ImageDiff.cpp:
+ (processImages):
+ * ImageDiff/PlatformImage.cpp:
+ (ImageDiff::PlatformImage::isCompatible const):
+ (ImageDiff::PlatformImage::difference):
+
2021-12-21 Alex Christensen <achristen...@webkit.org>
Re-enable ContextMenu API tests
Modified: trunk/Tools/ImageDiff/ImageDiff.cpp (287344 => 287345)
--- trunk/Tools/ImageDiff/ImageDiff.cpp 2021-12-22 04:52:39 UTC (rev 287344)
+++ trunk/Tools/ImageDiff/ImageDiff.cpp 2021-12-22 05:15:33 UTC (rev 287345)
@@ -58,6 +58,9 @@
} else if (actualImage->hasAlpha() != baselineImage->hasAlpha()) {
fprintf(stderr, "Error: test and reference images differ in alpha. Test image %s alpha, reference image %s alpha.\n",
actualImage->hasAlpha() ? "has" : "does not have", baselineImage->hasAlpha() ? "has" : "does not have");
+ } else if (actualImage->scaleFactor() != baselineImage->scaleFactor()) {
+ fprintf(stderr, "Error: test and reference images differ in scale factor. Test image scale factor %.1f, reference image scale factor %.1f.\n",
+ actualImage->scaleFactor(), baselineImage->scaleFactor());
}
return EXIT_FAILURE;
Modified: trunk/Tools/ImageDiff/PlatformImage.cpp (287344 => 287345)
--- trunk/Tools/ImageDiff/PlatformImage.cpp 2021-12-22 04:52:39 UTC (rev 287344)
+++ trunk/Tools/ImageDiff/PlatformImage.cpp 2021-12-22 05:15:33 UTC (rev 287345)
@@ -36,6 +36,7 @@
{
return width() == other.width()
&& height() == other.height()
+ && scaleFactor() == other.scaleFactor()
&& rowBytes() == other.rowBytes()
&& hasAlpha() == other.hasAlpha();
}
@@ -105,6 +106,9 @@
diffPixel[p] = static_cast<unsigned char>(pixel);
}
+ // totalPixels is "CSS pixels" or "points".
+ difference.totalPixels /= (scaleFactor() * scaleFactor());
+
return PlatformImage::createFromDiffData(diffBuffer, width, height);
}