Skip to content

layout: Give caret and text selection rectangles a consistent height / position - #47937

Merged
jdm merged 1 commit into
servo:mainfrom
mrobinson:selection-consistent-caret-and-rect-height
Sep 16, 2026
Merged

jdm merged 1 commit into
servo:mainfrom
mrobinson:selection-consistent-caret-and-rect-height

Conversation

@mrobinson

Copy link
Copy Markdown
Member

This change ensures that visible selection rectangles and carets have a
consistent height:

  • Selection rectangles paint the entire height of the line box so the
    rectangle height should be consistent across the entire selected
    contents of the line.
  • Carets now paint the line gap height of the font metrics of the
    text fragment they are attached to.

From a high level, this behavior matches Chromium.

Testing: This change adds a Servo-specific WPT-style text.
Fixes: #36924.
Fixes: #47553.

@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Sep 9, 2026
…/ position

This change ensures that visible selection rectangles and carets have a
consistent height:

 - Selection rectangles paint the entire height of the line box so the
   rectangle height should be consistent across the entire selected
   contents of the line.
 - Carets now paint the line gap height of the font metrics of the
   text fragment they are attached to.

From a high level, this behavior matches Chromium.

Signed-off-by: Martin Robinson <[email protected]>
@mrobinson
mrobinson force-pushed the selection-consistent-caret-and-rect-height branch from fb8d624 to 5598a52 Compare September 11, 2026 04:47
@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Sep 15, 2026
@mrobinson
mrobinson added this pull request to the merge queue Sep 15, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Sep 15, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 15, 2026
@servo-highfive servo-highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Sep 15, 2026
@jdm
jdm added this pull request to the merge queue Sep 16, 2026
@servo-highfive servo-highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Sep 16, 2026
Merged via the queue into servo:main with commit 9773ece Sep 16, 2026
39 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Sep 16, 2026
RichardTjokroutomo pushed a commit to RichardTjokroutomo/servo that referenced this pull request Oct 6, 2026
…/ position (servo#47937)

This change ensures that visible selection rectangles and carets have a
consistent height:

 - Selection rectangles paint the entire height of the line box so the
   rectangle height should be consistent across the entire selected
   contents of the line.
 - Carets now paint the line gap height of the font metrics of the
   text fragment they are attached to.

From a high level, this behavior matches Chromium.

Testing: This change adds a Servo-specific WPT-style text.
Fixes: servo#36924.
Fixes: servo#47553.

Signed-off-by: Martin Robinson <[email protected]>
hhhwsqhhh pushed a commit to hhhwsqhhh/servo that referenced this pull request Oct 12, 2026
…/ position (servo#47937)

This change ensures that visible selection rectangles and carets have a
consistent height:

 - Selection rectangles paint the entire height of the line box so the
   rectangle height should be consistent across the entire selected
   contents of the line.
 - Carets now paint the line gap height of the font metrics of the
   text fragment they are attached to.

From a high level, this behavior matches Chromium.

Testing: This change adds a Servo-specific WPT-style text.
Fixes: servo#36924.
Fixes: servo#47553.

Signed-off-by: Martin Robinson <[email protected]>
@mrobinson
mrobinson deleted the selection-consistent-caret-and-rect-height branch November 21, 2026 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Text selection not drawn at correct y position when CSS line-height is set Abnormal caret height for enlarged text input element

4 participants