Bug 252687

Summary: REGRESSION(257219@main): [GTK] Cursor blinks oddly in text fields, even if blinking disabled
Product: WebKit Reporter: Adrian Perez <aperez>
Component: WebKitGTKAssignee: Adrian Perez <aperez>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply, cgarcia, mcatanzaro
Priority: P2    
Version: WebKit Local Build   
Hardware: PC   
OS: Linux   
See Also: https://bugs.webkit.org/show_bug.cgi?id=248112
Bug Depends on:    
Bug Blocks: 210100    
Attachments:
Description Flags
Short screencast showing the cursor blinking in DuckDuckGo none

Description Adrian Perez 2023-02-21 13:25:03 PST
Steps to reproduce:

 1. Build WebKit from “main” using “-DPORT=GTK -DUSE_GTK4=ON”
 2. Open the URL data:text/html,<input>
 3. Focus the input element

Expected: Cursor blinks at the rate indicated by GTK, for example
  by configuring “Cursor Blinking” in the Accessibility page in
  GNOME Settings

Actual outcome: Cursor blinks oddly fast, no matter the setting.
Comment 1 Adrian Perez 2023-02-21 13:26:41 PST
Created attachment 465114 [details]
Short screencast showing the cursor blinking in DuckDuckGo

Here's a short screencast of the issue in the input field from https://ddg.gg
(the issue is reproducible in all input fields, though.)
Comment 2 Adrian Perez 2023-03-12 14:56:55 PDT
Happens with a GTK3 build from the webkitglib/2.40 branch, too.
Comment 3 Adrian Perez 2023-04-14 01:34:17 PDT
I have started to investigate this a bit, it seems nothing is calling
RenderTheme{Adwaita,Gtk}::caretBlinkInterval(), so of course the GTK
settings are never taken into account. The culprit seems to be 257219@main
which removed a call to RenderTheme::singleton().caretBlinkInterval().
Comment 4 Adrian Perez 2023-04-14 01:51:54 PDT
(In reply to Adrian Perez from comment #3)
> I have started to investigate this a bit, it seems nothing is calling
> RenderTheme{Adwaita,Gtk}::caretBlinkInterval(), so of course the GTK
> settings are never taken into account. The culprit seems to be 257219@main
> which removed a call to RenderTheme::singleton().caretBlinkInterval().

Actually, RenderThemeGtk::caretBlinkInterval() does get called from
inside SimpleCaretAnimator, but RenderThemeAdwaita::caretBlinkInterval()
does not, and it is useless because both have the same implementation
duplicated. I think we can just keep the one from RenderThemeAdwaita
with an USE(GTK) guard to determine whether to read the GTK settings,
and provide some hardcoded defaults to be used by WPE.

At least one of the issues is that with blinking disabled caretBlinkInterval()
returns zero, so the SimpleCaretAnimator is scheduling an update of the cursor
every zero seconds, resulting in the oddly fast blinking.
Comment 5 Adrian Perez 2023-04-14 02:37:21 PDT
Pull request: https://github.com/WebKit/WebKit/pull/12737
Comment 6 EWS 2023-04-14 04:29:50 PDT
Committed 262954@main (6a0a83593474): <https://commits.webkit.org/262954@main>

Reviewed commits have been landed. Closing PR #12737 and removing active labels.