Backout changeset 40b0d61c132b due to bad commit message

This commit is contained in:
Jared Wein
2011-11-10 15:07:10 -08:00
parent 14ab4b599a
commit 52cb6cfb6c
8 changed files with 36 additions and 128 deletions

View File

@@ -652,23 +652,24 @@ ImageDocument::CreateSyntheticDocument()
// the size of the paper and cannot break into continuations along
// multiple pages.
Element* head = GetHeadElement();
NS_ENSURE_TRUE(head, NS_ERROR_FAILURE);
if (!head) {
NS_WARNING("no head on image document!");
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsINodeInfo> nodeInfo;
if (nsContentUtils::IsChildOfSameType(this)) {
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::style, nsnull,
kNameSpaceID_XHTML,
nsIDOMNode::ELEMENT_NODE);
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
nsRefPtr<nsGenericHTMLElement> styleContent = NS_NewHTMLStyleElement(nodeInfo.forget());
NS_ENSURE_TRUE(styleContent, NS_ERROR_OUT_OF_MEMORY);
styleContent->SetTextContent(NS_LITERAL_STRING("img { display: block; }"));
head->AppendChildTo(styleContent, false);
} else {
LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/TopLevelImageDocument.css"));
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::style, nsnull,
kNameSpaceID_XHTML,
nsIDOMNode::ELEMENT_NODE);
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
nsRefPtr<nsGenericHTMLElement> styleContent = NS_NewHTMLStyleElement(nodeInfo.forget());
if (!styleContent) {
return NS_ERROR_OUT_OF_MEMORY;
}
styleContent->SetTextContent(NS_LITERAL_STRING("img { display: block; }"));
head->AppendChildTo(styleContent, false);
// Add the image element
Element* body = GetBodyElement();
if (!body) {