mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1123062 - Fall back to looking at the tag for determining if an element is preformatted when there is no style information available; r=bzbarsky
This commit is contained in:
parent
eefcf4a572
commit
a86eb34a03
@ -1774,7 +1774,8 @@ nsPlainTextSerializer::IsElementPreformatted(Element* aElement)
|
||||
const nsStyleText* textStyle = styleContext->StyleText();
|
||||
return textStyle->WhiteSpaceOrNewlineIsSignificant();
|
||||
}
|
||||
return false;
|
||||
// Fall back to looking at the tag, in case there is no style information.
|
||||
return GetIdForContent(aElement) == nsGkAtoms::pre;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -114,6 +114,29 @@ TestPrettyPrintedHtml()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
TestPreElement()
|
||||
{
|
||||
nsString test;
|
||||
test.AppendLiteral(
|
||||
"<html>" NS_LINEBREAK
|
||||
"<body>" NS_LINEBREAK
|
||||
"<pre>" NS_LINEBREAK
|
||||
" first" NS_LINEBREAK
|
||||
" second" NS_LINEBREAK
|
||||
"</pre>" NS_LINEBREAK
|
||||
"</body>" NS_LINEBREAK "</html>");
|
||||
|
||||
ConvertBufToPlainText(test, 0);
|
||||
if (!test.EqualsLiteral(" first" NS_LINEBREAK " second" NS_LINEBREAK NS_LINEBREAK)) {
|
||||
fail("Wrong prettyprinted html to text serialization");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
passed("prettyprinted HTML to text serialization test");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
TestPlainTextSerializer()
|
||||
{
|
||||
@ -137,6 +160,9 @@ TestPlainTextSerializer()
|
||||
rv = TestPrettyPrintedHtml();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = TestPreElement();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Add new tests here...
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user