Bug 210622

Summary: Oversized caret and selection rects in text fields on ganji.com and netflix.com/login
Product: WebKit Reporter: Wenson Hsieh <wenson_hsieh>
Component: HTML EditingAssignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, bfulgham, darin, esprehn+autocc, ews-watchlist, glenn, kondapallykalyan, megan_gardner, mmaxfield, pdr, rniwa, thorton, webkit-bug-importer, wenson_hsieh, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Not for review
none
Fixes the bug
none
Minimal repro case
none
More rebaselining none

Description Wenson Hsieh 2020-04-16 15:23:36 PDT
<rdar://problem/45945636>
Comment 1 Wenson Hsieh 2020-04-16 15:28:49 PDT Comment hidden (obsolete)
Comment 2 Wenson Hsieh 2020-04-18 00:29:26 PDT Comment hidden (obsolete)
Comment 3 zalan 2020-04-18 06:52:43 PDT
Could you attach a simple test case, please (I can't tell from the test case which div is behaving correctly and which one is not)? I'd like to debug this a bit.
Comment 4 Wenson Hsieh 2020-04-18 07:47:25 PDT
(In reply to zalan from comment #3)
> Could you attach a simple test case, please (I can't tell from the test case
> which div is behaving correctly and which one is not)? I'd like to debug
> this a bit.

Sure! There’s not much to the minimal repro case; it’s just an editable root with a line height larger than the font size.

E.g., data:text/html,<input style="line-height: 10em">

Both when the field is initially focused and when it has text, the caret height should be about the same as the font size. Currently, it is not (the height when the field is empty is the height of the field, and then it changes to be come ≈ font height + (line height / 2) once text is entered.

In my test case, all text fields except for id="vertical” exhibit the undesired behavior.
Comment 5 Wenson Hsieh 2020-04-18 07:48:52 PDT
Created attachment 396847 [details]
Minimal repro case
Comment 6 zalan 2020-04-18 07:51:36 PDT
It looks like the caret is not sitting on the baseline (initially).
Comment 7 Wenson Hsieh 2020-04-18 08:17:51 PDT
Created attachment 396850 [details]
More rebaselining
Comment 8 Wenson Hsieh 2020-04-18 08:18:59 PDT
(In reply to zalan from comment #6)
> It looks like the caret is not sitting on the baseline (initially).

If it helps at all, we go through a different codepath (RenderBoxModelObject::localCaretRectForEmptyElement) when computing the caret rect in this case.
Comment 9 Wenson Hsieh 2020-04-20 08:44:07 PDT
Comment on attachment 396850 [details]
More rebaselining

Thanks for the review!
Comment 10 EWS 2020-04-20 08:53:53 PDT
Committed r260367: <https://trac.webkit.org/changeset/260367>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 396850 [details].
Comment 11 zalan 2022-06-01 08:28:45 PDT
*** Bug 126193 has been marked as a duplicate of this bug. ***