Backing out bug 275196, xml:id, to fix tp regression
authorOlli.Pettay@helsinki.fi
Thu, 26 Jul 2007 07:16:19 -0700
changeset 4036 d51f466b5aa1d32ec7fb52d21bde744eedbc912d
parent 4035 bd3fed839ff8110e94e6bcc1feabfeb54ed6b197
child 4037 ca6b630dc539f1c2b8df14129c82af117b64d5cb
push idunknown
push userunknown
push dateunknown
bugs275196
milestone1.9a7pre
Backing out bug 275196, xml:id, to fix tp regression
content/base/public/nsIContent.h
content/base/src/nsDOMAttribute.cpp
content/base/src/nsGenericDOMDataNode.cpp
content/base/src/nsGenericDOMDataNode.h
content/base/src/nsGenericElement.cpp
content/base/src/nsGenericElement.h
content/events/src/nsXMLEventsElement.cpp
content/events/src/nsXMLEventsManager.cpp
content/html/content/src/nsGenericHTMLElement.cpp
content/html/content/src/nsGenericHTMLElement.h
content/html/document/src/nsHTMLDocument.cpp
content/svg/content/src/nsSVGElement.cpp
content/svg/content/src/nsSVGElement.h
content/xtf/src/nsXTFElementWrapper.cpp
content/xtf/src/nsXTFElementWrapper.h
content/xul/content/src/nsXULElement.cpp
content/xul/content/src/nsXULElement.h
content/xul/document/src/nsXULDocument.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsFrameManager.cpp
layout/base/nsFrameManager.h
layout/style/nsCSSRuleProcessor.cpp
layout/style/nsIStyleRuleProcessor.h
layout/style/nsStyleSet.cpp
layout/style/nsStyleSet.h
layout/style/test/Makefile.in
layout/style/test/test_bug275196.xhtml
--- a/content/base/public/nsIContent.h
+++ b/content/base/public/nsIContent.h
@@ -58,18 +58,18 @@ class nsICSSStyleRule;
 class nsRuleWalker;
 class nsAttrValue;
 class nsAttrName;
 class nsTextFragment;
 class nsIDocShell;
 
 // IID for the nsIContent interface
 #define NS_ICONTENT_IID       \
