зеркало из https://github.com/mozilla/gecko-dev.git
Bug 952973: Perform some content/base decom r=bz
This commit is contained in:
Родитель
93ba1b0ab7
Коммит
ec7579cad8
|
@ -18,7 +18,6 @@
|
|||
#include "nsEventStates.h" // for member
|
||||
#include "mozilla/dom/DirectionalityUtils.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMDocumentFragment.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsNodeUtils.h"
|
||||
#include "nsAttrAndChildArray.h"
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "nsDOMString.h"
|
||||
#include "nsIContentInlines.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMUserDataHandler.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "nsIDocumentInlines.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIContentIterator.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsFocusManager.h"
|
||||
|
@ -87,7 +86,6 @@
|
|||
|
||||
#include "nsNodeInfoManager.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsIDOMDocumentType.h"
|
||||
#include "nsIDOMUserDataHandler.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIEditor.h"
|
||||
|
@ -2704,18 +2702,15 @@ FragmentOrElement::SetInnerHTMLInternal(const nsAString& aInnerHTML, ErrorResult
|
|||
nsContentUtils::FireMutationEventsForDirectParsing(doc, target,
|
||||
oldChildCount);
|
||||
} else {
|
||||
nsCOMPtr<nsIDOMDocumentFragment> df;
|
||||
aError = nsContentUtils::CreateContextualFragment(target, aInnerHTML,
|
||||
true,
|
||||
getter_AddRefs(df));
|
||||
nsCOMPtr<nsINode> fragment = do_QueryInterface(df);
|
||||
nsRefPtr<DocumentFragment> df =
|
||||
nsContentUtils::CreateContextualFragment(target, aInnerHTML, true, aError);
|
||||
if (!aError.Failed()) {
|
||||
// Suppress assertion about node removal mutation events that can't have
|
||||
// listeners anyway, because no one has had the chance to register mutation
|
||||
// listeners on the fragment that comes from the parser.
|
||||
nsAutoScriptBlockerSuppressNodeRemoved scriptBlocker;
|
||||
|
||||
static_cast<nsINode*>(target)->AppendChild(*fragment, aError);
|
||||
static_cast<nsINode*>(target)->AppendChild(*df, aError);
|
||||
mb.NodesAdded();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMDragEvent.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIDOMHTMLAreaElement.h"
|
||||
|
@ -52,6 +51,7 @@
|
|||
#include "imgIRequest.h"
|
||||
#include "nsDOMDataTransfer.h"
|
||||
#include "nsIMIMEInfo.h"
|
||||
#include "nsRange.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/HTMLAreaElement.h"
|
||||
|
||||
|
@ -339,20 +339,17 @@ void
|
|||
DragDataProducer::GetNodeString(nsIContent* inNode,
|
||||
nsAString & outNodeString)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(inNode);
|
||||
nsCOMPtr<nsINode> node = inNode;
|
||||
|
||||
outNodeString.Truncate();
|
||||
|
||||
// use a range to get the text-equivalent of the node
|
||||
nsCOMPtr<nsIDOMDocument> doc;
|
||||
node->GetOwnerDocument(getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIDOMRange> range;
|
||||
doc->CreateRange(getter_AddRefs(range));
|
||||
if (range) {
|
||||
range->SelectNode(node);
|
||||
range->ToString(outNodeString);
|
||||
}
|
||||
nsCOMPtr<nsIDocument> doc = node->OwnerDoc();
|
||||
mozilla::ErrorResult rv;
|
||||
nsRefPtr<nsRange> range = doc->CreateRange(rv);
|
||||
if (range) {
|
||||
range->SelectNode(*node, rv);
|
||||
range->ToString(outNodeString);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ static nsresult AppendString(nsITransferable *aTransferable,
|
|||
|
||||
// copy HTML node data
|
||||
static nsresult AppendDOMNode(nsITransferable *aTransferable,
|
||||
nsIDOMNode *aDOMNode);
|
||||
nsINode* aDOMNode);
|
||||
|
||||
// Helper used for HTMLCopy and GetTransferableForSelection since both routines
|
||||
// share common code.
|
||||
|
@ -421,7 +421,7 @@ nsCopySupport::ImageCopy(nsIImageLoadingContent* aImageElement,
|
|||
|
||||
if (aCopyFlags & nsIContentViewerEdit::COPY_IMAGE_HTML) {
|
||||
// append HTML data to the transferable
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(aImageElement, &rv));
|
||||
nsCOMPtr<nsINode> node(do_QueryInterface(aImageElement, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = AppendDOMNode(trans, node);
|
||||
|
@ -486,37 +486,33 @@ static nsresult AppendString(nsITransferable *aTransferable,
|
|||
}
|
||||
|
||||
static nsresult AppendDOMNode(nsITransferable *aTransferable,
|
||||
nsIDOMNode *aDOMNode)
|
||||
nsINode *aDOMNode)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
||||
// selializer
|
||||
nsCOMPtr<nsIDocumentEncoder>
|
||||
docEncoder(do_CreateInstance(NS_HTMLCOPY_ENCODER_CONTRACTID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// get document for the encoder
|
||||
nsCOMPtr<nsIDOMDocument> domDocument;
|
||||
rv = aDOMNode->GetOwnerDocument(getter_AddRefs(domDocument));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDocument> document(do_QueryInterface(domDocument, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDocument> document = aDOMNode->OwnerDoc();
|
||||
|
||||
// Note that XHTML is not counted as HTML here, because we can't copy it
|
||||
// properly (all the copy code for non-plaintext assumes using HTML
|
||||
// serializers and parsers is OK, and those mess up XHTML).
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(domDocument, &rv);
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(document, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, NS_OK);
|
||||
|
||||
NS_ENSURE_TRUE(document->IsHTML(), NS_OK);
|
||||
|
||||
// init encoder with document and node
|
||||
rv = docEncoder->Init(domDocument, NS_LITERAL_STRING(kHTMLMime),
|
||||
nsIDocumentEncoder::OutputAbsoluteLinks |
|
||||
nsIDocumentEncoder::OutputEncodeW3CEntities);
|
||||
rv = docEncoder->NativeInit(document, NS_LITERAL_STRING(kHTMLMime),
|
||||
nsIDocumentEncoder::OutputAbsoluteLinks |
|
||||
nsIDocumentEncoder::OutputEncodeW3CEntities);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = docEncoder->SetNode(aDOMNode);
|
||||
rv = docEncoder->SetNativeNode(aDOMNode);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// serialize to string
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "nsError.h"
|
||||
#include "nsIContentInlines.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsNodeInfoManager.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "nsIDocument.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsDataDocumentContentPolicy, nsIContentPolicy)
|
||||
|
||||
|
@ -50,11 +49,9 @@ nsDataDocumentContentPolicy::ShouldLoad(uint32_t aContentType,
|
|||
if (node) {
|
||||
doc = node->OwnerDoc();
|
||||
} else {
|
||||
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(aRequestingContext);
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aRequestingContext);
|
||||
if (window) {
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
window->GetDocument(getter_AddRefs(domDoc));
|
||||
doc = do_QueryInterface(domDoc);
|
||||
doc = window->GetDoc();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -627,8 +627,7 @@ static void
|
|||
FirePageHideEvent(nsIDocShellTreeItem* aItem,
|
||||
EventTarget* aChromeEventHandler)
|
||||
{
|
||||
nsCOMPtr<nsIDOMDocument> doc = do_GetInterface(aItem);
|
||||
nsCOMPtr<nsIDocument> internalDoc = do_QueryInterface(doc);
|
||||
nsCOMPtr<nsIDocument> internalDoc = do_GetInterface(aItem);
|
||||
NS_ASSERTION(internalDoc, "What happened here?");
|
||||
internalDoc->OnPageHide(true, aChromeEventHandler);
|
||||
|
||||
|
@ -670,8 +669,7 @@ FirePageShowEvent(nsIDocShellTreeItem* aItem,
|
|||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> doc = do_GetInterface(aItem);
|
||||
nsCOMPtr<nsIDocument> internalDoc = do_QueryInterface(doc);
|
||||
nsCOMPtr<nsIDocument> internalDoc = do_GetInterface(aItem);
|
||||
NS_ASSERTION(internalDoc, "What happened here?");
|
||||
if (internalDoc->IsShowing() == aFireIfShowing) {
|
||||
internalDoc->OnPageShow(true, aChromeEventHandler);
|
||||
|
@ -2195,16 +2193,14 @@ nsFrameLoader::CreateStaticClone(nsIFrameLoader* aDest)
|
|||
dest->MaybeCreateDocShell();
|
||||
NS_ENSURE_STATE(dest->mDocShell);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> dummy = do_GetInterface(dest->mDocShell);
|
||||
nsCOMPtr<nsIDocument> dummy = do_GetInterface(dest->mDocShell);
|
||||
nsCOMPtr<nsIContentViewer> viewer;
|
||||
dest->mDocShell->GetContentViewer(getter_AddRefs(viewer));
|
||||
NS_ENSURE_STATE(viewer);
|
||||
|
||||
nsCOMPtr<nsIDocShell> origDocShell;
|
||||
GetDocShell(getter_AddRefs(origDocShell));
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_GetInterface(origDocShell);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
|
||||
nsCOMPtr<nsIDocument> doc = do_GetInterface(origDocShell);
|
||||
NS_ENSURE_STATE(doc);
|
||||
nsCOMPtr<nsIDocument> clonedDoc = doc->CreateStaticClone(dest->mDocShell);
|
||||
nsCOMPtr<nsIDOMDocument> clonedDOMDoc = do_QueryInterface(clonedDoc);
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
#include "nsDOMClassInfo.h"
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "nsDOMEvent.h"
|
||||
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsContentCID.h"
|
||||
|
@ -297,17 +298,16 @@ nsPluginCrashedEvent::Run()
|
|||
LOG(("OBJLC [%p]: Firing plugin crashed event\n",
|
||||
mContent.get()));
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc =
|
||||
do_QueryInterface(mContent->GetDocument());
|
||||
if (!domDoc) {
|
||||
nsCOMPtr<nsIDocument> doc = mContent->GetDocument();
|
||||
if (!doc) {
|
||||
NS_WARNING("Couldn't get document for PluginCrashed event!");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
domDoc->CreateEvent(NS_LITERAL_STRING("datacontainerevents"),
|
||||
getter_AddRefs(event));
|
||||
nsCOMPtr<nsIDOMDataContainerEvent> containerEvent(do_QueryInterface(event));
|
||||
ErrorResult rv;
|
||||
nsRefPtr<nsDOMEvent> event =
|
||||
doc->CreateEvent(NS_LITERAL_STRING("datacontainerevents"), rv);
|
||||
nsCOMPtr<nsIDOMDataContainerEvent> containerEvent(do_QueryObject(event));
|
||||
if (!containerEvent) {
|
||||
NS_WARNING("Couldn't QI event for PluginCrashed event!");
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче