Bug 252687 - REGRESSION(257219@main): [GTK] Cursor blinks oddly in text fields, even if blinking disabled
Summary: REGRESSION(257219@main): [GTK] Cursor blinks oddly in text fields, even if bl...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Local Build
Hardware: PC Linux
: P2 Normal
Assignee: Adrian Perez
URL:
Keywords:
Depends on:
Blocks: GTK4
  Show dependency treegraph
 
Reported: 2023-02-21 13:25 PST by Adrian Perez
Modified: 2023-04-14 04:29 PDT (History)
3 users (show)

See Also:


Attachments
Short screencast showing the cursor blinking in DuckDuckGo (11.92 KB, video/webm)
2023-02-21 13:26 PST, Adrian Perez
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.