зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 4 changesets (bug 1563066) for build bustages on nsXULElement.h . CLOSED TREE
Backed out changeset bfc0d9412df9 (bug 1563066) Backed out changeset fd915382080d (bug 1563066) Backed out changeset 98e692885ecc (bug 1563066) Backed out changeset e5a0ca3d92cc (bug 1563066)
This commit is contained in:
Родитель
7699bea40c
Коммит
12163ca397
|
@ -745,8 +745,9 @@ nsresult nsXBLContentSink::CreateElement(
|
|||
// nsXBLPrototypeBinding::ReadContentNode.
|
||||
|
||||
*aAppendContent = true;
|
||||
RefPtr<nsXULPrototypeElement> prototype =
|
||||
new nsXULPrototypeElement(aNodeInfo);
|
||||
RefPtr<nsXULPrototypeElement> prototype = new nsXULPrototypeElement();
|
||||
|
||||
prototype->mNodeInfo = aNodeInfo;
|
||||
|
||||
AddAttributesToXULPrototype(aAtts, aAttsCount, prototype);
|
||||
|
||||
|
|
|
@ -1013,8 +1013,9 @@ nsresult nsXBLPrototypeBinding::ReadContentNode(nsIObjectInputStream* aStream,
|
|||
if (namespaceID == kNameSpaceID_XUL) {
|
||||
nsIURI* documentURI = aDocument->GetDocumentURI();
|
||||
|
||||
RefPtr<nsXULPrototypeElement> prototype =
|
||||
new nsXULPrototypeElement(nodeInfo);
|
||||
RefPtr<nsXULPrototypeElement> prototype = new nsXULPrototypeElement();
|
||||
|
||||
prototype->mNodeInfo = nodeInfo;
|
||||
|
||||
nsXULPrototypeAttribute* attrs = nullptr;
|
||||
if (attrCount > 0) {
|
||||
|
|
|
@ -67,13 +67,14 @@ XULContentSinkImpl::ContextStack::~ContextStack() {
|
|||
}
|
||||
}
|
||||
|
||||
void XULContentSinkImpl::ContextStack::Push(nsXULPrototypeNode* aNode,
|
||||
State aState) {
|
||||
nsresult XULContentSinkImpl::ContextStack::Push(nsXULPrototypeNode* aNode,
|
||||
State aState) {
|
||||
Entry* entry = new Entry(aNode, aState, mTop);
|
||||
|
||||
mTop = entry;
|
||||
|
||||
++mDepth;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult XULContentSinkImpl::ContextStack::Pop(State* aState) {
|
||||
|
@ -298,7 +299,7 @@ nsresult XULContentSinkImpl::FlushText(bool aCreateTextNode) {
|
|||
// Don't bother if we're not in XUL document body
|
||||
if (mState != eInDocumentElement || mContextStack.Depth() == 0) break;
|
||||
|
||||
RefPtr<nsXULPrototypeText> text = new nsXULPrototypeText();
|
||||
nsXULPrototypeText* text = new nsXULPrototypeText();
|
||||
text->mValue.Assign(mText, mTextLength);
|
||||
if (stripWhitespace) text->mValue.Trim(" \t\n\r");
|
||||
|
||||
|
@ -307,7 +308,8 @@ nsresult XULContentSinkImpl::FlushText(bool aCreateTextNode) {
|
|||
rv = mContextStack.GetTopChildren(&children);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
children->AppendElement(text.forget());
|
||||
// transfer ownership of 'text' to the children array
|
||||
children->AppendElement(text);
|
||||
} while (0);
|
||||
|
||||
// Reset our text buffer
|
||||
|
@ -338,6 +340,15 @@ nsresult XULContentSinkImpl::NormalizeAttributeString(
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult XULContentSinkImpl::CreateElement(mozilla::dom::NodeInfo* aNodeInfo,
|
||||
nsXULPrototypeElement** aResult) {
|
||||
nsXULPrototypeElement* element = new nsXULPrototypeElement();
|
||||
element->mNodeInfo = aNodeInfo;
|
||||
|
||||
*aResult = element;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**** BEGIN NEW APIs ****/
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -616,6 +627,8 @@ nsresult XULContentSinkImpl::OpenRoot(const char16_t** aAttributes,
|
|||
NS_ASSERTION(mState == eInProlog, "how'd we get here?");
|
||||
if (mState != eInProlog) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (aNodeInfo->Equals(nsGkAtoms::script, kNameSpaceID_XHTML) ||
|
||||
aNodeInfo->Equals(nsGkAtoms::script, kNameSpaceID_XUL)) {
|
||||
MOZ_LOG(gContentSinkLog, LogLevel::Error,
|
||||
|
@ -625,14 +638,32 @@ nsresult XULContentSinkImpl::OpenRoot(const char16_t** aAttributes,
|
|||
}
|
||||
|
||||
// Create the element
|
||||
RefPtr<nsXULPrototypeElement> element = new nsXULPrototypeElement(aNodeInfo);
|
||||
nsXULPrototypeElement* element;
|
||||
rv = CreateElement(aNodeInfo, &element);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
if (MOZ_LOG_TEST(gContentSinkLog, LogLevel::Error)) {
|
||||
nsAutoString anodeC;
|
||||
aNodeInfo->GetName(anodeC);
|
||||
MOZ_LOG(gContentSinkLog, LogLevel::Error,
|
||||
("xul: unable to create element '%s' at line %d",
|
||||
NS_ConvertUTF16toUTF8(anodeC).get(),
|
||||
-1)); // XXX pass in line number
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Push the element onto the context stack, so that child
|
||||
// containers will hook up to us as their parent.
|
||||
mContextStack.Push(element, mState);
|
||||
rv = mContextStack.Push(element, mState);
|
||||
if (NS_FAILED(rv)) {
|
||||
element->Release();
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Add the attributes
|
||||
nsresult rv = AddAttributes(aAttributes, aAttrLen, element);
|
||||
rv = AddAttributes(aAttributes, aAttrLen, element);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mState = eInDocumentElement;
|
||||
|
@ -643,13 +674,29 @@ nsresult XULContentSinkImpl::OpenTag(const char16_t** aAttributes,
|
|||
const uint32_t aAttrLen,
|
||||
const uint32_t aLineNumber,
|
||||
mozilla::dom::NodeInfo* aNodeInfo) {
|
||||
nsresult rv;
|
||||
|
||||
// Create the element
|
||||
RefPtr<nsXULPrototypeElement> element = new nsXULPrototypeElement(aNodeInfo);
|
||||
nsXULPrototypeElement* element;
|
||||
rv = CreateElement(aNodeInfo, &element);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
if (MOZ_LOG_TEST(gContentSinkLog, LogLevel::Error)) {
|
||||
nsAutoString anodeC;
|
||||
aNodeInfo->GetName(anodeC);
|
||||
MOZ_LOG(gContentSinkLog, LogLevel::Error,
|
||||
("xul: unable to create element '%s' at line %d",
|
||||
NS_ConvertUTF16toUTF8(anodeC).get(), aLineNumber));
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Link this element to its parent.
|
||||
nsPrototypeArray* children = nullptr;
|
||||
nsresult rv = mContextStack.GetTopChildren(&children);
|
||||
rv = mContextStack.GetTopChildren(&children);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete element;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -676,7 +723,8 @@ nsresult XULContentSinkImpl::OpenTag(const char16_t** aAttributes,
|
|||
|
||||
// Push the element onto the context stack, so that child
|
||||
// containers will hook up to us as their parent.
|
||||
mContextStack.Push(element, mState);
|
||||
rv = mContextStack.Push(element, mState);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mState = eInDocumentElement;
|
||||
return NS_OK;
|
||||
|
|
|
@ -86,6 +86,8 @@ class XULContentSinkImpl final : public nsIXMLContentSink, public nsIExpatSink {
|
|||
|
||||
nsresult NormalizeAttributeString(const char16_t* aExpatName,
|
||||
nsAttrName& aName);
|
||||
nsresult CreateElement(mozilla::dom::NodeInfo* aNodeInfo,
|
||||
nsXULPrototypeElement** aResult);
|
||||
|
||||
public:
|
||||
enum State { eInProlog, eInDocumentElement, eInScript, eInEpilog };
|
||||
|
@ -115,7 +117,7 @@ class XULContentSinkImpl final : public nsIXMLContentSink, public nsIExpatSink {
|
|||
|
||||
int32_t Depth() { return mDepth; }
|
||||
|
||||
void Push(nsXULPrototypeNode* aNode, State aState);
|
||||
nsresult Push(nsXULPrototypeNode* aNode, State aState);
|
||||
nsresult Pop(State* aState);
|
||||
|
||||
nsresult GetTopNode(RefPtr<nsXULPrototypeNode>& aNode);
|
||||
|
|
|
@ -133,9 +133,8 @@ class nsXULPrototypeNode {
|
|||
|
||||
class nsXULPrototypeElement : public nsXULPrototypeNode {
|
||||
public:
|
||||
nsXULPrototypeElement(mozilla::dom::NodeInfo* aNodeInfo = nullptr)
|
||||
nsXULPrototypeElement()
|
||||
: nsXULPrototypeNode(eType_Element),
|
||||
mNodeInfo(aNodeInfo),
|
||||
mNumAttributes(0),
|
||||
mHasIdAttribute(false),
|
||||
mHasClassAttribute(false),
|
||||
|
@ -143,10 +142,8 @@ class nsXULPrototypeElement : public nsXULPrototypeNode {
|
|||
mAttributes(nullptr),
|
||||
mIsAtom(nullptr) {}
|
||||
|
||||
private:
|
||||
virtual ~nsXULPrototypeElement() { Unlink(); }
|
||||
|
||||
public:
|
||||
virtual void ReleaseSubtree() override {
|
||||
for (int32_t i = mChildren.Length() - 1; i >= 0; i--) {
|
||||
if (mChildren[i].get()) mChildren[i]->ReleaseSubtree();
|
||||
|
@ -192,11 +189,8 @@ class XULDocument;
|
|||
class nsXULPrototypeScript : public nsXULPrototypeNode {
|
||||
public:
|
||||
explicit nsXULPrototypeScript(uint32_t aLineNo);
|
||||
|
||||
private:
|
||||
virtual ~nsXULPrototypeScript();
|
||||
|
||||
public:
|
||||
virtual nsresult Serialize(
|
||||
nsIObjectOutputStream* aStream, nsXULPrototypeDocument* aProtoDoc,
|
||||
const nsTArray<RefPtr<mozilla::dom::NodeInfo>>* aNodeInfos) override;
|
||||
|
@ -249,10 +243,8 @@ class nsXULPrototypeText : public nsXULPrototypeNode {
|
|||
public:
|
||||
nsXULPrototypeText() : nsXULPrototypeNode(eType_Text) {}
|
||||
|
||||
private:
|
||||
virtual ~nsXULPrototypeText() {}
|
||||
|
||||
public:
|
||||
virtual nsresult Serialize(
|
||||
nsIObjectOutputStream* aStream, nsXULPrototypeDocument* aProtoDoc,
|
||||
const nsTArray<RefPtr<mozilla::dom::NodeInfo>>* aNodeInfos) override;
|
||||
|
@ -268,10 +260,8 @@ class nsXULPrototypePI : public nsXULPrototypeNode {
|
|||
public:
|
||||
nsXULPrototypePI() : nsXULPrototypeNode(eType_PI) {}
|
||||
|
||||
private:
|
||||
virtual ~nsXULPrototypePI() {}
|
||||
|
||||
public:
|
||||
virtual nsresult Serialize(
|
||||
nsIObjectOutputStream* aStream, nsXULPrototypeDocument* aProtoDoc,
|
||||
const nsTArray<RefPtr<mozilla::dom::NodeInfo>>* aNodeInfos) override;
|
||||
|
|
Загрузка…
Ссылка в новой задаче