-{ 0x609baee8, 0x3c0a, 0x4122, \
-  { 0x9c, 0xc6, 0xe4, 0xc9, 0x83, 0x53, 0xff, 0x9c } }
+{ 0x36b375cb, 0xf01e, 0x4c18, \
+  { 0xbf, 0x9e, 0xba, 0xad, 0x77, 0x1d, 0xce, 0x22 } }
 
 // hack to make egcs / gcc 2.95.2 happy
 class nsIContent_base : public nsINode {
 public:
 #ifdef MOZILLA_INTERNAL_API
   // If you're using the external API, the only thing you can know about
   // nsIContent is that it exists with an IID
 
@@ -206,31 +206,20 @@ public:
    */
   nsINodeInfo *NodeInfo() const
   {
     return mNodeInfo;
   }
 
   /**
    * Returns an atom holding the name of the attribute of type ID on
-   * this content node (if applicable).
-   * Language specific ID attribute has the highest priority, then
-   * ID attribute defined in DTD, and finally xml:id.
-   * Returns null for non-element content nodes.
+   * this content node (if applicable).  Returns null for non-element
+   * content nodes.
    */
-  virtual nsIAtom* GetIDAttributeName(PRInt32& aNameSpaceID) const = 0;
-
-  /**
-   * Returns true if the attribute can be
-   * used as an ID attribute of the element.
-   * Note this may return true with many attributes, but only one
-   * is used as an ID at a time.
-   */
-  virtual PRBool IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
-                                            nsIAtom* aAtom) const = 0;
+  virtual nsIAtom *GetIDAttributeName() const = 0;
 
   /**
    * Normalizes an attribute name and returns it as a nodeinfo if an attribute
    * with that name exists. This method is intended for character case
    * conversion if the content object is case insensitive (e.g. HTML). Returns
    * the nodeinfo of the attribute with the specified name if one exists or
    * null otherwise.
    *
@@ -737,18 +726,18 @@ public:
   virtual nsresult SetScriptTypeID(PRUint32 aLang)
   {
     NS_NOTREACHED("SetScriptTypeID not implemented");
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   /**
    * Get the ID of this content node (the atom corresponding to the
-   * value of the attribute whose name is given by GetIDAttributeName().
-   * This may be null if there is no ID.
+   * value of the null-namespace attribute whose name is given by
+   * GetIDAttributeName().  This may be null if there is no ID.
    */
   virtual nsIAtom* GetID() const = 0;
 
   /**
    * Get the class list of this content node (this corresponds to the
    * value of the null-namespace attribute whose name is given by
    * GetClassAttributeName().  This may be null if there are no
    * classes, but that's not guaranteed.
--- a/content/base/src/nsDOMAttribute.cpp
+++ b/content/base/src/nsDOMAttribute.cpp
@@ -595,25 +595,24 @@ nsDOMAttribute::GetIsId(PRBool* aReturn)
 {
   nsIContent* content = GetContentInternal();
   if (!content)
   {
     *aReturn = PR_FALSE;
     return NS_OK;
   }
 
-  PRInt32 namespaceID;
-  nsIAtom* idAtom = content->GetIDAttributeName(namespaceID);
+  nsIAtom* idAtom = content->GetIDAttributeName();
   if (!idAtom)
   {
     *aReturn = PR_FALSE;
     return NS_OK;
   }
 
-  *aReturn = mNodeInfo->Equals(idAtom, namespaceID);
+  *aReturn = mNodeInfo->Equals(idAtom, kNameSpaceID_None);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMAttribute::GetSchemaTypeInfo(nsIDOM3TypeInfo** aReturn)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
--- a/content/base/src/nsGenericDOMDataNode.cpp
+++ b/content/base/src/nsGenericDOMDataNode.cpp
@@ -626,29 +626,21 @@ nsGenericDOMDataNode::UnbindFromTree(PRB
   if (slots) {
     slots->mBindingParent = nsnull;
   }
 
   nsNodeUtils::ParentChainChanged(this);
 }
 
 nsIAtom *
-nsGenericDOMDataNode::GetIDAttributeName(PRInt32& aNameSpaceID) const
+nsGenericDOMDataNode::GetIDAttributeName() const
 {
-  aNameSpaceID = kNameSpaceID_Unknown;
   return nsnull;
 }
 
-PRBool
-nsGenericDOMDataNode::IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
-                                                 nsIAtom* aAtom) const
-{
-  return PR_FALSE;
-}
-
 already_AddRefed<nsINodeInfo>
 nsGenericDOMDataNode::GetExistingAttrNameFromQName(const nsAString& aStr) const
 {
   return nsnull;
 }
 
 nsresult
 nsGenericDOMDataNode::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttr,
--- a/content/base/src/nsGenericDOMDataNode.h
+++ b/content/base/src/nsGenericDOMDataNode.h
@@ -190,19 +190,17 @@ public:
 
   // Implementation for nsIContent
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent,
                               PRBool aCompileEventHandlers);
   virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
                               PRBool aNullParent = PR_TRUE);
 
-  virtual nsIAtom *GetIDAttributeName(PRInt32& aNamespaceId) const;
-  virtual PRBool IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
-                                            nsIAtom* aAtom) const;
+  virtual nsIAtom *GetIDAttributeName() const;
   virtual already_AddRefed<nsINodeInfo> GetExistingAttrNameFromQName(const nsAString& aStr) const;
   nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
                    const nsAString& aValue, PRBool aNotify)
   {
     return SetAttr(aNameSpaceID, aName, nsnull, aValue, aNotify);
   }
   virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
                            nsIAtom* aPrefix, const nsAString& aValue,
--- a/content/base/src/nsGenericElement.cpp
+++ b/content/base/src/nsGenericElement.cpp
@@ -2255,20 +2255,19 @@ nsGenericElement::DispatchDOMEvent(nsEve
   return nsEventDispatcher::DispatchDOMEvent(static_cast<nsIContent*>(this),
                                              aEvent, aDOMEvent,
                                              aPresContext, aEventStatus);
 }
 
 nsIAtom*
 nsGenericElement::GetID() const
 {
-  PRInt32 namespaceID;
-  nsIAtom* IDName = GetIDAttributeName(namespaceID);
+  nsIAtom* IDName = GetIDAttributeName();
   if (IDName) {
-    const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(IDName, namespaceID);
+    const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(IDName);
     if (attrVal){
       if (attrVal->Type() == nsAttrValue::eAtom) {
         return attrVal->GetAtomValue();
       }
       if(attrVal->IsEmptyString()){
         return nsnull;
       }
       // Check if the ID has been stored as a string.
@@ -2321,36 +2320,19 @@ nsGenericElement::IsAttributeMapped(cons
 nsChangeHint
 nsGenericElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
                                          PRInt32 aModType) const
 {
   return nsChangeHint(0);
 }
 
 nsIAtom *
-nsGenericElement::GetIDAttributeName(PRInt32& aNameSpaceID) const
+nsGenericElement::GetIDAttributeName() const
 {
-  aNameSpaceID = kNameSpaceID_None;
-  nsIAtom* idAtom = mNodeInfo->GetIDAttributeAtom();
-  if (idAtom && HasAttr(aNameSpaceID, idAtom)) {
-    return idAtom;
-  }
-
-  aNameSpaceID = kNameSpaceID_XML;
-  return nsGkAtoms::id;
-}
-
-PRBool
-nsGenericElement::IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
-                                             nsIAtom* aAtom) const
-{
-  return (aNameSpaceID == kNameSpaceID_None &&
-          aAtom == mNodeInfo->GetIDAttributeAtom()) ||
-         (aNameSpaceID == kNameSpaceID_XML &&
-          aAtom == nsGkAtoms::id);
+  return mNodeInfo->GetIDAttributeAtom();
 }
 
 nsIAtom *
 nsGenericElement::GetClassAttributeName() const
 {
   return nsnull;
 }
 
@@ -3665,18 +3647,18 @@ nsGenericElement::SetAttrAndNotify(PRInt
 }
 
 PRBool
 nsGenericElement::ParseAttribute(PRInt32 aNamespaceID,
                                  nsIAtom* aAttribute,
                                  const nsAString& aValue,
                                  nsAttrValue& aResult)
 {
-  if (IsPotentialIDAttributeName(aNamespaceID, aAttribute) &&
-      !aValue.IsEmpty()) {
+  if (aNamespaceID == kNameSpaceID_None &&
+      aAttribute == GetIDAttributeName() && !aValue.IsEmpty()) {
     // Store id as an atom.  id="" means that the element has no id,
     // not that it has an emptystring as the id.
     aResult.ParseAtom(aValue);
     return PR_TRUE;
   }
 
   return PR_FALSE;
 }
--- a/content/base/src/nsGenericElement.h
+++ b/content/base/src/nsGenericElement.h
@@ -378,19 +378,17 @@ public:
   virtual nsresult GetSystemEventGroup(nsIDOMEventGroup** aGroup);
 
   // nsIContent interface methods
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent,
                               PRBool aCompileEventHandlers);
   virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
                               PRBool aNullParent = PR_TRUE);
-  virtual nsIAtom *GetIDAttributeName(PRInt32& aNameSpaceID) const;
-  virtual PRBool IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
-                                            nsIAtom* aAtom) const;
+  virtual nsIAtom *GetIDAttributeName() const;
   virtual nsIAtom *GetClassAttributeName() const;
   virtual already_AddRefed<nsINodeInfo> GetExistingAttrNameFromQName(const nsAString& aStr) const;
   nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
                    const nsAString& aValue, PRBool aNotify)
   {
     return SetAttr(aNameSpaceID, aName, nsnull, aValue, aNotify);
   }
   virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom* aPrefix,
--- a/content/events/src/nsXMLEventsElement.cpp
+++ b/content/events/src/nsXMLEventsElement.cpp
@@ -41,50 +41,38 @@
 #include "nsIDocument.h"
 
 class nsXMLEventsElement : public nsXMLElement {
 public:
   nsXMLEventsElement(nsINodeInfo *aNodeInfo);
   virtual ~nsXMLEventsElement();
   NS_FORWARD_NSIDOMNODE(nsXMLElement::)
 
-  virtual nsIAtom *GetIDAttributeName(PRInt32& aNameSpaceID) const;
-  virtual PRBool IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
-                                            nsIAtom* aAtom) const;
+  virtual nsIAtom *GetIDAttributeName() const;
   virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, 
                            nsIAtom* aPrefix, const nsAString& aValue,
                            PRBool aNotify);
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
 };
 
 nsXMLEventsElement::nsXMLEventsElement(nsINodeInfo *aNodeInfo)
   : nsXMLElement(aNodeInfo)
 {
 }
 
 nsXMLEventsElement::~nsXMLEventsElement()
 {
 }
 
 nsIAtom *
-nsXMLEventsElement::GetIDAttributeName(PRInt32& aNameSpaceID) const
+nsXMLEventsElement::GetIDAttributeName() const
 {
-  if (HasAttr(kNameSpaceID_None, nsGkAtoms::id)) {
-    aNameSpaceID = kNameSpaceID_None;
+  if (mNodeInfo->Equals(nsGkAtoms::listener))
     return nsGkAtoms::id;
-  }
-  return nsGenericElement::GetIDAttributeName(aNameSpaceID);
-}
-
-PRBool
-nsXMLEventsElement::IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
-                                               nsIAtom* aAtom) const
-{
-  return (aNameSpaceID == kNameSpaceID_None && aAtom == nsGkAtoms::id) ||
-    nsGenericElement::IsPotentialIDAttributeName(aNameSpaceID, aAtom);
+  return nsXMLElement::GetIDAttributeName();
 }
 
 nsresult
 nsXMLEventsElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom* aPrefix,
                             const nsAString& aValue, PRBool aNotify)
 {
   if (mNodeInfo->Equals(nsGkAtoms::listener) && 
       mNodeInfo->GetDocument() && aNameSpaceID == kNameSpaceID_None && 
--- a/content/events/src/nsXMLEventsManager.cpp
+++ b/content/events/src/nsXMLEventsManager.cpp
@@ -372,21 +372,30 @@ nsXMLEventsManager::AttributeChanged(nsI
   }
   else {
     if (aContent->NodeInfo()->Equals(nsGkAtoms::listener,
                                      kNameSpaceID_XMLEvents)) {
       RemoveListener(aContent);
       AddXMLEventsContent(aContent);
       nsXMLEventsListener::InitXMLEventsListener(aDocument, this, aContent);
     }
-    else if (aContent->IsPotentialIDAttributeName(aNameSpaceID, aAttribute)) {
-      //Remove possible listener
-      mListeners.Enumerate(EnumAndSetIncomplete, aContent);
-      //Add new listeners
-      AddListeners(aDocument);
+    else if (aContent->GetIDAttributeName() == aAttribute) {
+      if (aModType == nsIDOMMutationEvent::REMOVAL)
+        mListeners.Enumerate(EnumAndSetIncomplete, aContent);
+      else if (aModType == nsIDOMMutationEvent::MODIFICATION) {
+        //Remove possible listener
+        mListeners.Enumerate(EnumAndSetIncomplete, aContent);
+        //Add new listeners
+        AddListeners(aDocument);
+      }
+      else {
+        //If we are adding the ID attribute, we must check whether we can 
+        //add new listeners
+        AddListeners(aDocument);
+      }
     }
   }
 }
 
 void
 nsXMLEventsManager::ContentAppended(nsIDocument* aDocument,
                                     nsIContent* aContainer,
                                     PRInt32 aNewIndexInContainer)
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -1488,31 +1488,19 @@ nsGenericHTMLElement::UnsetAttr(PRInt32 
 
 const nsAttrValue*
 nsGenericHTMLElement::GetClasses() const
 {
   return mAttrsAndChildren.GetAttr(nsGkAtoms::_class);
 }
 
 nsIAtom *
-nsGenericHTMLElement::GetIDAttributeName(PRInt32& aNameSpaceID) const
+nsGenericHTMLElement::GetIDAttributeName() const
 {
-  if (HasAttr(kNameSpaceID_None, nsGkAtoms::id)) {
-    aNameSpaceID = kNameSpaceID_None;
-    return nsGkAtoms::id;
-  }
-  return nsGenericElement::GetIDAttributeName(aNameSpaceID);
-}
-
-PRBool
-nsGenericHTMLElement::IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
-                                                 nsIAtom* aAtom) const
-{
-  return (aNameSpaceID == kNameSpaceID_None && aAtom == nsGkAtoms::id) ||
-    nsGenericElement::IsPotentialIDAttributeName(aNameSpaceID, aAtom);
+  return nsGkAtoms::id;
 }
 
 nsIAtom *
 nsGenericHTMLElement::GetClassAttributeName() const
 {
   return nsGkAtoms::_class;
 }
 
--- a/content/html/content/src/nsGenericHTMLElement.h
+++ b/content/html/content/src/nsGenericHTMLElement.h
@@ -236,19 +236,17 @@ public:
   {
     return mAttrsAndChildren.GetAttr(aAttr);
   }
   virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
 
   virtual void UpdateEditableState();
 
   virtual const nsAttrValue* GetClasses() const;
-  virtual nsIAtom *GetIDAttributeName(PRInt32& aNameSpaceID) const;
-  virtual PRBool IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
-                                            nsIAtom* aAtom) const;
+  virtual nsIAtom *GetIDAttributeName() const;
   virtual nsIAtom *GetClassAttributeName() const;
   NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
   virtual nsICSSStyleRule* GetInlineStyleRule();
   NS_IMETHOD SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify);
   already_AddRefed<nsIURI> GetBaseURI() const;
 
   virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
                                 nsIAtom* aAttribute,
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -1371,17 +1371,18 @@ nsHTMLDocument::AttributeWillChange(nsIC
     nsIAtom* name = IsNamedItem(aContent);
     if (name) {
       nsresult rv = RemoveFromNameTable(name, aContent);
 
       if (NS_FAILED(rv)) {
         return;
       }
     }
-  } else if (aContent->IsPotentialIDAttributeName(aNameSpaceID, aAttribute)) {
+  } else if (aAttribute == aContent->GetIDAttributeName() &&
+             aNameSpaceID == kNameSpaceID_None) {
     nsresult rv = RemoveFromIdTable(aContent);
 
     if (NS_FAILED(rv)) {
       return;
     }
   }
 
   nsDocument::AttributeWillChange(aContent, aNameSpaceID, aAttribute);
@@ -1400,17 +1401,18 @@ nsHTMLDocument::AttributeChanged(nsIDocu
 
   if (!IsXHTML() && aAttribute == nsGkAtoms::name &&
       aNameSpaceID == kNameSpaceID_None) {
 
     nsIAtom* name = IsNamedItem(aContent);
     if (name) {
       UpdateNameTableEntry(name, aContent);
     }
-  } else if (aContent->IsPotentialIDAttributeName(aNameSpaceID, aAttribute)) {
+  } else if (aAttribute == aContent->GetIDAttributeName() &&
+             aNameSpaceID == kNameSpaceID_None) {
     nsIAtom* id = aContent->GetID();
     if (id) {
       UpdateIdTableEntry(id, aContent);
     }
   }
 }
 
 PRBool
--- a/content/svg/content/src/nsSVGElement.cpp
+++ b/content/svg/content/src/nsSVGElement.cpp
@@ -121,32 +121,20 @@ NS_INTERFACE_MAP_BEGIN(nsSVGElement)
 NS_INTERFACE_MAP_END_INHERITING(nsGenericElement)
 
 //----------------------------------------------------------------------
 // Implementation
   
 //----------------------------------------------------------------------
 // nsIContent methods
 
-nsIAtom*
-nsSVGElement::GetIDAttributeName(PRInt32& aNameSpaceID) const
+nsIAtom *
+nsSVGElement::GetIDAttributeName() const
 {
-  if (HasAttr(kNameSpaceID_None, nsGkAtoms::id)) {
-    aNameSpaceID = kNameSpaceID_None;
-    return nsGkAtoms::id;
-  }
-  return nsGenericElement::GetIDAttributeName(aNameSpaceID);
-}
-
-PRBool
-nsSVGElement::IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
-                                         nsIAtom* aAtom) const
-{
-  return (aNameSpaceID == kNameSpaceID_None && aAtom == nsGkAtoms::id) ||
-    nsGenericElement::IsPotentialIDAttributeName(aNameSpaceID, aAtom);
+  return nsGkAtoms::id;
 }
 
 nsIAtom *
 nsSVGElement::GetClassAttributeName() const
 {
   return nsGkAtoms::_class;
 }
 
--- a/content/svg/content/src/nsSVGElement.h
+++ b/content/svg/content/src/nsSVGElement.h
@@ -66,19 +66,17 @@ protected:
   virtual ~nsSVGElement();
 
 public:
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIContent interface methods
 
-  virtual nsIAtom *GetIDAttributeName(PRInt32& aNameSpaceID) const;
-  virtual PRBool IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
-                                            nsIAtom* aAtom) const;
+  virtual nsIAtom *GetIDAttributeName() const;
   virtual nsIAtom *GetClassAttributeName() const;
   virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
                              PRBool aNotify);
 
   virtual PRBool IsNodeOfType(PRUint32 aFlags) const;
 
   NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
   NS_IMETHOD SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify);
--- a/content/xtf/src/nsXTFElementWrapper.cpp
+++ b/content/xtf/src/nsXTFElementWrapper.cpp
@@ -260,31 +260,20 @@ nsXTFElementWrapper::RemoveChildAt(PRUin
     GetXTFElement()->WillRemoveChild(aIndex);
   rv = nsXTFElementWrapperBase::RemoveChildAt(aIndex, aNotify);
   if (mNotificationMask & nsIXTFElement::NOTIFY_CHILD_REMOVED)
     GetXTFElement()->ChildRemoved(aIndex);
   return rv;
 }
 
 nsIAtom *
-nsXTFElementWrapper::GetIDAttributeName(PRInt32& aNameSpaceID) const
+nsXTFElementWrapper::GetIDAttributeName() const
 {
-  if (HasAttr(kNameSpaceID_None, nsGkAtoms::id)) {
-    aNameSpaceID = kNameSpaceID_None;
-    return nsGkAtoms::id;
-  }
-  return nsXTFElementWrapperBase::GetIDAttributeName(aNameSpaceID);
-}
-
-PRBool
-nsXTFElementWrapper::IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
-                                                nsIAtom* aAtom) const
-{
-  return (aNameSpaceID == kNameSpaceID_None && aAtom == nsGkAtoms::id) ||
-    nsXTFElementWrapperBase::IsPotentialIDAttributeName(aNameSpaceID, aAtom);
+  // XXX:
+  return nsGkAtoms::id;
 }
 
 nsresult
 nsXTFElementWrapper::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
                              nsIAtom* aPrefix, const nsAString& aValue,
                              PRBool aNotify)
 {
   nsresult rv;
--- a/content/xtf/src/nsXTFElementWrapper.h
+++ b/content/xtf/src/nsXTFElementWrapper.h
@@ -73,19 +73,17 @@ public:
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent,
                               PRBool aCompileEventHandlers);
   virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
                               PRBool aNullParent = PR_TRUE);
   nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
                          PRBool aNotify);
   nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
-  virtual nsIAtom *GetIDAttributeName(PRInt32& aNameSpaceID) const;
-  virtual PRBool IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
-                                            nsIAtom* aAtom) const;
+  nsIAtom *GetIDAttributeName() const;
   nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
                    nsIAtom* aPrefix, const nsAString& aValue,
                    PRBool aNotify);
   PRBool GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, 
                  nsAString& aResult) const;
   PRBool HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const;
   virtual PRBool AttrValueIs(PRInt32 aNameSpaceID, nsIAtom* aName,
                              const nsAString& aValue,
--- a/content/xul/content/src/nsXULElement.cpp
+++ b/content/xul/content/src/nsXULElement.cpp
@@ -1628,19 +1628,17 @@ nsXULElement::InsertChildAt(nsIContent* 
   return nsGenericElement::InsertChildAt(aKid, aIndex, aNotify);
 }
 
 
 /// XXX GetID must be defined here because we have proto attrs.
 nsIAtom*
 nsXULElement::GetID() const
 {
-    PRInt32 namespaceID;
-    nsIAtom* IDName = GetIDAttributeName(namespaceID);
-    const nsAttrValue* attrVal = FindLocalOrProtoAttr(namespaceID, IDName);
+    const nsAttrValue* attrVal = FindLocalOrProtoAttr(kNameSpaceID_None, nsGkAtoms::id);
 
     NS_ASSERTION(!attrVal ||
                  attrVal->Type() == nsAttrValue::eAtom ||
                  (attrVal->Type() == nsAttrValue::eString &&
                   attrVal->GetStringValue().IsEmpty()),
                  "unexpected attribute type");
 
     if (attrVal && attrVal->Type() == nsAttrValue::eAtom) {
@@ -1736,31 +1734,19 @@ nsXULElement::GetAttributeChangeHint(con
 
 NS_IMETHODIMP_(PRBool)
 nsXULElement::IsAttributeMapped(const nsIAtom* aAttribute) const
 {
     return PR_FALSE;
 }
 
 nsIAtom *
-nsXULElement::GetIDAttributeName(PRInt32& aNameSpaceID) const
+nsXULElement::GetIDAttributeName() const
 {
-  if (HasAttr(kNameSpaceID_None, nsGkAtoms::id)) {
-    aNameSpaceID = kNameSpaceID_None;
     return nsGkAtoms::id;
-  }
-  return nsGenericElement::GetIDAttributeName(aNameSpaceID);
-}
-
-PRBool
-nsXULElement::IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
-                                         nsIAtom* aAtom) const
-{
-  return (aNameSpaceID == kNameSpaceID_None && aAtom == nsGkAtoms::id) ||
-    nsGenericElement::IsPotentialIDAttributeName(aNameSpaceID, aAtom);
 }
 
 nsIAtom *
 nsXULElement::GetClassAttributeName() const
 {
     return nsGkAtoms::_class;
 }
 
--- a/content/xul/content/src/nsXULElement.h
+++ b/content/xul/content/src/nsXULElement.h
@@ -500,19 +500,17 @@ public:
     virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
     virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
                                    PRBool aNotify);
 
     // nsIContent
     virtual void UnbindFromTree(PRBool aDeep, PRBool aNullParent);
     virtual void SetNativeAnonymous(PRBool aAnonymous);
     virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
-    virtual nsIAtom *GetIDAttributeName(PRInt32& aNameSpaceID) const;
-    virtual PRBool IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
-                                              nsIAtom* aAtom) const;
+    virtual nsIAtom *GetIDAttributeName() const;
     virtual nsIAtom *GetClassAttributeName() const;
     virtual PRBool GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
                            nsAString& aResult) const;
     virtual PRBool HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const;
     virtual PRBool AttrValueIs(PRInt32 aNameSpaceID, nsIAtom* aName,
                                const nsAString& aValue,
                                nsCaseTreatment aCaseSensitive) const;
     virtual PRBool AttrValueIs(PRInt32 aNameSpaceID, nsIAtom* aName,
--- a/content/xul/document/src/nsXULDocument.cpp
+++ b/content/xul/document/src/nsXULDocument.cpp
@@ -924,18 +924,17 @@ nsXULDocument::AttributeChanged(nsIDocum
                                 PRUint32 aStateMask)
 {
     NS_ASSERTION(aDocument == this, "unexpected doc");
 
     nsresult rv;
 
     // XXXbz check aNameSpaceID, dammit!
     // First see if we need to update our element map.
-    if (aElement->IsPotentialIDAttributeName(aNameSpaceID, aAttribute) ||
-        (aAttribute == nsGkAtoms::ref && aNameSpaceID == kNameSpaceID_None)) {
+    if ((aAttribute == nsGkAtoms::id) || (aAttribute == nsGkAtoms::ref)) {
 
         rv = mElementMap.Enumerate(RemoveElementsFromMapByContent, aElement);
         if (NS_FAILED(rv)) return;
 
         // That'll have removed _both_ the 'ref' and 'id' entries from
         // the map. So add 'em back now.
         rv = AddElementToMap(aElement);
         if (NS_FAILED(rv)) return;
@@ -1753,65 +1752,60 @@ nsXULDocument::GetTemplateBuilderFor(nsI
         mTemplateBuilderTable->Get(aContent, aResult);
     }
     else
         *aResult = nsnull;
 
     return NS_OK;
 }
 
+// Attributes that are used with getElementById() and the
+// resource-to-element map.
+nsIAtom** nsXULDocument::kIdentityAttrs[] =
+{
+    &nsGkAtoms::id,
+    &nsGkAtoms::ref,
+    nsnull
+};
+
 nsresult
 nsXULDocument::AddElementToMap(nsIContent* aElement)
 {
-    // Look at the element's ID and 'ref' attributes, and if set,
+    // Look at the element's 'id' and 'ref' attributes, and if set,
     // add pointers in the resource-to-element map to the element.
     nsresult rv;
-    nsIAtom* idAtom = aElement->GetID();
-    if (idAtom) {
-        nsAutoString idStr;
-        idAtom->ToString(idStr);
-        if (!idStr.IsEmpty()) {
-            rv = mElementMap.Add(idStr, aElement);
-            NS_ENSURE_SUCCESS(rv, rv);
+
+    for (PRInt32 i = 0; kIdentityAttrs[i] != nsnull; ++i) {
+        nsAutoString value;
+        aElement->GetAttr(kNameSpaceID_None, *kIdentityAttrs[i], value);
+        if (!value.IsEmpty()) {
+            rv = mElementMap.Add(value, aElement);
+            if (NS_FAILED(rv)) return rv;
         }
     }
 
-    nsAutoString refvalue;
-    aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::ref, refvalue);
-    if (!refvalue.IsEmpty()) {
-        rv = mElementMap.Add(refvalue, aElement);
-        NS_ENSURE_SUCCESS(rv, rv);
-    }
-
     return NS_OK;
 }
 
 
 nsresult
 nsXULDocument::RemoveElementFromMap(nsIContent* aElement)
 {
     // Remove the element from the resource-to-element map.
     nsresult rv;
-    nsIAtom* idAtom = aElement->GetID();
-    if (idAtom) {
-        nsAutoString idStr;
-        idAtom->ToString(idStr);
-        if (!idStr.IsEmpty()) {
-            rv = mElementMap.Remove(idStr, aElement);
-            NS_ENSURE_SUCCESS(rv, rv);
+
+    for (PRInt32 i = 0; kIdentityAttrs[i] != nsnull; ++i) {
+        nsAutoString value;
+        aElement->GetAttr(kNameSpaceID_None, *kIdentityAttrs[i], value);
+        if (!value.IsEmpty()) {
+            rv = mElementMap.Remove(value, aElement);
+            if (NS_FAILED(rv)) return rv;
         }
     }
 
-    nsAutoString refvalue;
-    aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::ref, refvalue);
-    if (!refvalue.IsEmpty()) {
-        rv = mElementMap.Remove(refvalue, aElement);
-        NS_ENSURE_SUCCESS(rv, rv);
-    }
-
     return NS_OK;
 }
 
 
 PRIntn
 nsXULDocument::RemoveElementsFromMapByContent(const PRUnichar* aID,
                                               nsIContent* aElement,
                                               void* aClosure)
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -10123,18 +10123,17 @@ nsCSSFrameConstructor::AttributeChanged(
 
 #if 0
   NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
      ("HTMLStyleSheet::AttributeChanged: content=%p[%s] frame=%p",
       aContent, ContentTag(aContent, 0), frame));
 #endif
 
   // the style tag has its own interpretation based on aHint 
-  nsChangeHint hint = (aNameSpaceID == kNameSpaceID_None)
-    ? aContent->GetAttributeChangeHint(aAttribute, aModType) : nsChangeHint(0);
+  nsChangeHint hint = aContent->GetAttributeChangeHint(aAttribute, aModType);
 
   PRBool reframe = (hint & nsChangeHint_ReconstructFrame) != 0;
 
 #ifdef MOZ_XUL
   // The following listbox widget trap prevents offscreen listbox widget
   // content from being removed and re-inserted (which is what would
   // happen otherwise).
   if (!primaryFrame && !reframe) {
@@ -10159,46 +10158,41 @@ nsCSSFrameConstructor::AttributeChanged(
         rootBox->AddTooltipSupport(aContent);
     }
   }
 
 #endif // MOZ_XUL
 
   if (primaryFrame) {
     // See if we have appearance information for a theme.
-    if (aNameSpaceID == kNameSpaceID_None) {
-      const nsStyleDisplay* disp = primaryFrame->GetStyleDisplay();
-      if (disp->mAppearance) {
-        nsPresContext* presContext = mPresShell->GetPresContext();
-        nsITheme *theme = presContext->GetTheme();
-        if (theme && theme->ThemeSupportsWidget(presContext, primaryFrame,
-                                                disp->mAppearance)) {
-          PRBool repaint = PR_FALSE;
-          theme->WidgetStateChanged(primaryFrame, disp->mAppearance, aAttribute,
-                                    &repaint);
-          if (repaint)
-            NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
-        }
+    const nsStyleDisplay* disp = primaryFrame->GetStyleDisplay();
+    if (disp->mAppearance) {
+      nsPresContext* presContext = mPresShell->GetPresContext();
+      nsITheme *theme = presContext->GetTheme();
+      if (theme && theme->ThemeSupportsWidget(presContext, primaryFrame, disp->mAppearance)) {
+        PRBool repaint = PR_FALSE;
+        theme->WidgetStateChanged(primaryFrame, disp->mAppearance, aAttribute, &repaint);
+        if (repaint)
+          NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
       }
     }
    
     // let the frame deal with it now, so we don't have to deal later
     result = primaryFrame->AttributeChanged(aNameSpaceID, aAttribute,
                                             aModType);
     // XXXwaterson should probably check for special IB siblings
     // here, and propagate the AttributeChanged notification to
     // them, as well. Currently, inline frames don't do anything on
     // this notification, so it's not that big a deal.
   }
 
   // See if we can optimize away the style re-resolution -- must be called after
   // the frame's AttributeChanged() in case it does something that affects the style
   nsFrameManager *frameManager = shell->FrameManager();
   nsReStyleHint rshint = frameManager->HasAttributeDependentStyle(aContent,
-                                                                  aNameSpaceID,
                                                                   aAttribute,
                                                                   aModType,
                                                                   aStateMask);
 
   PostRestyleEvent(aContent, rshint, hint);
 
   return result;
 }
--- a/layout/base/nsFrameManager.cpp
+++ b/layout/base/nsFrameManager.cpp
@@ -1440,24 +1440,22 @@ nsFrameManager::ComputeStyleChangeFor(ns
     frame = frame2;
   } while (frame2);
   return topLevelChange;
 }
 
 
 nsReStyleHint
 nsFrameManager::HasAttributeDependentStyle(nsIContent *aContent,
-                                           PRInt32 aNameSpaceID,
                                            nsIAtom *aAttribute,
                                            PRInt32 aModType,
                                            PRUint32 aStateMask)
 {
   nsReStyleHint hint = mStyleSet->HasAttributeDependentStyle(GetPresContext(),
                                                              aContent,
-                                                             aNameSpaceID,
                                                              aAttribute,
                                                              aModType,
                                                              aStateMask);
 
   if (aAttribute == nsGkAtoms::style) {
     // Perhaps should check that it's XUL, SVG, (or HTML) namespace, but
     // it doesn't really matter.  Or we could even let
     // HTMLCSSStyleSheetImpl::HasAttributeDependentStyle handle it.
--- a/layout/base/nsFrameManager.h
+++ b/layout/base/nsFrameManager.h
@@ -186,17 +186,16 @@ public:
    */
   NS_HIDDEN_(nsChangeHint)
     ComputeStyleChangeFor(nsIFrame* aFrame,
                           nsStyleChangeList* aChangeList,
                           nsChangeHint aMinChange);
 
   // Determine whether an attribute affects style
   NS_HIDDEN_(nsReStyleHint) HasAttributeDependentStyle(nsIContent *aContent,
-                                                       PRInt32 aNameSpaceID,
                                                        nsIAtom *aAttribute,
                                                        PRInt32 aModType,
                                                        PRUint32 aStateMask);
 
   /*
    * Capture/restore frame state for the frame subtree rooted at aFrame.
    * aState is the document state storage object onto which each frame
    * stores its state.
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -996,18 +996,16 @@ static PRBool AttrMatchesValue(const nsA
 // |aDependence| has two functions:
 //  * when non-null, it indicates that we're processing a negation,
 //    which is done only when SelectorMatches calls itself recursively
 //  * what it points to should be set to true whenever a test is skipped
 //    because of aStateMask or aAttribute
 static PRBool SelectorMatches(RuleProcessorData &data,
                               nsCSSSelector* aSelector,
                               PRInt32 aStateMask, // states NOT to test
-                              PRInt32 aNameSpaceID, // the namespace of the
-                                                    // attribute NOT to test
                               nsIAtom* aAttribute, // attribute NOT to test
                               PRBool* const aDependence = nsnull) 
 
 {
   // namespace/tag match
   if ((kNameSpaceID_Unknown != aSelector->mNameSpace &&
        data.mNameSpaceID != aSelector->mNameSpace) ||
       (aSelector->mTag && aSelector->mTag != data.mContentTag)) {
@@ -1319,19 +1317,19 @@ static PRBool SelectorMatches(RuleProces
       result = PR_FALSE;
     } else {
       NS_ASSERTION(data.mContent,
                    "Must have content if either data.mHasAttributes or "
                    "aAttribute is set!");
       result = PR_TRUE;
       nsAttrSelector* attr = aSelector->mAttrList;
       do {
-        if (attr->mAttr == aAttribute &&
-            (attr->mNameSpace == aNameSpaceID ||
-             attr->mNameSpace == kNameSpaceID_Unknown)) {
+        if (attr->mAttr == aAttribute) {
+          // XXX we should really have a namespace, not just an attr
+          // name, in HasAttributeDependentStyle!
           result = PR_TRUE;
           if (aDependence)
             *aDependence = PR_TRUE;
         }
         else if (attr->mNameSpace == kNameSpaceID_Unknown) {
           // Attr selector with a wildcard namespace.  We have to examine all
           // the attributes on our content node....  This sort of selector is
           // essentially a boolean OR, over all namespaces, of equivalent attr
@@ -1393,19 +1391,18 @@ static PRBool SelectorMatches(RuleProces
         attr = attr->mNext;
       } while (attr && result);
     }
   }
   nsAtomList* IDList = aSelector->mIDList;
   if (result && IDList) {
     // test for ID match
     result = PR_FALSE;
-    PRInt32 namespaceID;
-    if (aAttribute &&
-        data.mContent->IsPotentialIDAttributeName(namespaceID, aAttribute)) {
+
+    if (aAttribute && aAttribute == data.mContent->GetIDAttributeName()) {
       result = PR_TRUE;
       if (aDependence)
         *aDependence = PR_TRUE;
     }
     else if (nsnull != data.mContentID) {
       // case sensitivity: bug 93371
       const PRBool isCaseSensitive =
         data.mCompatMode != eCompatibility_NavQuirks;
@@ -1433,18 +1430,17 @@ static PRBool SelectorMatches(RuleProces
           IDList = IDList->mNext;
         } while (IDList);
       }
     }
   }
     
   if (result && aSelector->mClassList) {
     // test for class match
-    if (aAttribute && aAttribute == data.mContent->GetClassAttributeName() &&
-        aNameSpaceID == kNameSpaceID_None) {
+    if (aAttribute && aAttribute == data.mContent->GetClassAttributeName()) {
       result = PR_TRUE;
       if (aDependence)
         *aDependence = PR_TRUE;
     }
     else {
       // case sensitivity: bug 93371
       const PRBool isCaseSensitive =
         data.mCompatMode != eCompatibility_NavQuirks;
@@ -1461,17 +1457,17 @@ static PRBool SelectorMatches(RuleProces
     }
   }
   
   // apply SelectorMatches to the negated selectors in the chain
   if (!isNegated) {
     for (nsCSSSelector *negation = aSelector->mNegations;
          result && negation; negation = negation->mNegations) {
       PRBool dependence = PR_FALSE;
-      result = !SelectorMatches(data, negation, aStateMask, aNameSpaceID,
+      result = !SelectorMatches(data, negation, aStateMask,
                                 aAttribute, &dependence);
       // If the selector does match due to the dependence on aStateMask
       // or aAttribute, then we want to keep result true so that the
       // final result of SelectorMatches is true.  Doing so tells
       // StateEnumFunc or AttributeEnumFunc that there is a dependence
       // on the state or attribute.
       result = result || dependence;
     }
@@ -1535,17 +1531,17 @@ static PRBool SelectorMatchesTree(RulePr
                                         &prevdata->mCompatMode);
           prevdata->mParentData = data;    
         }
       }
     }
     if (! data) {
       return PR_FALSE;
     }
-    if (SelectorMatches(*data, selector, 0, kNameSpaceID_Unknown, nsnull)) {
+    if (SelectorMatches(*data, selector, 0, nsnull)) {
       // to avoid greedy matching, we need to recur if this is a
       // descendant combinator and the next combinator is not
       if ((NS_IS_GREEDY_OPERATOR(selector->mOperator)) &&
           (selector->mNext) &&
           (!NS_IS_GREEDY_OPERATOR(selector->mNext->mOperator))) {
 
         // pretend the selector didn't match, and step through content
         // while testing the same selector
@@ -1572,17 +1568,17 @@ static PRBool SelectorMatchesTree(RulePr
   return PR_TRUE; // all the selectors matched.
 }
 
 static void ContentEnumFunc(nsICSSStyleRule* aRule, nsCSSSelector* aSelector,
                             void* aData)
 {
   ElementRuleProcessorData* data = (ElementRuleProcessorData*)aData;
 
-  if (SelectorMatches(*data, aSelector, 0, kNameSpaceID_Unknown, nsnull)) {
+  if (SelectorMatches(*data, aSelector, 0, nsnull)) {
     nsCSSSelector *next = aSelector->mNext;
     if (!next || SelectorMatchesTree(*data, next)) {
       // for performance, require that every implementation of
       // nsICSSStyleRule return the same pointer for nsIStyleRule (why
       // would anything multiply inherit nsIStyleRule anyway?)
 #ifdef DEBUG
       nsCOMPtr<nsIStyleRule> iRule = do_QueryInterface(aRule);
       NS_ASSERTION(static_cast<nsIStyleRule*>(aRule) == iRule.get(),
@@ -1625,17 +1621,17 @@ static void PseudoEnumFunc(nsICSSStyleRu
 
   if (matches) {
     nsCSSSelector *selector = aSelector->mNext;
 
     if (selector) { // test next selector specially
       if (PRUnichar('+') == selector->mOperator) {
         return; // not valid here, can't match
       }
-      if (SelectorMatches(*data, selector, 0, kNameSpaceID_Unknown, nsnull)) {
+      if (SelectorMatches(*data, selector, 0, nsnull)) {
         selector = selector->mNext;
       }
       else {
         if (PRUnichar('>') == selector->mOperator) {
           return; // immediate parent didn't match
         }
       }
     }
@@ -1696,18 +1692,17 @@ PR_STATIC_CALLBACK(PRBool) StateEnumFunc
 
   nsReStyleHint possibleChange = IsSiblingOperator(selector->mOperator) ?
     eReStyle_LaterSiblings : eReStyle_Self;
 
   // If enumData->change already includes all the bits of possibleChange, don't
   // bother calling SelectorMatches, since even if it returns false
   // enumData->change won't change.
   if ((possibleChange & ~(enumData->change)) &&
-      SelectorMatches(*data, selector, data->mStateMask, kNameSpaceID_Unknown,
-                      nsnull) &&
+      SelectorMatches(*data, selector, data->mStateMask, nsnull) &&
       SelectorMatchesTree(*data, selector->mNext)) {
     enumData->change = nsReStyleHint(enumData->change | possibleChange);
   }
 
   return PR_TRUE;
 }
 
 NS_IMETHODIMP
@@ -1751,18 +1746,17 @@ PR_STATIC_CALLBACK(PRBool) AttributeEnum
 
   nsReStyleHint possibleChange = IsSiblingOperator(selector->mOperator) ?
     eReStyle_LaterSiblings : eReStyle_Self;
 
   // If enumData->change already includes all the bits of possibleChange, don't
   // bother calling SelectorMatches, since even if it returns false
   // enumData->change won't change.
   if ((possibleChange & ~(enumData->change)) &&
-      SelectorMatches(*data, selector, data->mStateMask, data->mNameSpaceID,
-                      data->mAttribute) &&
+      SelectorMatches(*data, selector, data->mStateMask, data->mAttribute) &&
       SelectorMatchesTree(*data, selector->mNext)) {
     enumData->change = nsReStyleHint(enumData->change | possibleChange);
   }
 
   return PR_TRUE;
 }
 
 NS_IMETHODIMP
@@ -1773,17 +1767,16 @@ nsCSSRuleProcessor::HasAttributeDependen
                   "content must be element");
 
   AttributeEnumData data(aData);
 
   // Since we always have :-moz-any-link (and almost always have :link
   // and :visited rules from prefs), rather than hacking AddRule below
   // to add |href| to the hash, we'll just handle it here.
   if (aData->mAttribute == nsGkAtoms::href &&
-      aData->mNameSpaceID == kNameSpaceID_None &&
       aData->mIsHTMLContent &&
       (aData->mContentTag == nsGkAtoms::a ||
        aData->mContentTag == nsGkAtoms::area ||
        aData->mContentTag == nsGkAtoms::link)) {
     data.change = nsReStyleHint(data.change | eReStyle_Self);
   }
   // XXX What about XLinks?
   // XXXbz now that :link and :visited are also states, do we need a
@@ -1791,23 +1784,21 @@ nsCSSRuleProcessor::HasAttributeDependen
 
   RuleCascadeData* cascade = GetRuleCascade(aData->mPresContext);
 
   // We do the same thing for attributes that we do for state selectors
   // (see HasStateDependentStyle), except that instead of one big list
   // we have a hashtable with a per-attribute list.
 
   if (cascade) {
-    if (aData->mContent->IsPotentialIDAttributeName(aData->mNameSpaceID,
-                                                    aData->mAttribute)) {
+    if (aData->mAttribute == aData->mContent->GetIDAttributeName()) {
       cascade->mIDSelectors.EnumerateForwards(AttributeEnumFunc, &data);
     }
     
-    if (aData->mNameSpaceID == kNameSpaceID_None &&
-        aData->mAttribute == aData->mContent->GetClassAttributeName()) {
+    if (aData->mAttribute == aData->mContent->GetClassAttributeName()) {
       cascade->mClassSelectors.EnumerateForwards(AttributeEnumFunc, &data);
     }
 
     AttributeSelectorEntry *entry = static_cast<AttributeSelectorEntry*>
                                                (PL_DHashTableOperate(&cascade->mAttributeSelectors, aData->mAttribute,
                              PL_DHASH_LOOKUP));
     if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
       entry->mSelectors->EnumerateForwards(AttributeEnumFunc, &data);
--- a/layout/style/nsIStyleRuleProcessor.h
+++ b/layout/style/nsIStyleRuleProcessor.h
@@ -148,34 +148,29 @@ struct StateRuleProcessorData : public R
   }
   const PRInt32 mStateMask; // |HasStateDependentStyle| for which state(s)?
                             //  Constants defined in nsIEventStateManager.h .
 };
 
 struct AttributeRuleProcessorData : public RuleProcessorData {
   AttributeRuleProcessorData(nsPresContext* aPresContext,
                              nsIContent* aContent,
-                             PRInt32 aNameSpaceID,
                              nsIAtom* aAttribute,
                              PRInt32 aModType,
                              PRUint32 aStateMask)
     : RuleProcessorData(aPresContext, aContent, nsnull),
-      mNameSpaceID(aNameSpaceID),
       mAttribute(aAttribute),
       mModType(aModType),
       mStateMask(aStateMask)
   {
     NS_PRECONDITION(aContent, "null pointer");
   }
-  // |HasAttributeDependentStyle| for which attribute?
-  PRInt32  mNameSpaceID;
-  nsIAtom* mAttribute;
-
-  PRInt32  mModType;     // The type of modification (see nsIDOMMutationEvent).
-  PRUint32 mStateMask;   // The states that changed with the attr change.
+  nsIAtom* mAttribute; // |HasAttributeDependentStyle| for which attribute?
+  PRInt32 mModType;    // The type of modification (see nsIDOMMutationEvent).
+  PRUint32 mStateMask; // The states that changed with the attr change.
 };
 
 
 // IID for the nsIStyleRuleProcessor interface {015575fe-7b6c-11d3-ba05-001083023c2b}
 #define NS_ISTYLE_RULE_PROCESSOR_IID     \
 {0x015575fe, 0x7b6c, 0x11d3, {0xba, 0x05, 0x00, 0x10, 0x83, 0x02, 0x3c, 0x2b}}
 
 /* The style rule processor interface is a mechanism to separate the matching
--- a/layout/style/nsStyleSet.cpp
+++ b/layout/style/nsStyleSet.cpp
@@ -954,20 +954,20 @@ nsStyleSet::HasStateDependentStyle(nsPre
     result = data.mHint;
   }
 
   return result;
 }
 
 struct AttributeData : public AttributeRuleProcessorData {
   AttributeData(nsPresContext* aPresContext,
-                nsIContent* aContent, PRInt32 aNameSpaceID,
-                nsIAtom* aAttribute, PRInt32 aModType, PRUint32 aStateMask)
-    : AttributeRuleProcessorData(aPresContext, aContent, aNameSpaceID,
-                                 aAttribute, aModType, aStateMask),
+                nsIContent* aContent, nsIAtom* aAttribute, PRInt32 aModType,
+                PRUint32 aStateMask)
+    : AttributeRuleProcessorData(aPresContext, aContent, aAttribute, aModType,
+                                 aStateMask),
       mHint(nsReStyleHint(0))
   {}
   nsReStyleHint   mHint;
 }; 
 
 static PRBool
 SheetHasAttributeStyle(nsIStyleRuleProcessor* aProcessor, void *aData)
 {
@@ -977,33 +977,32 @@ SheetHasAttributeStyle(nsIStyleRuleProce
   data->mHint = nsReStyleHint(data->mHint | hint);
   return PR_TRUE; // continue
 }
 
 // Test if style is dependent on content state
 nsReStyleHint
 nsStyleSet::HasAttributeDependentStyle(nsPresContext* aPresContext,
                                        nsIContent*    aContent,
-                                       PRInt32        aNameSpaceID,
                                        nsIAtom*       aAttribute,
                                        PRInt32        aModType,
                                        PRUint32       aStateMask)
 {
   nsReStyleHint result = nsReStyleHint(0);
 
   if (aContent->IsNodeOfType(nsINode::eELEMENT) &&
       (mRuleProcessors[eAgentSheet]        ||
        mRuleProcessors[ePresHintSheet]     ||
        mRuleProcessors[eUserSheet]         ||
        mRuleProcessors[eHTMLPresHintSheet] ||
        mRuleProcessors[eDocSheet]          ||
        mRuleProcessors[eStyleAttrSheet]    ||
        mRuleProcessors[eOverrideSheet])) {
-    AttributeData data(aPresContext, aContent, aNameSpaceID, aAttribute,
-                       aModType, aStateMask);
+    AttributeData data(aPresContext, aContent, aAttribute, aModType,
+                       aStateMask);
     WalkRuleProcessors(SheetHasAttributeStyle, &data);
     result = data.mHint;
   }
 
   return result;
 }
 
 PRBool
--- a/layout/style/nsStyleSet.h
+++ b/layout/style/nsStyleSet.h
@@ -134,17 +134,16 @@ class nsStyleSet
   // Test if style is dependent on content state
   nsReStyleHint HasStateDependentStyle(nsPresContext* aPresContext,
                                        nsIContent*     aContent,
                                        PRInt32         aStateMask);
 
   // Test if style is dependent on the presence of an attribute.
   nsReStyleHint HasAttributeDependentStyle(nsPresContext* aPresContext,
                                            nsIContent*    aContent,
-                                           PRInt32        aNameSpaceID,
                                            nsIAtom*       aAttribute,
                                            PRInt32        aModType,
                                            PRUint32       aStateMask);
 
   // APIs for registering objects that can supply additional
   // rules during processing.
   void SetBindingManager(nsBindingManager* aBindingManager)
   {
--- a/layout/style/test/Makefile.in
+++ b/layout/style/test/Makefile.in
@@ -63,17 +63,16 @@ include $(topsrcdir)/config/rules.mk
 
 css_properties.js: host_ListCSSProperties$(HOST_BIN_SUFFIX) css_properties_like_longhand.js Makefile
 	$(RM) $@
 	./host_ListCSSProperties$(HOST_BIN_SUFFIX) > $@
 	cat $(srcdir)/css_properties_like_longhand.js >> $@
 
 _TEST_FILES =	test_bug74880.html \
 		test_bug221428.html \
-		test_bug275196.xhtml \
 		test_bug302186.html \
 		test_bug319381.html \
 		test_bug357614.html \
 		test_bug365932.html \
 		test_bug372770.html \
 		test_bug373293.html \
 		test_bug377947.html \
 		test_bug379440.html \
deleted file mode 100644
--- a/layout/style/test/test_bug275196.xhtml
+++ /dev/null
@@ -1,149 +0,0 @@
-<?xml version="1.0"?>
-<html xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:foo="http://example.org/2005/02/13/#foo"
-      xml:id="start">
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=275196
--->
-<head>
-  <title>Test for Bug 275196</title>
-  <script type="text/javascript" src="/MochiKit/packed.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-    <style type="text/css">
-      :root {
-        background: red;
-      }
-
-      :root#foo {
-         background: rgb(0, 255, 0);
-      }
-
-      :root#bar {
-        background: rgb(0, 0, 255);
-      }
-
-      *[*|green] {
-        background: rgb(0, 255, 0);
-      }
-
-      #xhtml3, #foo2 {
-        background: rgb(0, 255, 0);
-      }
-    </style>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=275196">Mozilla Bug 275196</a>
-<p id="display"></p>
-<div id="content">
-  <div id="xhtml1" green="true">Element in XHTML namespace, attribute in null namespace</div>
-  <div id="xhtml2" foo:green="true">Element in XHTML namespace, attribute in foo namespace</div>
-  <foo:foo xml:id="foo1" foo:green="true">Element in foo namespace, attribute in foo namespace</foo:foo>
-  <div id="xhtml3">Element in XHTML namespace, id attribute</div>
-  <foo:foo xml:id="foo2">Element in foo namespace, xml:id attribute</foo:foo>
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-<![CDATA[
-
-/** Test for Bug 275196 **/
-
-// Test whether setting 'native' ID overrides xml:id
-function test_1() {
-  try {
-    document.getElementById('start').setAttribute('id', 'bar');
-  } catch (e) {
-    ok(false, "Couldn't find element 'start'");
-    test_2();
-    return;
-  }
-  ok(document.defaultView.getComputedStyle(document.documentElement, null).
-       getPropertyValue('background-color') == "rgb(0, 0, 255)",
-     "The background of the documentElement should be blue.");
-  test_2();
-}
-
-// Test if ID 'start' was removed from the document when the ID was set to 'bar'.
-function test_2() {
-  ok(document.getElementById('bar') != document.getElementById('start'),
-     "Element with ID 'bar' shouldn't be the same as 'start'");
-  test_3();
-}
-
-// Setting xml:id and removing 'native' ID
-function test_3() {
-  var b = null;
-  try {
-    b = document.getElementById('bar');
-    b.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:id", "foo");
-    b.removeAttribute('id');
-  } catch (e) {
-    ok(false, e);
-    test_4();
-    return;
-  }
-  ok(document.defaultView.getComputedStyle(document.documentElement, null).
-       getPropertyValue('background-color') == "rgb(0, 255, 0)",
-     "The background of the documentElement should be green.");
-  test_4();
-}
-
-// Setting 'native' ID
-function test_4() {
-  try {
-    document.getElementById('foo').setAttribute('id', 'bar');
-  } catch (e) {
-    ok(false, e);
-    test_5();
-    return;
-  }
-  ok(document.defaultView.getComputedStyle(document.documentElement, null).
-       getPropertyValue('background-color') == "rgb(0, 0, 255)",
-     "The background of the documentElement should be blue.");
-  test_5();
-}
-
-function testElementBackground(elementId) {
-  var el = document.getElementById(elementId);
-  ok(document.defaultView.getComputedStyle(el, null).
-       getPropertyValue('background-color') == "rgb(0, 255, 0)",
-     "The background of the element should be green.");
-
-  el.removeAttribute("green");
-  el.removeAttributeNS("http://example.org/2005/02/13/#foo", "green");
-  ok(document.defaultView.getComputedStyle(el, null).
-       getPropertyValue('background-color') == "transparent",
-     "The element should have transparent background.");
-}
-
-// Test *[*|green] style rule.
-function test_5() {
-  testElementBackground("xhtml1");
-  testElementBackground("xhtml2");
-  testElementBackground("foo1");
-  test_6();
-}
-
-// Test #xhtml3, #foo2 style rule.
-function test_6() {
-  var el = document.getElementById("xhtml3");
-  ok(document.defaultView.getComputedStyle(el, null).
-       getPropertyValue('background-color') == "rgb(0, 255, 0)",
-     "The background of the element should be green.");
-
-  el = document.getElementById("foo2");
-  ok(document.defaultView.getComputedStyle(el, null).
-       getPropertyValue('background-color') == "rgb(0, 255, 0)",
-     "The background of the element should be green.");
-  SimpleTest.finish();
-}
-
-SimpleTest.waitForExplicitFinish();
-addLoadEvent(test_1);
-
-]]>
-</script>
-</pre>
-</body>
-</html>
-