Skip to content

canvas: Don't include text run without string or font when build_unshaped_text_runs#43717

Merged
yezhizhen merged 3 commits intoservo:mainfrom
yezhizhen:no-push
Mar 27, 2026
Merged

canvas: Don't include text run without string or font when build_unshaped_text_runs#43717
yezhizhen merged 3 commits intoservo:mainfrom
yezhizhen:no-push

Conversation

@yezhizhen
Copy link
Copy Markdown
Member

@yezhizhen yezhizhen commented Mar 27, 2026

As titled. The Vec<UnshapedTextRun> produced by fn build_unshaped_text_runs
is only used by into_shaped_text_run, which filters out those without string or font.

It is better to not allocate them in the first place.

Testing: Try.
Added a Servo-specific crash test to ensure we will not have empty font/string in a text run.

.
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
@yezhizhen yezhizhen requested a review from gterzian as a code owner March 27, 2026 11:53
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Mar 27, 2026
@yezhizhen yezhizhen changed the title canvas: Don't include text run without string or font canvas: Don't include text run without string or font when build_unshaped_text_runs Mar 27, 2026
@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Mar 27, 2026
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Mar 27, 2026
@yezhizhen
Copy link
Copy Markdown
Member Author

Gonna add a crash test for this.

@yezhizhen yezhizhen marked this pull request as draft March 27, 2026 12:48
@yezhizhen yezhizhen marked this pull request as ready for review March 27, 2026 13:13
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
@yezhizhen yezhizhen requested a review from xiaochengh March 27, 2026 13:18
@yezhizhen yezhizhen added this pull request to the merge queue Mar 27, 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 Mar 27, 2026
github-merge-queue Bot pushed a commit that referenced this pull request Mar 27, 2026
…haped_text_runs` (#43717)

As titled. The `Vec<UnshapedTextRun>` produced by `fn
build_unshaped_text_runs`
is only used by `into_shaped_text_run`, which filters out those without
string or font.

It is better to not allocate them in the first place.

Testing: [Try](https://github.com/servo/servo/actions/runs/23642089615).
Added a Servo-specific crash test to ensure we will not have empty
font/string in a text run.

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Merged via the queue into servo:main with commit f80eab7 Mar 27, 2026
30 checks passed
@yezhizhen yezhizhen deleted the no-push branch March 27, 2026 15:39
@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 Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants