Bug 246844

Summary: REGRESSION(cairo 1.17.6)[WinCairo] rendering glitches of twitter.com and yahoo.co.jp
Product: WebKit Reporter: Fujii Hironori <Hironori.Fujii>
Component: PlatformAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: don.olmstead
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=248014
Attachments:
Description Flags
Patch to disable async image decoding
none
test case none

Description Fujii Hironori 2022-10-20 20:40:05 PDT
[WinCairo] some text aren't painted in 150% page zoom scale factor in twitter

https://twitter.com/PlayStation_jp/status/1582356592640475136
https://twitter.com/AppleMusicJapan/status/1581977079276789761
https://twitter.com/NiziU__official/status/1583276886855192577

Changing the page zoom scale factor resolved the problem.
It seems that this issue is happening for tweets containing Japanese text, English texts and an image.
Comment 1 Fujii Hironori 2022-10-20 20:41:27 PDT
This seems a regression between the following revision range:

WinCairo 254165@main OK
WinCairo 254443@main Bad
Comment 2 Fujii Hironori 2022-10-20 22:25:07 PDT
This issue seems reproducible in https://www.yahoo.co.jp/ .
1. Start WinCairo MiniBrowser with 150% page zoom.
   WinCairo MiniBrowser adjusts the initial page zoom because it doesn't support device scale factor.
   If you use 150% DPI display, WinCairo MiniBrowser uses 150% page zoom by default.
2. Load https://www.yahoo.co.jp/
3. Moving the cursor on the page while scrolling the page with the mouse wheel.
Comment 3 Fujii Hironori 2022-10-20 23:12:04 PDT
Both twitter.com and yahoo.co.jp issues are reproducible with WinCairo WK1.
Comment 4 Fujii Hironori 2022-10-21 01:16:16 PDT
This is not a WebKit regression.
WebKitRequirementsWin64.zip v2022.03.05 cairo.dll works fine.
v2022.09.06 and v2022.10.20 has this bug.
Comment 5 Fujii Hironori 2022-10-21 14:23:16 PDT
I built Cairo with Meson locally.

Cairo 1.17.4: Good
Cairo 1.17.6: Bad
Cairo latest (2cfd08664): Bad

This seems like a Cairo 1.17.6 regression.
I'm going to bisect.
Comment 6 Fujii Hironori 2022-10-23 21:40:55 PDT
This is happening after the following commit.

atomic: Add support for WIN32 atomic operations (cd2b91c6) · Commits · cairo / cairo · GitLab
https://gitlab.freedesktop.org/cairo/cairo/-/commit/cd2b91c62ea74f6448a8a5cff5dd316f8e692e97
Comment 7 Fujii Hironori 2022-10-24 18:54:07 PDT
Cairo bug ticket: https://gitlab.freedesktop.org/cairo/cairo/-/issues/598
Comment 8 Fujii Hironori 2022-10-26 14:23:37 PDT
This bug disappears for WinCairo WK2 if I enable UseGPUProcessForDOMRenderingEnabled (bug#246733).
Comment 9 Fujii Hironori 2022-10-26 17:30:05 PDT
cairo_surface_destroy is called in ImageDecoder thread.

Here is the callstack (taken by WinCairo WK1):

> WebKit.dll!WTF::DefaultRefDerefTraits<_cairo_surface>::derefIfNotNull(_cairo_surface * ptr) Line 52	C++
> WebKit.dll!WTF::RefPtr<_cairo_surface,WTF::RawPtrTraits<_cairo_surface>,WTF::DefaultRefDerefTraits<_cairo_surface>>::~RefPtr<_cairo_surface,WTF::RawPtrTraits<_cairo_surface>,WTF::DefaultRefDerefTraits<_cairo_surface>>() Line 74	C++
> WebKit.dll!WebCore::ImageBackingStore::image() Line 44	C++
> WebKit.dll!WebCore::ScalableImageDecoder::createFrameImageAtIndex(unsigned __int64 index, WebCore::SubsamplingLevel __formal, const WebCore::DecodingOptions & __formal) Line 275	C++
> WebKit.dll!WebCore::ImageSource::startAsyncDecodingQueue::__l2::<lambda_1>::operator()() Line 364	C++
> WebKit.dll!WTF::Detail::CallableWrapper<`WebCore::ImageSource::startAsyncDecodingQueue'::`2'::<lambda_1>,void>::call() Line 53	C++
> WTF.dll!WTF::Function<void __cdecl(void)>::operator()() Line 83	C++
> WTF.dll!WTF::WorkQueueBase::dispatch::__l2::<lambda_1>::operator()() Line 70	C++
> WTF.dll!WTF::Detail::CallableWrapper<`WTF::WorkQueueBase::dispatch'::`2'::<lambda_1>,void>::call() Line 53	C++
> WTF.dll!WTF::Function<void __cdecl(void)>::operator()() Line 83	C++
> WTF.dll!WTF::RunLoop::performWork() Line 147	C++
> WTF.dll!WTF::RunLoop::wndProc(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 57	C++
> WTF.dll!WTF::RunLoop::RunLoopWndProc(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 39	C++
> [External Code]	
> WTF.dll!WTF::RunLoop::run() Line 74	C++
> WTF.dll!WTF::RunLoop::create::__l2::<lambda_1>::operator()() Line 114	C++
> WTF.dll!WTF::Detail::CallableWrapper<`WTF::RunLoop::create'::`2'::<lambda_1>,void>::call() Line 53	C++
> WTF.dll!WTF::Function<void __cdecl(void)>::operator()() Line 83	C++
> WTF.dll!WTF::Thread::entryPoint(WTF::Thread::NewThreadContext * newThreadContext) Line 251	C++
> WTF.dll!WTF::wtfThreadEntryPoint(void * data) Line 151	C++
> [External Code]
Comment 10 Fujii Hironori 2022-10-27 22:03:05 PDT
Created attachment 463290 [details]
Patch to disable async image decoding

I hacked WinCairo WK1 to disable async image decoding.
But, this bug is still happening.
Comment 11 Fujii Hironori 2022-10-30 17:48:01 PDT
Created attachment 463316 [details]
test case
Comment 12 Fujii Hironori 2022-10-30 19:13:49 PDT
Both twitter.com and yahoo.co.jp have a text with font-size:0 and a text decoration.
twitter.com hides "https://". yahoo.co.jp hides a text of arrow icons of the real time search trend.
Comment 14 Fujii Hironori 2022-11-16 18:18:50 PST
This bug hasn't been reprodusible for WinCairo WK2 since 256189@main turned on UseGPUProcessForDOMRenderingEnabled.
WinCairo WK1 still can replicate.