deCOMtaminate nsIContent::GetNameSpaceID. Bug 272079, r+sr=jst

This commit is contained in:
bryner%brianryner.com 2004-12-13 04:14:28 +00:00
Родитель 73fc272455
Коммит 076b2a64a6
18 изменённых файлов: 42 добавлений и 59 удалений

Просмотреть файл

@ -150,15 +150,17 @@ STDMETHODIMP nsAccessNodeWrap::get_nodeInfo(
mDOMNode->GetNodeValue(nodeValue); mDOMNode->GetNodeValue(nodeValue);
*aNodeValue = ::SysAllocString(nodeValue.get()); *aNodeValue = ::SysAllocString(nodeValue.get());
PRInt32 nameSpaceID = 0; PRInt32 nameSpaceID;
*aUniqueID = 0; // magic value of 0 means we're on the document node. *aUniqueID = 0; // magic value of 0 means we're on the document node.
if (content) { if (content) {
content->GetNameSpaceID(&nameSpaceID); nameSpaceID = content->GetNameSpaceID();
// This is a unique ID for every content node. The 3rd party // This is a unique ID for every content node. The 3rd party
// accessibility application can compare this to the childID we // accessibility application can compare this to the childID we
// return for events such as focus events, to correlate back to // return for events such as focus events, to correlate back to
// data nodes in their internal object model. // data nodes in their internal object model.
*aUniqueID = content->ContentID(); *aUniqueID = content->ContentID();
} else {
nameSpaceID = 0;
} }
*aNameSpaceID = NS_STATIC_CAST(short, nameSpaceID); *aNameSpaceID = NS_STATIC_CAST(short, nameSpaceID);

Просмотреть файл

@ -60,8 +60,8 @@ class nsIURI;
// IID for the nsIContent interface // IID for the nsIContent interface
#define NS_ICONTENT_IID \ #define NS_ICONTENT_IID \
{ 0xdd5c7dd9, 0x4c9b, 0x46ac, \ { 0x84840657, 0x2f0b, 0x4b11, \
{ 0x87, 0x5c, 0xcb, 0xba, 0xe5, 0x41, 0x84, 0xb5 } } { 0xa8, 0xba, 0xbc, 0x0e, 0xe3, 0xcd, 0xef, 0x08 } }
/** /**
* A node of content in a document's content model. This interface * A node of content in a document's content model. This interface
@ -152,9 +152,9 @@ public:
/** /**
* Get the namespace that this element's tag is defined in * Get the namespace that this element's tag is defined in
* @param aResult the namespace [OUT] * @return the namespace
*/ */
virtual void GetNameSpaceID(PRInt32* aResult) const = 0; virtual PRInt32 GetNameSpaceID() const = 0;
/** /**
* Get the tag for this element. This will always return a non-null * Get the tag for this element. This will always return a non-null

Просмотреть файл

@ -622,10 +622,10 @@ nsGenericDOMDataNode::SetNativeAnonymous(PRBool aAnonymous)
// XXX Need to fix this to do something - bug 165110 // XXX Need to fix this to do something - bug 165110
} }
void PRInt32
nsGenericDOMDataNode::GetNameSpaceID(PRInt32* aID) const nsGenericDOMDataNode::GetNameSpaceID() const
{ {
*aID = kNameSpaceID_None; return kNameSpaceID_None;
} }
nsIAtom * nsIAtom *

Просмотреть файл

@ -193,7 +193,7 @@ public:
virtual void SetParent(nsIContent* aParent); virtual void SetParent(nsIContent* aParent);
virtual PRBool IsNativeAnonymous() const; virtual PRBool IsNativeAnonymous() const;
virtual void SetNativeAnonymous(PRBool aAnonymous); virtual void SetNativeAnonymous(PRBool aAnonymous);
virtual void GetNameSpaceID(PRInt32* aID) const; virtual PRInt32 GetNameSpaceID() const;
virtual nsIAtom *GetIDAttributeName() const; virtual nsIAtom *GetIDAttributeName() const;
virtual nsIAtom *GetClassAttributeName() const; virtual nsIAtom *GetClassAttributeName() const;
virtual already_AddRefed<nsINodeInfo> GetExistingAttrNameFromQName(const nsAString& aStr) const; virtual already_AddRefed<nsINodeInfo> GetExistingAttrNameFromQName(const nsAString& aStr) const;

Просмотреть файл

@ -1820,10 +1820,10 @@ nsGenericElement::SetNativeAnonymous(PRBool aAnonymous)
} }
} }
void PRInt32
nsGenericElement::GetNameSpaceID(PRInt32* aNameSpaceID) const nsGenericElement::GetNameSpaceID() const
{ {
*aNameSpaceID = mNodeInfo->NamespaceID(); return mNodeInfo->NamespaceID();
} }
nsIAtom * nsIAtom *

Просмотреть файл

@ -370,7 +370,7 @@ public:
virtual void SetParent(nsIContent* aParent); virtual void SetParent(nsIContent* aParent);
virtual PRBool IsNativeAnonymous() const; virtual PRBool IsNativeAnonymous() const;
virtual void SetNativeAnonymous(PRBool aAnonymous); virtual void SetNativeAnonymous(PRBool aAnonymous);
virtual void GetNameSpaceID(PRInt32* aNameSpaceID) const; virtual PRInt32 GetNameSpaceID() const;
virtual nsIAtom *Tag() const; virtual nsIAtom *Tag() const;
virtual nsINodeInfo *GetNodeInfo() const; virtual nsINodeInfo *GetNodeInfo() const;
virtual PRUint32 GetChildCount() const; virtual PRUint32 GetChildCount() const;

Просмотреть файл

@ -641,9 +641,7 @@ nsXMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
continue; continue;
if (namespaceID == kNameSpaceID_None) { if (namespaceID == kNameSpaceID_None) {
PRInt32 elementNsID; if (content->GetNameSpaceID() == kNameSpaceID_XHTML) {
content->GetNameSpaceID(&elementNsID);
if (elementNsID == kNameSpaceID_XHTML) {
if (IsShorthandAttr(attrName, content->Tag()) && if (IsShorthandAttr(attrName, content->Tag()) &&
valueStr.IsEmpty()) { valueStr.IsEmpty()) {
valueStr = nameStr; valueStr = nameStr;

Просмотреть файл

@ -1229,11 +1229,11 @@ nsEventListenerManager::AddScriptEventListener(nsISupports *aObject,
else { else {
PRInt32 nameSpace = kNameSpaceID_Unknown; PRInt32 nameSpace = kNameSpaceID_Unknown;
if (content) if (content)
content->GetNameSpaceID(&nameSpace); nameSpace = content->GetNameSpaceID();
else if (doc) { else if (doc) {
nsCOMPtr<nsIContent> root = doc->GetRootContent(); nsCOMPtr<nsIContent> root = doc->GetRootContent();
if (root) if (root)
root->GetNameSpaceID(&nameSpace); nameSpace = root->GetNameSpaceID();
} }
const char *eventName = nsContentUtils::GetEventArgName(nameSpace); const char *eventName = nsContentUtils::GetEventArgName(nameSpace);
@ -1446,9 +1446,8 @@ nsEventListenerManager::CompileEventHandlerInternal(nsIScriptContext *aContext,
&handler); &handler);
} }
else { else {
PRInt32 nameSpace = kNameSpaceID_Unknown; const char *eventName =
content->GetNameSpaceID(&nameSpace); nsContentUtils::GetEventArgName(content->GetNameSpaceID());
const char *eventName = nsContentUtils::GetEventArgName(nameSpace);
result = aContext->CompileEventHandler(jsobj, aName, eventName, result = aContext->CompileEventHandler(jsobj, aName, eventName,
handlerBody, handlerBody,

Просмотреть файл

@ -1607,13 +1607,13 @@ nsGenericHTMLElement::GetHrefURIForAnchors(nsIURI** aURI)
return NS_OK; return NS_OK;
} }
void PRInt32
nsGenericHTMLElement::GetNameSpaceID(PRInt32* aID) const nsGenericHTMLElement::GetNameSpaceID() const
{ {
// XXX // XXX
// XXX This is incorrect!!!!!!!!!!!!!!!! // XXX This is incorrect!!!!!!!!!!!!!!!!
// XXX // XXX
*aID = kNameSpaceID_XHTML; return kNameSpaceID_XHTML;
} }
nsresult nsresult

Просмотреть файл

@ -174,7 +174,7 @@ public:
// Implementation for nsIContent // Implementation for nsIContent
virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep, virtual void SetDocument(nsIDocument* aDocument, PRBool aDeep,
PRBool aCompileEventHandlers); PRBool aCompileEventHandlers);
virtual void GetNameSpaceID(PRInt32* aID) const; virtual PRInt32 GetNameSpaceID() const;
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString& aValue, PRBool aNotify) const nsAString& aValue, PRBool aNotify)
{ {

Просмотреть файл

@ -612,7 +612,7 @@ nsBindingManager::ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID,
} }
} }
aContent->GetNameSpaceID(aNameSpaceID); *aNameSpaceID = aContent->GetNameSpaceID();
NS_ADDREF(*aResult = aContent->Tag()); NS_ADDREF(*aResult = aContent->Tag());
return NS_OK; return NS_OK;

Просмотреть файл

@ -684,7 +684,7 @@ nsXBLService::ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID,
return bindingManager->ResolveTag(aContent, aNameSpaceID, aResult); return bindingManager->ResolveTag(aContent, aNameSpaceID, aResult);
} }
aContent->GetNameSpaceID(aNameSpaceID); *aNameSpaceID = aContent->GetNameSpaceID();
NS_ADDREF(*aResult = aContent->Tag()); NS_ADDREF(*aResult = aContent->Tag());
return NS_OK; return NS_OK;

Просмотреть файл

@ -1965,10 +1965,10 @@ nsXULElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
return NS_OK; return NS_OK;
} }
void PRInt32
nsXULElement::GetNameSpaceID(PRInt32* aNameSpaceID) const nsXULElement::GetNameSpaceID() const
{ {
*aNameSpaceID = NodeInfo()->NamespaceID(); return NodeInfo()->NamespaceID();
} }
nsIAtom * nsIAtom *

Просмотреть файл

@ -458,7 +458,7 @@ public:
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify, virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify,
PRBool aDeepSetDocument); PRBool aDeepSetDocument);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify); virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
virtual void GetNameSpaceID(PRInt32* aNameSpeceID) const; virtual PRInt32 GetNameSpaceID() const;
virtual nsIAtom *Tag() const; virtual nsIAtom *Tag() const;
virtual nsINodeInfo *GetNodeInfo() const; virtual nsINodeInfo *GetNodeInfo() const;
virtual nsIAtom *GetIDAttributeName() const; virtual nsIAtom *GetIDAttributeName() const;

Просмотреть файл

@ -446,8 +446,7 @@ nsXULContentBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
for (PRUint32 kid = 0; kid < count; kid++) { for (PRUint32 kid = 0; kid < count; kid++) {
nsIContent *tmplKid = aTemplateNode->GetChildAt(kid); nsIContent *tmplKid = aTemplateNode->GetChildAt(kid);
PRInt32 nameSpaceID; PRInt32 nameSpaceID = tmplKid->GetNameSpaceID();
tmplKid->GetNameSpaceID(&nameSpaceID);
// Check whether this element is the "resource" element. The // Check whether this element is the "resource" element. The
// "resource" element is the element that is cookie-cutter // "resource" element is the element that is cookie-cutter
@ -1570,10 +1569,8 @@ nsXULContentBuilder::AttributeChanged(nsIDocument* aDocument,
// Handle "open" and "close" cases. We do this handling before // Handle "open" and "close" cases. We do this handling before
// we've notified the observer, so that content is already created // we've notified the observer, so that content is already created
// for the frame system to walk. // for the frame system to walk.
PRInt32 nameSpaceID = kNameSpaceID_Unknown; if ((aContent->GetNameSpaceID() == kNameSpaceID_XUL) &&
aContent->GetNameSpaceID(&nameSpaceID); (aAttribute == nsXULAtoms::open)) {
if ((nameSpaceID == kNameSpaceID_XUL) && (aAttribute == nsXULAtoms::open)) {
// We're on a XUL tag, and an ``open'' attribute changed. // We're on a XUL tag, and an ``open'' attribute changed.
nsAutoString open; nsAutoString open;
aContent->GetAttr(kNameSpaceID_None, nsXULAtoms::open, open); aContent->GetAttr(kNameSpaceID_None, nsXULAtoms::open, open);

Просмотреть файл

@ -176,10 +176,7 @@ nsXULContentUtils::FindChildByTag(nsIContent* aElement,
for (PRUint32 i = 0; i < count; ++i) { for (PRUint32 i = 0; i < count; ++i) {
nsIContent *kid = aElement->GetChildAt(i); nsIContent *kid = aElement->GetChildAt(i);
PRInt32 nameSpaceID; if (kid->GetNameSpaceID() != aNameSpaceID)
kid->GetNameSpaceID(&nameSpaceID);
if (nameSpaceID != aNameSpaceID)
continue; // wrong namespace continue; // wrong namespace
nsINodeInfo *ni = kid->GetNodeInfo(); nsINodeInfo *ni = kid->GetNodeInfo();

Просмотреть файл

@ -3954,9 +3954,6 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
styleContext = contentFrame->GetStyleContext(); styleContext = contentFrame->GetStyleContext();
} else { } else {
// otherwise build a box or a block // otherwise build a box or a block
#if defined(MOZ_SVG)
PRInt32 nameSpaceID;
#endif
#ifdef MOZ_XUL #ifdef MOZ_XUL
if (aDocElement->IsContentOfType(nsIContent::eXUL)) { if (aDocElement->IsContentOfType(nsIContent::eXUL)) {
rv = NS_NewDocElementBoxFrame(aPresShell, &contentFrame); rv = NS_NewDocElementBoxFrame(aPresShell, &contentFrame);
@ -3967,8 +3964,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
else else
#endif #endif
#ifdef MOZ_SVG #ifdef MOZ_SVG
if (aDocElement->GetNameSpaceID(&nameSpaceID), if (aDocElement->GetNameSpaceID() == kNameSpaceID_SVG) {
(nameSpaceID == kNameSpaceID_SVG)) {
rv = NS_NewSVGOuterSVGFrame(aPresShell, aDocElement, &contentFrame); rv = NS_NewSVGOuterSVGFrame(aPresShell, aDocElement, &contentFrame);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
@ -7439,9 +7435,6 @@ nsCSSFrameConstructor::ConstructFrame(nsIPresShell* aPresShell,
nsRefPtr<nsStyleContext> styleContext; nsRefPtr<nsStyleContext> styleContext;
styleContext = ResolveStyleContext(aPresContext, aParentFrame, aContent); styleContext = ResolveStyleContext(aPresContext, aParentFrame, aContent);
PRInt32 nameSpaceID;
aContent->GetNameSpaceID(&nameSpaceID);
PRBool pageBreakAfter = PR_FALSE; PRBool pageBreakAfter = PR_FALSE;
if (aPresContext->IsPaginated()) { if (aPresContext->IsPaginated()) {
@ -7451,7 +7444,8 @@ nsCSSFrameConstructor::ConstructFrame(nsIPresShell* aPresShell,
} }
// construct the frame // construct the frame
rv = ConstructFrameInternal(aPresShell, aPresContext, aState, aContent, aParentFrame, rv = ConstructFrameInternal(aPresShell, aPresContext, aState, aContent, aParentFrame,
tag, nameSpaceID, styleContext, aFrameItems, PR_FALSE); tag, aContent->GetNameSpaceID(), styleContext,
aFrameItems, PR_FALSE);
if (NS_SUCCEEDED(rv) && pageBreakAfter) { if (NS_SUCCEEDED(rv) && pageBreakAfter) {
// Construct the page break after // Construct the page break after
ConstructPageBreakFrame(aPresShell, aPresContext, aState, aContent, ConstructPageBreakFrame(aPresShell, aPresContext, aState, aContent,
@ -10513,12 +10507,10 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
nsStyleContext* styleContext = aFrame->GetStyleContext(); nsStyleContext* styleContext = aFrame->GetStyleContext();
// Get aFrame's content object and the tag name // Get aFrame's content object and the tag name
PRInt32 nameSpaceID;
nsIAtom* tag; nsIAtom* tag;
nsIContent* content = aFrame->GetContent(); nsIContent* content = aFrame->GetContent();
NS_ASSERTION(content, "null content object"); NS_ASSERTION(content, "null content object");
content->GetNameSpaceID(&nameSpaceID);
tag = content->Tag(); tag = content->Tag();
// Get the child list name that the frame is contained in // Get the child list name that the frame is contained in
@ -10622,7 +10614,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
// Note: if the old frame was out-of-flow, then so will the new frame // Note: if the old frame was out-of-flow, then so will the new frame
// and we'll get a new placeholder frame // and we'll get a new placeholder frame
rv = ConstructFrameByDisplayType(aPresShell, aPresContext, state, display, rv = ConstructFrameByDisplayType(aPresShell, aPresContext, state, display,
content, nameSpaceID, tag, content, content->GetNameSpaceID(), tag,
inFlowParent, styleContext, frameItems); inFlowParent, styleContext, frameItems);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
@ -12647,12 +12639,10 @@ nsCSSFrameConstructor::CreateListBoxContent(nsPresContext* aPresContext,
return NS_OK; return NS_OK;
} }
PRInt32 namespaceID;
aChild->GetNameSpaceID(&namespaceID);
rv = ConstructFrameInternal(aPresContext->PresShell(), rv = ConstructFrameInternal(aPresContext->PresShell(),
aPresContext, state, aChild, aPresContext, state, aChild,
aParentFrame, aChild->Tag(), namespaceID, aParentFrame, aChild->Tag(),
aChild->GetNameSpaceID(),
styleContext, frameItems, PR_FALSE); styleContext, frameItems, PR_FALSE);
nsIFrame* newFrame = frameItems.childList; nsIFrame* newFrame = frameItems.childList;

Просмотреть файл

@ -2847,7 +2847,7 @@ RuleProcessorData::RuleProcessorData(nsPresContext* aPresContext,
mContent = aContent; mContent = aContent;
// get the namespace // get the namespace
aContent->GetNameSpaceID(&mNameSpaceID); mNameSpaceID = aContent->GetNameSpaceID();
// get the tag and parent // get the tag and parent
mContentTag = aContent->Tag(); mContentTag = aContent->Tag();