Bug 1803044 - part 4: Make `HTMLEditor::SetAttributeOrEquivalent` insert a white-space only when old value is empty r=m_kato

This causes some new failures after applying the following patches.

Depends on D163998

Differential Revision: https://phabricator.services.mozilla.com/D163999
This commit is contained in:
Masayuki Nakano 2022-12-13 01:48:51 +00:00
Родитель 3cc09e2ecd
Коммит 29bc09a466
1 изменённых файлов: 5 добавлений и 2 удалений

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

@ -5818,9 +5818,12 @@ nsresult HTMLEditor::SetAttributeOrEquivalent(Element* aElement,
if (aAttribute == nsGkAtoms::style) {
// if it is the style attribute, just add the new value to the existing
// style attribute's value
nsAutoString existingValue;
nsString existingValue; // Use nsString to avoid copying the string
// buffer at setting the attribute below.
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::style, existingValue);
existingValue.Append(HTMLEditUtils::kSpace);
if (!existingValue.IsEmpty()) {
existingValue.Append(HTMLEditUtils::kSpace);
}
existingValue.Append(aValue);
if (aSuppressTransaction) {
nsresult rv = aElement->SetAttr(kNameSpaceID_None, nsGkAtoms::style,