diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 11334bfaaa9..60bfd61fc88 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -444,8 +444,6 @@ @BINPATH@/res/EditorOverride.css @BINPATH@/res/contenteditable.css @BINPATH@/res/designmode.css -@BINPATH@/res/TopLevelImageDocument.css -@BINPATH@/res/TopLevelVideoDocument.css @BINPATH@/res/table-add-column-after-active.gif @BINPATH@/res/table-add-column-after-hover.gif @BINPATH@/res/table-add-column-after.gif diff --git a/content/html/document/src/ImageDocument.cpp b/content/html/document/src/ImageDocument.cpp index d75e151c2f9..ea6307bbaf7 100644 --- a/content/html/document/src/ImageDocument.cpp +++ b/content/html/document/src/ImageDocument.cpp @@ -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 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 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 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) { diff --git a/content/html/document/src/MediaDocument.cpp b/content/html/document/src/MediaDocument.cpp index bbd94f0bce3..0ac78cc9780 100644 --- a/content/html/document/src/MediaDocument.cpp +++ b/content/html/document/src/MediaDocument.cpp @@ -243,7 +243,9 @@ MediaDocument::CreateSyntheticDocument() NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY); nsRefPtr root = NS_NewHTMLHtmlElement(nodeInfo.forget()); - NS_ENSURE_TRUE(root, NS_ERROR_OUT_OF_MEMORY); + if (!root) { + return NS_ERROR_OUT_OF_MEMORY; + } NS_ASSERTION(GetChildCount() == 0, "Shouldn't have any kids"); rv = AppendChildTo(root, false); @@ -256,15 +258,20 @@ MediaDocument::CreateSyntheticDocument() // Create a so our title has somewhere to live nsRefPtr head = NS_NewHTMLHeadElement(nodeInfo.forget()); - NS_ENSURE_TRUE(head, NS_ERROR_OUT_OF_MEMORY); + if (!head) { + return NS_ERROR_OUT_OF_MEMORY; + } - nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::meta, nsnull, - kNameSpaceID_XHTML, - nsIDOMNode::ELEMENT_NODE); - NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY); + nsCOMPtr nodeInfoMeta; + nodeInfoMeta = mNodeInfoManager->GetNodeInfo(nsGkAtoms::meta, nsnull, + kNameSpaceID_XHTML, + nsIDOMNode::ELEMENT_NODE); + NS_ENSURE_TRUE(nodeInfoMeta, NS_ERROR_OUT_OF_MEMORY); - nsRefPtr metaContent = NS_NewHTMLMetaElement(nodeInfo.forget()); - NS_ENSURE_TRUE(metaContent, NS_ERROR_OUT_OF_MEMORY); + nsRefPtr metaContent = NS_NewHTMLMetaElement(nodeInfoMeta.forget()); + if (!metaContent) { + return NS_ERROR_OUT_OF_MEMORY; + } metaContent->SetAttr(kNameSpaceID_None, nsGkAtoms::name, NS_LITERAL_STRING("viewport"), true); @@ -282,7 +289,9 @@ MediaDocument::CreateSyntheticDocument() NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY); nsRefPtr body = NS_NewHTMLBodyElement(nodeInfo.forget()); - NS_ENSURE_TRUE(body, NS_ERROR_OUT_OF_MEMORY); + if (!body) { + return NS_ERROR_OUT_OF_MEMORY; + } root->AppendChildTo(body, false); @@ -345,27 +354,6 @@ MediaDocument::GetFileName(nsAString& aResult) } } -nsresult -MediaDocument::LinkStylesheet(const nsAString& aStylesheet) -{ - nsCOMPtr nodeInfo; - nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::link, nsnull, - kNameSpaceID_XHTML, - nsIDOMNode::ELEMENT_NODE); - NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY); - - nsRefPtr link = NS_NewHTMLLinkElement(nodeInfo.forget()); - NS_ENSURE_TRUE(link, NS_ERROR_OUT_OF_MEMORY); - - link->SetAttr(kNameSpaceID_None, nsGkAtoms::rel, - NS_LITERAL_STRING("stylesheet"), true); - - link->SetAttr(kNameSpaceID_None, nsGkAtoms::href, aStylesheet, true); - - Element* head = GetHeadElement(); - return head->AppendChildTo(link, false); -} - void MediaDocument::UpdateTitleAndCharset(const nsACString& aTypeStr, const char* const* aFormatNames, diff --git a/content/html/document/src/MediaDocument.h b/content/html/document/src/MediaDocument.h index fee8cd9fe40..ccedd9feff6 100644 --- a/content/html/document/src/MediaDocument.h +++ b/content/html/document/src/MediaDocument.h @@ -72,8 +72,6 @@ protected: void GetFileName(nsAString& aResult); - nsresult LinkStylesheet(const nsAString& aStylesheet); - // |aFormatNames[]| needs to have four elements in the following order: // a format name with neither dimension nor file, a format name with // filename but w/o dimension, a format name with dimension but w/o filename, diff --git a/content/html/document/src/VideoDocument.cpp b/content/html/document/src/VideoDocument.cpp index 8a480d74c44..9854e7d0a95 100644 --- a/content/html/document/src/VideoDocument.cpp +++ b/content/html/document/src/VideoDocument.cpp @@ -135,9 +135,10 @@ VideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel, true); } else { Element* head = GetHeadElement(); - NS_ENSURE_TRUE(head, NS_ERROR_FAILURE); - - LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/TopLevelVideoDocument.css")); + if (!head) { + NS_WARNING("no head on video document!"); + return NS_ERROR_FAILURE; + } nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::style, nsnull, kNameSpaceID_XHTML, diff --git a/layout/style/Makefile.in b/layout/style/Makefile.in index 4e8a9c2cb04..7f3f6f08c50 100644 --- a/layout/style/Makefile.in +++ b/layout/style/Makefile.in @@ -167,8 +167,6 @@ LOCAL_INCLUDES = \ _FILES = \ contenteditable.css \ designmode.css \ - TopLevelImageDocument.css \ - TopLevelVideoDocument.css \ $(NULL) GARBAGE += $(addprefix $(DIST)/bin/res/,$(_FILES)) diff --git a/layout/style/TopLevelImageDocument.css b/layout/style/TopLevelImageDocument.css deleted file mode 100644 index 54151c22e8c..00000000000 --- a/layout/style/TopLevelImageDocument.css +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla.org code. - * - * Contributor(s): - * Carlo Alberto Ferraris - * Jared Wein - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -/* - This CSS stylesheet defines the rules to be applied to ImageDocuments that - are top level (e.g. not iframes). -*/ diff --git a/layout/style/TopLevelVideoDocument.css b/layout/style/TopLevelVideoDocument.css deleted file mode 100644 index ebf0ba3310c..00000000000 --- a/layout/style/TopLevelVideoDocument.css +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla.org code. - * - * Contributor(s): - * Carlo Alberto Ferraris - * Jared Wein - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -/* - This CSS stylesheet defines the rules to be applied to VideoDocuments that - are top level (e.g. not iframes). -*/