You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Abnormal caret height for enlarged text input element #36924
For an "editable" element, if we enlarge the line-height of the element, we will get quite an unexpected caret height.
For example, observe the following <input style="line-height: 500px; height: 500px;"></input> in Servo.
Note that is a possible example in a current Servo due to the current implementation of HTMLInputElement.
As I perceive it, caret height seems to depend fully on inline block height right now. I suppose we could made it depends on font metrics as well, possibly font strut.
cc: @dklassic might be interested to look at this.
Yes it currently uses the full height. I think I implemented this way because due to how we currently render the caret alongside the text, and that each TextFragment might have different height and base offset, leading to jumping caret between different fonts.
I’m not sure if this is something that should be changed on the font rendering side or maybe we should have a fixed caret range given somehow.
Activity
dklassic commentedon May 9, 2025
Yes it currently uses the full height. I think I implemented this way because due to how we currently render the caret alongside the text, and that each TextFragment might have different height and base offset, leading to jumping caret between different fonts.
I’m not sure if this is something that should be changed on the font rendering side or maybe we should have a fixed caret range given somehow.
mrobinson commentedon Mar 10, 2026
Probably what we should do here is when laying out a line, we should calculate a maximum length for the caret / selection.
layout: Give caret and text selection rectangles a consistent height …
layout: Give caret and text selection rectangles a consistent height …
layout: Give caret and text selection rectangles a consistent height …