Bug 232384

Summary: [ iOS iPhone 12 ] fast/hidpi & fast/layers/hidpi tests are flaky text/image failing
Product: WebKit Reporter: ayumi_kojima
Component: New BugsAssignee: zalan <zalan>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, Morningstar, webkit-bot-watchers-bugzilla, webkit-bug-importer, wenson_hsieh, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: iPhone / iPad   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=232310
https://bugs.webkit.org/show_bug.cgi?id=132766
https://bugs.webkit.org/show_bug.cgi?id=232465
Attachments:
Description Flags
Image diff
none
Test list (reproduced image failures)
none
Test list (Didn't reproduce the image failure)
none
Patch none

Description ayumi_kojima 2021-10-27 09:38:23 PDT
fast/hidpi/filters-blur.html
fast/hidpi/filters-hue-rotate.html
fast/hidpi/filters-invert.html
fast/hidpi/filters-multiple.html
fast/hidpi/filters-reference.html
fast/hidpi/image-set-gradient-multi.html
fast/hidpi/pdf-image-scaled.html

Are flaky image failing on iOS 15 sim iPhone 12.

fast/hidpi/image-srcset-simple-1x.html
fast/hidpi/image-srcset-simple-in-variable-1x.html

Are flaky text failing on iOS 15 sim Release & Debug iPhone 12.

History: https://results.webkit.org/?suite=layout-tests&suite=layout-tests&suite=layout-tests&suite=layout-tests&suite=layout-tests&suite=layout-tests&suite=layout-tests&suite=layout-tests&suite=layout-tests&test=fast%2Fhidpi%2Ffilters-blur.html&test=fast%2Fhidpi%2Ffilters-hue-rotate.html&test=fast%2Fhidpi%2Ffilters-invert.html&test=fast%2Fhidpi%2Ffilters-multiple.html&test=fast%2Fhidpi%2Ffilters-reference.html&test=fast%2Fhidpi%2Fimage-set-gradient-multi.html&test=fast%2Fhidpi%2Fimage-srcset-simple-1x.html&test=fast%2Fhidpi%2Fimage-srcset-simple-in-variable-1x.html&test=fast%2Fhidpi%2Fpdf-image-scaled.html 

Result page: https://build.webkit.org/results/Apple-iOS-15-Simulator-Debug-WK2-Tests/r284918%20(310)/results.html#

Diff:

--- /Volumes/Data/worker/ios-simulator-15-debug-tests-wk2/build/layout-test-results/fast/hidpi/image-srcset-simple-1x-expected.txt
+++ /Volumes/Data/worker/ios-simulator-15-debug-tests-wk2/build/layout-test-results/fast/hidpi/image-srcset-simple-1x-actual.txt
@@ -1,3 +1,3 @@
-PASS document.getElementById("foo").clientWidth==400 is true
+FAIL document.getElementById("foo").clientWidth==400 should be true. Was false.
 This test passes if the image below says 1x with a reddish background when the deviceScaleFactor is 1, and if says 2x with a greenish background when the deviceScaleFactor is 2.

fast/inline-block/hidpi-margin-top-with-subpixel-value-and-overflow-hidden.html
fast/layers/hidpi-box-positioned-off-by-one-when-transform-is-present.html
fast/layers/hidpi-floor-negative-coordinate-values-to-maintain-rounding-direction.html
fast/layers/hidpi-nested-layers-with-subpixel-accumulation.html
fast/layers/hidpi-transform-on-child-content-is-mispositioned.html

Are flaky image failing on iOS 15 sim Debug on iPhone 12.

History: https://results.webkit.org/?suite=layout-tests&suite=layout-tests&suite=layout-tests&suite=layout-tests&suite=layout-tests&test=fast%2Finline-block%2Fhidpi-margin-top-with-subpixel-value-and-overflow-hidden.html&test=fast%2Flayers%2Fhidpi-box-positioned-off-by-one-when-transform-is-present.html&test=fast%2Flayers%2Fhidpi-floor-negative-coordinate-values-to-maintain-rounding-direction.html&test=fast%2Flayers%2Fhidpi-nested-layers-with-subpixel-accumulation.html&test=fast%2Flayers%2Fhidpi-transform-on-child-content-is-mispositioned.html

Result page: https://build.webkit.org/results/Apple-iOS-15-Simulator-Debug-WK2-Tests/r284918%20(310)/results.html
Comment 1 ayumi_kojima 2021-10-27 09:42:31 PDT
All those tests seem to have started being flaky somewhere between r284876 - r284887.
Comment 2 Radar WebKit Bug Importer 2021-10-27 09:42:51 PDT
<rdar://problem/84714121>
Comment 3 ayumi_kojima 2021-10-27 10:26:03 PDT
Created attachment 442604 [details]
Image diff
Comment 4 ayumi_kojima 2021-10-27 10:27:33 PDT
I was able to reproduce the failure at TOT on iOS 15 sim using run-webkit-tests --ios-simulator --exit-after-n-failures 500 --child-processes 1 --test-list <test list>.
Comment 5 ayumi_kojima 2021-10-27 11:53:25 PDT
Created attachment 442619 [details]
Test list (reproduced image failures)
Comment 6 ayumi_kojima 2021-10-27 11:56:03 PDT
Test list that doesn't include fast/events/ios/rotation/ tests didn't reproduce the image failures. 

Also, the image failures only occur on iPhone 12. When I tried on iPhone SE (2nd gen),  I was not able to reproduce the image failures.
Comment 7 ayumi_kojima 2021-10-27 11:57:34 PDT
Created attachment 442620 [details]
Test list (Didn't reproduce the image failure)
Comment 8 ayumi_kojima 2021-10-27 14:10:48 PDT
The same image failure is seen on macOS (Bug 132766).
Comment 9 Dawn Morningstar 2022-03-07 15:38:28 PST
This failure is continuing to happen, expectations may need to be set.
Comment 10 Dawn Morningstar 2022-03-14 08:46:41 PDT
(In reply to Matteo Flores from comment #9)
> This failure is continuing to happen, expectations may need to be set.

Set expectations r291230
Comment 11 zalan 2022-04-07 16:42:03 PDT
I can repro it with
run-webkit-test --ios-simulator fast/events/ios/rotation/safe-area-insets-during-safari-type-rotation.html fast/hidpi/image-srcset-simple-1x.html
All it needs is just a rotation test.
Comment 12 zalan 2022-04-11 10:17:19 PDT
Apparently we see deviceScaleFactor == 3 in the test (fast/hidpi/image-srcset-simple-1x.html) when the rotation test runs first.
Comment 13 zalan 2022-04-11 10:57:37 PDT
screenScaleFactor(UIScreen *screen) comes back with 3. Test passes fine when this value is hardcoded to 2.
Comment 14 zalan 2022-04-11 11:51:42 PDT
[[UIScreen mainScreen] _setScale:2.0]; is called in TestController::platformInitialize but not in-between tests.

diff --git a/Tools/WebKitTestRunner/ios/TestControllerIOS.mm b/Tools/WebKitTestRunner/ios/TestControllerIOS.mm
index 13c0e9ba6752..142a2c119530 100644
--- a/Tools/WebKitTestRunner/ios/TestControllerIOS.mm
+++ b/Tools/WebKitTestRunner/ios/TestControllerIOS.mm
@@ -158,6 +158,7 @@ bool TestController::platformResetStateToConsistentValues(const TestOptions& opt
   [pasteboardConsistencyEnforcer() clearPasteboard];
   [[UIApplication sharedApplication] _cancelAllTouches];
   [[UIDevice currentDevice] setOrientation:UIDeviceOrientationPortrait animated:NO];
+  [[UIScreen mainScreen] _setScale:2.0];
 
^^ fixes the test failure.
Comment 15 zalan 2022-04-11 12:18:33 PDT
Created attachment 457278 [details]
Patch
Comment 16 EWS 2022-04-11 17:45:00 PDT
Committed r292749 (249533@main): <https://commits.webkit.org/249533@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 457278 [details].
Comment 17 Alexey Proskuryakov 2022-04-25 16:24:30 PDT
*** Bug 232465 has been marked as a duplicate of this bug. ***