зеркало из https://github.com/mozilla/pjs.git
Make nsXULElement inherit directly from nsXMLElement and remove dead internal code ((Get|Set)NameSpacePrefix from nsIXMLContent.h, nsIXULContent.h, nsXMLElement.h, nsGenericXMLElement.(h|cpp) and nsXULElement.(h|cpp). Hints & tips by jst (thanks!), r=jst, a=brendan.
This commit is contained in:
Родитель
e06c12833e
Коммит
16d9ea1ee3
|
@ -18,6 +18,7 @@
|
|||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Annema <disttsc@bart.nl>
|
||||
*/
|
||||
|
||||
#ifndef nsIXMLContent_h___
|
||||
|
@ -44,9 +45,6 @@ public:
|
|||
NS_IMETHOD SetContainingNameSpace(nsINameSpace* aNameSpace) = 0;
|
||||
NS_IMETHOD GetContainingNameSpace(nsINameSpace*& aNameSpace) const = 0;
|
||||
|
||||
NS_IMETHOD SetNameSpacePrefix(nsIAtom* aNameSpace) = 0;
|
||||
NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aNameSpace) const = 0;
|
||||
|
||||
/**
|
||||
* Give this element a change to fire its links that should be fired
|
||||
* automatically when loaded. If the element was an autoloading link
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Annema <disttsc@bart.nl>
|
||||
*/
|
||||
|
||||
#ifndef nsXMLElement_h___
|
||||
|
@ -213,12 +214,6 @@ public:
|
|||
NS_IMETHOD GetContainingNameSpace(nsINameSpace*& aNameSpace) const {
|
||||
return mInner.GetContainingNameSpace(aNameSpace);
|
||||
}
|
||||
NS_IMETHOD SetNameSpacePrefix(nsIAtom* aNameSpace) {
|
||||
return mInner.SetNameSpacePrefix(aNameSpace);
|
||||
}
|
||||
NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aNameSpace) const {
|
||||
return mInner.GetNameSpacePrefix(aNameSpace);
|
||||
}
|
||||
NS_IMETHOD MaybeTriggerAutoLink(nsIWebShell *aShell);
|
||||
|
||||
// nsIStyledContent
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Annema <disttsc@bart.nl>
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -29,7 +30,7 @@
|
|||
#ifndef nsIXULContent_h__
|
||||
#define nsIXULContent_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIXMLContent.h"
|
||||
class nsIAtom;
|
||||
class nsIRDFCompositeDataSource;
|
||||
class nsIXULTemplateBuilder;
|
||||
|
@ -40,7 +41,7 @@ class nsString;
|
|||
{ 0x39c5ecc0, 0x5c47, 0x11d3, { 0xbe, 0x36, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } }
|
||||
|
||||
|
||||
class nsIXULContent : public nsISupports
|
||||
class nsIXULContent : public nsIXMLContent
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IXULCONTENT_IID; return iid; }
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
* Peter Annema <disttsc@bart.nl>
|
||||
*
|
||||
*
|
||||
* This Original Code has been modified by IBM Corporation.
|
||||
|
@ -91,7 +92,6 @@
|
|||
#include "nsIStyledContent.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIXMLContent.h"
|
||||
#include "nsIXULContent.h"
|
||||
#include "nsIXULContentUtils.h"
|
||||
#include "nsIXULDocument.h"
|
||||
|
@ -1605,28 +1605,6 @@ nsXULElement::GetContainingNameSpace(nsINameSpace*& aNameSpace) const
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULElement::SetNameSpacePrefix(nsIAtom* aNameSpacePrefix)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
rv = EnsureSlots();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsINodeInfo> newNodeInfo;
|
||||
mSlots->mNodeInfo->PrefixChanged(aNameSpacePrefix,
|
||||
*getter_AddRefs(newNodeInfo));
|
||||
|
||||
mSlots->mNodeInfo = newNodeInfo;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULElement::GetNameSpacePrefix(nsIAtom*& aNameSpacePrefix) const
|
||||
{
|
||||
return NodeInfo()->GetPrefixAtom(aNameSpacePrefix);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULElement::MaybeTriggerAutoLink(nsIWebShell *aShell)
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
* Chris Waterson <waterson@netscape.com>
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Annema <disttsc@bart.nl>
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -56,7 +57,6 @@
|
|||
#include "nsIBindingManager.h"
|
||||
#include "nsIXBLBinding.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIXMLContent.h"
|
||||
#include "nsIXULContent.h"
|
||||
#include "nsIBoxObject.h"
|
||||
#include "nsXULAttributes.h"
|
||||
|
@ -311,8 +311,7 @@ public:
|
|||
|
||||
*/
|
||||
|
||||
class nsXULElement : public nsIXMLContent,
|
||||
public nsIXULContent,
|
||||
class nsXULElement : public nsIXULContent,
|
||||
public nsIDOMXULElement,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIScriptEventHandlerOwner,
|
||||
|
@ -393,8 +392,6 @@ public:
|
|||
// nsIXMLContent
|
||||
NS_IMETHOD SetContainingNameSpace(nsINameSpace* aNameSpace);
|
||||
NS_IMETHOD GetContainingNameSpace(nsINameSpace*& aNameSpace) const;
|
||||
NS_IMETHOD SetNameSpacePrefix(nsIAtom* aNameSpace);
|
||||
NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aNameSpace) const;
|
||||
NS_IMETHOD MaybeTriggerAutoLink(nsIWebShell *aShell);
|
||||
|
||||
// nsIStyledContent
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Annema <disttsc@bart.nl>
|
||||
*/
|
||||
|
||||
#ifndef nsIXMLContent_h___
|
||||
|
@ -44,9 +45,6 @@ public:
|
|||
NS_IMETHOD SetContainingNameSpace(nsINameSpace* aNameSpace) = 0;
|
||||
NS_IMETHOD GetContainingNameSpace(nsINameSpace*& aNameSpace) const = 0;
|
||||
|
||||
NS_IMETHOD SetNameSpacePrefix(nsIAtom* aNameSpace) = 0;
|
||||
NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aNameSpace) const = 0;
|
||||
|
||||
/**
|
||||
* Give this element a change to fire its links that should be fired
|
||||
* automatically when loaded. If the element was an autoloading link
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Annema <disttsc@bart.nl>
|
||||
*/
|
||||
#include "nsGenericXMLElement.h"
|
||||
|
||||
|
@ -175,26 +176,6 @@ nsGenericXMLElement::GetScriptObject(nsIScriptContext* aContext,
|
|||
return res;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericXMLElement::SetNameSpacePrefix(nsIAtom* aNameSpacePrefix)
|
||||
{
|
||||
nsINodeInfo *newNodeInfo;
|
||||
|
||||
nsresult rv = mNodeInfo->PrefixChanged(aNameSpacePrefix, newNodeInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_RELEASE(mNodeInfo);
|
||||
mNodeInfo = newNodeInfo;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericXMLElement::GetNameSpacePrefix(nsIAtom*& aNameSpacePrefix) const
|
||||
{
|
||||
return mNodeInfo->GetPrefixAtom(aNameSpacePrefix);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericXMLElement::GetNameSpaceID(PRInt32& aNameSpaceID) const
|
||||
{
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsGenericXMLElement_h___
|
||||
#define nsGenericXMLElement_h___
|
||||
|
||||
#include "nsGenericElement.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIJSScriptObject.h"
|
||||
#include "nsINameSpaceManager.h" // for kNameSpaceID_HTML
|
||||
#include "nsINameSpace.h"
|
||||
|
||||
class nsIWebShell;
|
||||
|
||||
class nsGenericXMLElement : public nsGenericContainerElement {
|
||||
public:
|
||||
nsGenericXMLElement();
|
||||
~nsGenericXMLElement();
|
||||
|
||||
nsresult CopyInnerTo(nsIContent* aSrcContent,
|
||||
nsGenericXMLElement* aDest,
|
||||
PRBool aDeep);
|
||||
|
||||
nsresult GetNodeName(nsAWritableString& aNodeName);
|
||||
nsresult GetLocalName(nsAWritableString& aLocalName);
|
||||
|
||||
// Implementation for nsIDOMElement
|
||||
nsresult GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn)
|
||||
{
|
||||
return nsGenericContainerElement::GetAttribute(aName, aReturn);
|
||||
}
|
||||
nsresult SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue)
|
||||
{
|
||||
return nsGenericContainerElement::SetAttribute(aName, aValue);
|
||||
}
|
||||
|
||||
// nsIContent
|
||||
nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
const nsAReadableString& aValue,
|
||||
PRBool aNotify)
|
||||
{
|
||||
return nsGenericContainerElement::SetAttribute(aNameSpaceID, aName,
|
||||
aValue, aNotify);
|
||||
}
|
||||
nsresult SetAttribute(nsINodeInfo *aNodeInfo,
|
||||
const nsAReadableString& aValue,
|
||||
PRBool aNotify)
|
||||
{
|
||||
return nsGenericContainerElement::SetAttribute(aNodeInfo, aValue, aNotify);
|
||||
}
|
||||
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
nsAWritableString& aResult) const
|
||||
{
|
||||
return nsGenericContainerElement::GetAttribute(aNameSpaceID, aName,
|
||||
aResult);
|
||||
}
|
||||
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
nsIAtom*& aPrefix, nsAWritableString& aResult) const
|
||||
{
|
||||
return nsGenericContainerElement::GetAttribute(aNameSpaceID, aName,
|
||||
aPrefix, aResult);
|
||||
}
|
||||
|
||||
// nsIXMLContent
|
||||
nsresult SetContainingNameSpace(nsINameSpace* aNameSpace);
|
||||
nsresult GetContainingNameSpace(nsINameSpace*& aNameSpace) const;
|
||||
|
||||
nsresult SetNameSpacePrefix(nsIAtom* aNameSpace);
|
||||
nsresult GetNameSpacePrefix(nsIAtom*& aNameSpace) const;
|
||||
nsresult GetNameSpaceID(PRInt32& aNameSpaceID) const;
|
||||
nsresult MaybeTriggerAutoLink(nsIWebShell *aShell);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
nsresult GetScriptObject(nsIScriptContext* aContext,
|
||||
void** aScriptObject);
|
||||
|
||||
nsINameSpace* mNameSpace;
|
||||
};
|
||||
|
||||
#endif /* nsGenericXMLElement_h__ */
|
|
@ -18,6 +18,7 @@
|
|||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Annema <disttsc@bart.nl>
|
||||
*/
|
||||
|
||||
#ifndef nsXMLElement_h___
|
||||
|
@ -213,12 +214,6 @@ public:
|
|||
NS_IMETHOD GetContainingNameSpace(nsINameSpace*& aNameSpace) const {
|
||||
return mInner.GetContainingNameSpace(aNameSpace);
|
||||
}
|
||||
NS_IMETHOD SetNameSpacePrefix(nsIAtom* aNameSpace) {
|
||||
return mInner.SetNameSpacePrefix(aNameSpace);
|
||||
}
|
||||
NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aNameSpace) const {
|
||||
return mInner.GetNameSpacePrefix(aNameSpace);
|
||||
}
|
||||
NS_IMETHOD MaybeTriggerAutoLink(nsIWebShell *aShell);
|
||||
|
||||
// nsIStyledContent
|
||||
|
|
|
@ -1,114 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Private interface to XUL content.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef nsIXULContent_h__
|
||||
#define nsIXULContent_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
class nsIAtom;
|
||||
class nsIRDFCompositeDataSource;
|
||||
class nsIXULTemplateBuilder;
|
||||
class nsString;
|
||||
|
||||
// {39C5ECC0-5C47-11d3-BE36-00104BDE6048}
|
||||
#define NS_IXULCONTENT_IID \
|
||||
{ 0x39c5ecc0, 0x5c47, 0x11d3, { 0xbe, 0x36, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } }
|
||||
|
||||
|
||||
class nsIXULContent : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IXULCONTENT_IID; return iid; }
|
||||
|
||||
/**
|
||||
* Peek at a XUL element's child count without forcing children to be
|
||||
* instantiated.
|
||||
*/
|
||||
NS_IMETHOD PeekChildCount(PRInt32& aCount) const = 0;
|
||||
|
||||
/**
|
||||
* These flags are used to maintain bookkeeping information for partially-
|
||||
* constructed content.
|
||||
*
|
||||
* eChildrenMustBeRebuilt
|
||||
* The element's children are invalid or unconstructed, and should
|
||||
* be reconstructed.
|
||||
*
|
||||
* eTemplateContentsBuilt
|
||||
* Child content that is built from a XUL template has been
|
||||
* constructed.
|
||||
*
|
||||
* eContainerContentsBuilt
|
||||
* Child content that is built by following the ``containment''
|
||||
* property in a XUL template has been built.
|
||||
*/
|
||||
enum {
|
||||
eChildrenMustBeRebuilt = 0x1,
|
||||
eTemplateContentsBuilt = 0x2,
|
||||
eContainerContentsBuilt = 0x4
|
||||
};
|
||||
|
||||
/**
|
||||
* Set one or more ``lazy state'' flags.
|
||||
* @aFlags a mask of flags to set
|
||||
*/
|
||||
NS_IMETHOD SetLazyState(PRInt32 aFlags) = 0;
|
||||
|
||||
/**
|
||||
* Clear one or more ``lazy state'' flags.
|
||||
* @aFlags a mask of flags to clear
|
||||
*/
|
||||
NS_IMETHOD ClearLazyState(PRInt32 aFlags) = 0;
|
||||
|
||||
/**
|
||||
* Get the value of a single ``lazy state'' flag.
|
||||
* @aFlag a flag to test
|
||||
* @aResult the result
|
||||
*/
|
||||
NS_IMETHOD GetLazyState(PRInt32 aFlag, PRBool& aResult) = 0;
|
||||
|
||||
/**
|
||||
* Add a script event listener to the element.
|
||||
*/
|
||||
NS_IMETHOD AddScriptEventListener(nsIAtom* aName, const nsAReadableString& aValue, REFNSIID aIID) = 0;
|
||||
|
||||
/**
|
||||
* Evil rotten hack to make mailnews work. They assume that we
|
||||
* keep a reference to their resource objects. If you think you
|
||||
* should call this method, think again. You shouldn't.
|
||||
*/
|
||||
NS_IMETHOD ForceElementToOwnResource(PRBool aForce) = 0;
|
||||
|
||||
/**
|
||||
* Initialize the root element in a XUL template
|
||||
*/
|
||||
NS_IMETHOD InitTemplateRoot(nsIRDFCompositeDataSource* aDatabase,
|
||||
nsIXULTemplateBuilder* aBuilder) = 0;
|
||||
};
|
||||
|
||||
#endif // nsIXULContent_h__
|
|
@ -22,6 +22,7 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
* Peter Annema <disttsc@bart.nl>
|
||||
*
|
||||
*
|
||||
* This Original Code has been modified by IBM Corporation.
|
||||
|
@ -91,7 +92,6 @@
|
|||
#include "nsIStyledContent.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIXMLContent.h"
|
||||
#include "nsIXULContent.h"
|
||||
#include "nsIXULContentUtils.h"
|
||||
#include "nsIXULDocument.h"
|
||||
|
@ -1605,28 +1605,6 @@ nsXULElement::GetContainingNameSpace(nsINameSpace*& aNameSpace) const
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULElement::SetNameSpacePrefix(nsIAtom* aNameSpacePrefix)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
rv = EnsureSlots();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsINodeInfo> newNodeInfo;
|
||||
mSlots->mNodeInfo->PrefixChanged(aNameSpacePrefix,
|
||||
*getter_AddRefs(newNodeInfo));
|
||||
|
||||
mSlots->mNodeInfo = newNodeInfo;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULElement::GetNameSpacePrefix(nsIAtom*& aNameSpacePrefix) const
|
||||
{
|
||||
return NodeInfo()->GetPrefixAtom(aNameSpacePrefix);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULElement::MaybeTriggerAutoLink(nsIWebShell *aShell)
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
* Chris Waterson <waterson@netscape.com>
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Annema <disttsc@bart.nl>
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -56,7 +57,6 @@
|
|||
#include "nsIBindingManager.h"
|
||||
#include "nsIXBLBinding.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIXMLContent.h"
|
||||
#include "nsIXULContent.h"
|
||||
#include "nsIBoxObject.h"
|
||||
#include "nsXULAttributes.h"
|
||||
|
@ -311,8 +311,7 @@ public:
|
|||
|
||||
*/
|
||||
|
||||
class nsXULElement : public nsIXMLContent,
|
||||
public nsIXULContent,
|
||||
class nsXULElement : public nsIXULContent,
|
||||
public nsIDOMXULElement,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIScriptEventHandlerOwner,
|
||||
|
@ -393,8 +392,6 @@ public:
|
|||
// nsIXMLContent
|
||||
NS_IMETHOD SetContainingNameSpace(nsINameSpace* aNameSpace);
|
||||
NS_IMETHOD GetContainingNameSpace(nsINameSpace*& aNameSpace) const;
|
||||
NS_IMETHOD SetNameSpacePrefix(nsIAtom* aNameSpace);
|
||||
NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aNameSpace) const;
|
||||
NS_IMETHOD MaybeTriggerAutoLink(nsIWebShell *aShell);
|
||||
|
||||
// nsIStyledContent
|
||||
|
|
Загрузка…
Ссылка в новой задаче