Bug 1880996 - Check for zero-length text in nsBidiPresUtils::ProcessSimpleRun. r=dholbert

In the example here, failing to check for an empty string was resulting
in lots of extra work to set up for drawing a shadow, etc., even though
nothing ends up being rendered. Just bail out early if there's no text.

Differential Revision: https://phabricator.services.mozilla.com/D202630
This commit is contained in:
Jonathan Kew 2024-02-23 21:25:55 +00:00
Родитель 3087118fc8
Коммит d80cf90364
1 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

@ -2363,6 +2363,9 @@ void nsBidiPresUtils::ProcessSimpleRun(const char16_t* aText, size_t aLength,
nsBidiPositionResolve* aPosResolve,
int32_t aPosResolveCount,
nscoord* aWidth) {
if (!aLength) {
return;
}
// Get bidi class from the first (or only) character.
uint32_t ch = aText[0];
if (aLength > 1 && NS_IS_HIGH_SURROGATE(ch) &&