Bug 1744152 - Make the aAllUpperCase parameter of TransformString more generic. r=jfkthame

Bug 1744009 will stop creating frames for <option>s, but will need to
support text-transform on the option strings to calculate the right
intrinsic size for the <select> element.

The reason why we want to calculate the intrinsic size without having
into account the option styles is so that changing the selected option
doesn't change the width of the combobox, which is something that can
happen now.

This is similar to:

  https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/layout/layout_box.cc;l=307;drc=32f574f6df1d37b0d9ed765fe138270414d79e49

This patch will allow to achieve this (and not regress tests like
html/rendering/non-replaced-elements/form-controls/text-transform.html.ini).

Differential Revision: https://phabricator.services.mozilla.com/D132746
This commit is contained in:
Emilio Cobos Álvarez
2021-12-03 11:45:48 +00:00
parent 668a972ce6
commit 2610e02f11
4 changed files with 24 additions and 23 deletions

View File

@@ -9985,7 +9985,7 @@ static void TransformChars(nsTextFrame* aFrame, const nsStyleText* aStyle,
AutoTArray<bool, 50> charsToMergeArray;
AutoTArray<bool, 50> deletedCharsArray;
nsCaseTransformTextRunFactory::TransformString(
fragString, convertedString, /* aAllUppercase = */ false,
fragString, convertedString, /* aGlobalTransform = */ Nothing(),
/* aCaseTransformsOnly = */ true, nullptr, charsToMergeArray,
deletedCharsArray, transformedTextRun, aSkippedOffset);
aOut.Append(convertedString);