mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 945572 part 1. Make NS_NewHTMLElement take an Element** outparam instead of an nsIContent** one. r=smaug
This commit is contained in:
parent
9866760836
commit
92f32069b0
@ -22,6 +22,12 @@ class imgRequestProxy;
|
||||
class nsNodeInfoManager;
|
||||
class nsGenericHTMLElement;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Element;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
nsresult
|
||||
NS_NewElement(nsIContent** aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
@ -31,7 +37,8 @@ nsresult
|
||||
NS_NewXMLElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
NS_NewHTMLElement(mozilla::dom::Element** aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser);
|
||||
|
||||
// First argument should be nsHTMLTag, but that adds dependency to parser
|
||||
|
@ -11466,13 +11466,13 @@ nsIDocument::CreateHTMLElement(nsIAtom* aTag)
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
MOZ_ASSERT(nodeInfo, "GetNodeInfo should never fail");
|
||||
|
||||
nsCOMPtr<nsIContent> content = nullptr;
|
||||
DebugOnly<nsresult> rv = NS_NewHTMLElement(getter_AddRefs(content),
|
||||
nsCOMPtr<Element> element;
|
||||
DebugOnly<nsresult> rv = NS_NewHTMLElement(getter_AddRefs(element),
|
||||
nodeInfo.forget(),
|
||||
mozilla::dom::NOT_FROM_PARSER);
|
||||
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv), "NS_NewHTMLElement should never fail");
|
||||
return dont_AddRef(content.forget().get()->AsElement());
|
||||
return element.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "nsString.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "mozilla/dom/XBLChildrenElement.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
@ -193,7 +194,10 @@ NS_NewElement(nsIContent** aResult,
|
||||
{
|
||||
int32_t ns = aNodeInfo.get()->NamespaceID();
|
||||
if (ns == kNameSpaceID_XHTML) {
|
||||
return NS_NewHTMLElement(aResult, aNodeInfo, aFromParser);
|
||||
nsCOMPtr<Element> el;
|
||||
nsresult rv = NS_NewHTMLElement(getter_AddRefs(el), aNodeInfo, aFromParser);
|
||||
el.forget(aResult);
|
||||
return rv;
|
||||
}
|
||||
#ifdef MOZ_XUL
|
||||
if (ns == kNameSpaceID_XUL) {
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "nsITextControlElement.h"
|
||||
#include "nsITextControlFrame.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIContent.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/WeakPtr.h"
|
||||
|
||||
class nsTextInputListener;
|
||||
@ -142,12 +142,12 @@ public:
|
||||
|
||||
nsresult CreatePlaceholderNode();
|
||||
|
||||
nsIContent* GetRootNode() {
|
||||
mozilla::dom::Element* GetRootNode() {
|
||||
if (!mRootNode)
|
||||
CreateRootNode();
|
||||
return mRootNode;
|
||||
}
|
||||
nsIContent* GetPlaceholderNode() {
|
||||
mozilla::dom::Element* GetPlaceholderNode() {
|
||||
return mPlaceholderDiv;
|
||||
}
|
||||
|
||||
@ -267,8 +267,8 @@ private:
|
||||
nsRefPtr<nsTextInputSelectionImpl> mSelCon;
|
||||
RestoreSelectionState* mRestoringSelection;
|
||||
nsCOMPtr<nsIEditor> mEditor;
|
||||
nsCOMPtr<nsIContent> mRootNode;
|
||||
nsCOMPtr<nsIContent> mPlaceholderDiv;
|
||||
nsCOMPtr<mozilla::dom::Element> mRootNode;
|
||||
nsCOMPtr<mozilla::dom::Element> mPlaceholderDiv;
|
||||
nsTextControlFrame* mBoundFrame;
|
||||
nsTextInputListener* mTextListener;
|
||||
nsAutoPtr<nsCString> mValue;
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
virtual bool CanSavePresentation(nsIRequest *aNewRequest);
|
||||
|
||||
const nsCString& GetType() const { return mMimeType; }
|
||||
nsIContent* GetPluginContent() { return mPluginContent; }
|
||||
Element* GetPluginContent() { return mPluginContent; }
|
||||
|
||||
void StartLayout() { MediaDocument::StartLayout(); }
|
||||
|
||||
@ -52,7 +52,7 @@ public:
|
||||
protected:
|
||||
nsresult CreateSyntheticPluginDocument();
|
||||
|
||||
nsCOMPtr<nsIContent> mPluginContent;
|
||||
nsCOMPtr<Element> mPluginContent;
|
||||
nsRefPtr<MediaDocumentStreamListener> mStreamListener;
|
||||
nsCString mMimeType;
|
||||
};
|
||||
|
@ -242,7 +242,7 @@ public:
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
NS_NewHTMLElement(Element** aResult, already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
FromParser aFromParser)
|
||||
{
|
||||
*aResult = nullptr;
|
||||
|
@ -242,12 +242,7 @@ nsresult
|
||||
txMozillaTextOutput::createXHTMLElement(nsIAtom* aName,
|
||||
nsIContent** aResult)
|
||||
{
|
||||
*aResult = nullptr;
|
||||
|
||||
nsCOMPtr<nsINodeInfo> ni;
|
||||
ni = mDocument->NodeInfoManager()->
|
||||
GetNodeInfo(aName, nullptr, kNameSpaceID_XHTML,
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
|
||||
return NS_NewHTMLElement(aResult, ni.forget(), NOT_FROM_PARSER);
|
||||
nsCOMPtr<Element> element = mDocument->CreateHTMLElement(aName);
|
||||
element.forget(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -934,9 +934,13 @@ txMozillaXMLOutput::createHTMLElement(nsIAtom* aName,
|
||||
kNameSpaceID_XHTML,
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
|
||||
return NS_NewHTMLElement(aResult, ni.forget(), mCreatingNewDocument ?
|
||||
FROM_PARSER_XSLT : FROM_PARSER_FRAGMENT);
|
||||
|
||||
nsCOMPtr<Element> el;
|
||||
nsresult rv =
|
||||
NS_NewHTMLElement(getter_AddRefs(el), ni.forget(),
|
||||
mCreatingNewDocument ?
|
||||
FROM_PARSER_XSLT : FROM_PARSER_FRAGMENT);
|
||||
el.forget(aResult);
|
||||
return rv;
|
||||
}
|
||||
|
||||
txTransformNotifier::txTransformNotifier()
|
||||
|
@ -1168,13 +1168,7 @@ nsComboboxControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
||||
if (!aElements.AppendElement(mDisplayContent))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = nimgr->GetNodeInfo(nsGkAtoms::button, nullptr, kNameSpaceID_XHTML,
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
|
||||
// create button which drops the list down
|
||||
NS_NewHTMLElement(getter_AddRefs(mButtonContent), nodeInfo.forget(),
|
||||
dom::NOT_FROM_PARSER);
|
||||
mButtonContent = mContent->OwnerDoc()->CreateHTMLElement(nsGkAtoms::button);
|
||||
if (!mButtonContent)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/HTMLButtonElement.h"
|
||||
#include "mozilla/dom/HTMLInputElement.h"
|
||||
#include "nsNodeInfoManager.h"
|
||||
@ -75,14 +76,9 @@ nsresult
|
||||
nsFileControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> doc = mContent->GetDocument();
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
|
||||
// Create and setup the file picking button.
|
||||
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::button, nullptr,
|
||||
kNameSpaceID_XHTML,
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
NS_NewHTMLElement(getter_AddRefs(mBrowse), nodeInfo.forget(),
|
||||
dom::NOT_FROM_PARSER);
|
||||
mBrowse = doc->CreateHTMLElement(nsGkAtoms::button);
|
||||
// NOTE: SetIsNativeAnonymousRoot() has to be called before setting any
|
||||
// attribute.
|
||||
mBrowse->SetIsNativeAnonymousRoot();
|
||||
@ -122,6 +118,7 @@ nsFileControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
||||
}
|
||||
|
||||
// Create and setup the text showing the selected files.
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::label, nullptr,
|
||||
kNameSpaceID_XUL,
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
|
Loading…
Reference in New Issue
Block a user