Issue #1221: Pass the original element into

nsXMLContentSerializer::CheckElementEnd so that we can properly
determine whether it has children.

This resolves #1221
This commit is contained in:
wolfbeast 2019-08-28 14:39:17 +02:00 committed by Roy Tam
commit f34f8ca034
10 changed files with 46 additions and 13 deletions

View file

@ -1028,6 +1028,7 @@ nsXMLContentSerializer::AppendEndOfElementStart(Element* aElement,
NS_IMETHODIMP
nsXMLContentSerializer::AppendElementEnd(Element* aElement,
Element* aOriginalElement,
nsAString& aStr)
{
NS_ENSURE_ARG(aElement);
@ -1035,7 +1036,7 @@ nsXMLContentSerializer::AppendElementEnd(Element* aElement,
nsIContent* content = aElement;
bool forceFormat = false, outputElementEnd;
outputElementEnd = CheckElementEnd(aElement, forceFormat, aStr);
outputElementEnd = CheckElementEnd(aElement, aOriginalElement, forceFormat, aStr);
nsIAtom *name = content->NodeInfo()->NameAtom();
@ -1161,16 +1162,14 @@ nsXMLContentSerializer::CheckElementStart(nsIContent * aContent,
bool
nsXMLContentSerializer::CheckElementEnd(Element* aElement,
Element* aOriginalElement,
bool& aForceFormat,
nsAString& aStr)
{
// We don't output a separate end tag for empty element
aForceFormat = false;
// XXXbz this is a bit messed up, but by now we don't have our fixed-up
// version of aElement anymore. Let's hope fixup never changes the localName
// or namespace...
return ElementNeedsSeparateEndTag(aElement, aElement);
return ElementNeedsSeparateEndTag(aElement, aOriginalElement);
}
bool