зеркало из https://github.com/mozilla/pjs.git
Backing out bug 275196, xml:id, to fix tp regression
This commit is contained in:
Родитель
1a45754cb1
Коммит
3255dc745d
|
@ -63,8 +63,8 @@ class nsIDocShell;
|
||||||
|
|
||||||
// IID for the nsIContent interface
|
// IID for the nsIContent interface
|
||||||
#define NS_ICONTENT_IID \
|
#define NS_ICONTENT_IID \
|
||||||
{ 0x609baee8, 0x3c0a, 0x4122, \
|
{ 0x36b375cb, 0xf01e, 0x4c18, \
|
||||||
{ 0x9c, 0xc6, 0xe4, 0xc9, 0x83, 0x53, 0xff, 0x9c } }
|
{ 0xbf, 0x9e, 0xba, 0xad, 0x77, 0x1d, 0xce, 0x22 } }
|
||||||
|
|
||||||
// hack to make egcs / gcc 2.95.2 happy
|
// hack to make egcs / gcc 2.95.2 happy
|
||||||
class nsIContent_base : public nsINode {
|
class nsIContent_base : public nsINode {
|
||||||
|
@ -211,21 +211,10 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an atom holding the name of the attribute of type ID on
|
* Returns an atom holding the name of the attribute of type ID on
|
||||||
* this content node (if applicable).
|
* this content node (if applicable). Returns null for non-element
|
||||||
* Language specific ID attribute has the highest priority, then
|
* content nodes.
|
||||||
* ID attribute defined in DTD, and finally xml:id.
|
|
||||||
* Returns null for non-element content nodes.
|
|
||||||
*/
|
*/
|
||||||
virtual nsIAtom* GetIDAttributeName(PRInt32& aNameSpaceID) const = 0;
|
virtual nsIAtom *GetIDAttributeName() 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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalizes an attribute name and returns it as a nodeinfo if an attribute
|
* Normalizes an attribute name and returns it as a nodeinfo if an attribute
|
||||||
|
@ -742,8 +731,8 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the ID of this content node (the atom corresponding to the
|
* Get the ID of this content node (the atom corresponding to the
|
||||||
* value of the attribute whose name is given by GetIDAttributeName().
|
* value of the null-namespace attribute whose name is given by
|
||||||
* This may be null if there is no ID.
|
* GetIDAttributeName(). This may be null if there is no ID.
|
||||||
*/
|
*/
|
||||||
virtual nsIAtom* GetID() const = 0;
|
virtual nsIAtom* GetID() const = 0;
|
||||||
|
|
||||||
|
|
|
@ -600,15 +600,14 @@ nsDOMAttribute::GetIsId(PRBool* aReturn)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 namespaceID;
|
nsIAtom* idAtom = content->GetIDAttributeName();
|
||||||
nsIAtom* idAtom = content->GetIDAttributeName(namespaceID);
|
|
||||||
if (!idAtom)
|
if (!idAtom)
|
||||||
{
|
{
|
||||||
*aReturn = PR_FALSE;
|
*aReturn = PR_FALSE;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
*aReturn = mNodeInfo->Equals(idAtom, namespaceID);
|
*aReturn = mNodeInfo->Equals(idAtom, kNameSpaceID_None);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -631,19 +631,11 @@ nsGenericDOMDataNode::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIAtom *
|
nsIAtom *
|
||||||
nsGenericDOMDataNode::GetIDAttributeName(PRInt32& aNameSpaceID) const
|
nsGenericDOMDataNode::GetIDAttributeName() const
|
||||||
{
|
{
|
||||||
aNameSpaceID = kNameSpaceID_Unknown;
|
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
|
||||||
nsGenericDOMDataNode::IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
|
|
||||||
nsIAtom* aAtom) const
|
|
||||||
{
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<nsINodeInfo>
|
already_AddRefed<nsINodeInfo>
|
||||||
nsGenericDOMDataNode::GetExistingAttrNameFromQName(const nsAString& aStr) const
|
nsGenericDOMDataNode::GetExistingAttrNameFromQName(const nsAString& aStr) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -195,9 +195,7 @@ public:
|
||||||
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
|
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
|
||||||
PRBool aNullParent = PR_TRUE);
|
PRBool aNullParent = PR_TRUE);
|
||||||
|
|
||||||
virtual nsIAtom *GetIDAttributeName(PRInt32& aNamespaceId) const;
|
virtual nsIAtom *GetIDAttributeName() const;
|
||||||
virtual PRBool IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
|
|
||||||
nsIAtom* aAtom) const;
|
|
||||||
virtual already_AddRefed<nsINodeInfo> GetExistingAttrNameFromQName(const nsAString& aStr) const;
|
virtual already_AddRefed<nsINodeInfo> GetExistingAttrNameFromQName(const nsAString& aStr) const;
|
||||||
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
const nsAString& aValue, PRBool aNotify)
|
const nsAString& aValue, PRBool aNotify)
|
||||||
|
|
|
@ -2260,10 +2260,9 @@ nsGenericElement::DispatchDOMEvent(nsEvent* aEvent,
|
||||||
nsIAtom*
|
nsIAtom*
|
||||||
nsGenericElement::GetID() const
|
nsGenericElement::GetID() const
|
||||||
{
|
{
|
||||||
PRInt32 namespaceID;
|
nsIAtom* IDName = GetIDAttributeName();
|
||||||
nsIAtom* IDName = GetIDAttributeName(namespaceID);
|
|
||||||
if (IDName) {
|
if (IDName) {
|
||||||
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(IDName, namespaceID);
|
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(IDName);
|
||||||
if (attrVal){
|
if (attrVal){
|
||||||
if (attrVal->Type() == nsAttrValue::eAtom) {
|
if (attrVal->Type() == nsAttrValue::eAtom) {
|
||||||
return attrVal->GetAtomValue();
|
return attrVal->GetAtomValue();
|
||||||
|
@ -2326,26 +2325,9 @@ nsGenericElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIAtom *
|
nsIAtom *
|
||||||
nsGenericElement::GetIDAttributeName(PRInt32& aNameSpaceID) const
|
nsGenericElement::GetIDAttributeName() const
|
||||||
{
|
{
|
||||||
aNameSpaceID = kNameSpaceID_None;
|
return mNodeInfo->GetIDAttributeAtom();
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIAtom *
|
nsIAtom *
|
||||||
|
@ -3670,8 +3652,8 @@ nsGenericElement::ParseAttribute(PRInt32 aNamespaceID,
|
||||||
const nsAString& aValue,
|
const nsAString& aValue,
|
||||||
nsAttrValue& aResult)
|
nsAttrValue& aResult)
|
||||||
{
|
{
|
||||||
if (IsPotentialIDAttributeName(aNamespaceID, aAttribute) &&
|
if (aNamespaceID == kNameSpaceID_None &&
|
||||||
!aValue.IsEmpty()) {
|
aAttribute == GetIDAttributeName() && !aValue.IsEmpty()) {
|
||||||
// Store id as an atom. id="" means that the element has no id,
|
// Store id as an atom. id="" means that the element has no id,
|
||||||
// not that it has an emptystring as the id.
|
// not that it has an emptystring as the id.
|
||||||
aResult.ParseAtom(aValue);
|
aResult.ParseAtom(aValue);
|
||||||
|
|
|
@ -383,9 +383,7 @@ public:
|
||||||
PRBool aCompileEventHandlers);
|
PRBool aCompileEventHandlers);
|
||||||
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
|
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
|
||||||
PRBool aNullParent = PR_TRUE);
|
PRBool aNullParent = PR_TRUE);
|
||||||
virtual nsIAtom *GetIDAttributeName(PRInt32& aNameSpaceID) const;
|
virtual nsIAtom *GetIDAttributeName() const;
|
||||||
virtual PRBool IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
|
|
||||||
nsIAtom* aAtom) 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;
|
||||||
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
|
|
|
@ -46,9 +46,7 @@ public:
|
||||||
virtual ~nsXMLEventsElement();
|
virtual ~nsXMLEventsElement();
|
||||||
NS_FORWARD_NSIDOMNODE(nsXMLElement::)
|
NS_FORWARD_NSIDOMNODE(nsXMLElement::)
|
||||||
|
|
||||||
virtual nsIAtom *GetIDAttributeName(PRInt32& aNameSpaceID) const;
|
virtual nsIAtom *GetIDAttributeName() const;
|
||||||
virtual PRBool IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
|
|
||||||
nsIAtom* aAtom) const;
|
|
||||||
virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
nsIAtom* aPrefix, const nsAString& aValue,
|
nsIAtom* aPrefix, const nsAString& aValue,
|
||||||
PRBool aNotify);
|
PRBool aNotify);
|
||||||
|
@ -65,21 +63,11 @@ nsXMLEventsElement::~nsXMLEventsElement()
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIAtom *
|
nsIAtom *
|
||||||
nsXMLEventsElement::GetIDAttributeName(PRInt32& aNameSpaceID) const
|
nsXMLEventsElement::GetIDAttributeName() const
|
||||||
{
|
{
|
||||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::id)) {
|
if (mNodeInfo->Equals(nsGkAtoms::listener))
|
||||||
aNameSpaceID = kNameSpaceID_None;
|
|
||||||
return nsGkAtoms::id;
|
return nsGkAtoms::id;
|
||||||
}
|
return nsXMLElement::GetIDAttributeName();
|
||||||
return nsGenericElement::GetIDAttributeName(aNameSpaceID);
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool
|
|
||||||
nsXMLEventsElement::IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
|
|
||||||
nsIAtom* aAtom) const
|
|
||||||
{
|
|
||||||
return (aNameSpaceID == kNameSpaceID_None && aAtom == nsGkAtoms::id) ||
|
|
||||||
nsGenericElement::IsPotentialIDAttributeName(aNameSpaceID, aAtom);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -377,11 +377,20 @@ nsXMLEventsManager::AttributeChanged(nsIDocument* aDocument,
|
||||||
AddXMLEventsContent(aContent);
|
AddXMLEventsContent(aContent);
|
||||||
nsXMLEventsListener::InitXMLEventsListener(aDocument, this, aContent);
|
nsXMLEventsListener::InitXMLEventsListener(aDocument, this, aContent);
|
||||||
}
|
}
|
||||||
else if (aContent->IsPotentialIDAttributeName(aNameSpaceID, aAttribute)) {
|
else if (aContent->GetIDAttributeName() == aAttribute) {
|
||||||
//Remove possible listener
|
if (aModType == nsIDOMMutationEvent::REMOVAL)
|
||||||
mListeners.Enumerate(EnumAndSetIncomplete, aContent);
|
mListeners.Enumerate(EnumAndSetIncomplete, aContent);
|
||||||
//Add new listeners
|
else if (aModType == nsIDOMMutationEvent::MODIFICATION) {
|
||||||
AddListeners(aDocument);
|
//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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1493,21 +1493,9 @@ nsGenericHTMLElement::GetClasses() const
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIAtom *
|
nsIAtom *
|
||||||
nsGenericHTMLElement::GetIDAttributeName(PRInt32& aNameSpaceID) const
|
nsGenericHTMLElement::GetIDAttributeName() const
|
||||||
{
|
{
|
||||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::id)) {
|
return 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIAtom *
|
nsIAtom *
|
||||||
|
|
|
@ -241,9 +241,7 @@ public:
|
||||||
virtual void UpdateEditableState();
|
virtual void UpdateEditableState();
|
||||||
|
|
||||||
virtual const nsAttrValue* GetClasses() const;
|
virtual const nsAttrValue* GetClasses() const;
|
||||||
virtual nsIAtom *GetIDAttributeName(PRInt32& aNameSpaceID) const;
|
virtual nsIAtom *GetIDAttributeName() const;
|
||||||
virtual PRBool IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
|
|
||||||
nsIAtom* aAtom) const;
|
|
||||||
virtual nsIAtom *GetClassAttributeName() const;
|
virtual nsIAtom *GetClassAttributeName() const;
|
||||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
|
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
|
||||||
virtual nsICSSStyleRule* GetInlineStyleRule();
|
virtual nsICSSStyleRule* GetInlineStyleRule();
|
||||||
|
|
|
@ -1376,7 +1376,8 @@ nsHTMLDocument::AttributeWillChange(nsIContent* aContent, PRInt32 aNameSpaceID,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (aContent->IsPotentialIDAttributeName(aNameSpaceID, aAttribute)) {
|
} else if (aAttribute == aContent->GetIDAttributeName() &&
|
||||||
|
aNameSpaceID == kNameSpaceID_None) {
|
||||||
nsresult rv = RemoveFromIdTable(aContent);
|
nsresult rv = RemoveFromIdTable(aContent);
|
||||||
|
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
|
@ -1405,7 +1406,8 @@ nsHTMLDocument::AttributeChanged(nsIDocument* aDocument,
|
||||||
if (name) {
|
if (name) {
|
||||||
UpdateNameTableEntry(name, aContent);
|
UpdateNameTableEntry(name, aContent);
|
||||||
}
|
}
|
||||||
} else if (aContent->IsPotentialIDAttributeName(aNameSpaceID, aAttribute)) {
|
} else if (aAttribute == aContent->GetIDAttributeName() &&
|
||||||
|
aNameSpaceID == kNameSpaceID_None) {
|
||||||
nsIAtom* id = aContent->GetID();
|
nsIAtom* id = aContent->GetID();
|
||||||
if (id) {
|
if (id) {
|
||||||
UpdateIdTableEntry(id, aContent);
|
UpdateIdTableEntry(id, aContent);
|
||||||
|
|
|
@ -126,22 +126,10 @@ NS_INTERFACE_MAP_END_INHERITING(nsGenericElement)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsIContent methods
|
// nsIContent methods
|
||||||
|
|
||||||
nsIAtom*
|
nsIAtom *
|
||||||
nsSVGElement::GetIDAttributeName(PRInt32& aNameSpaceID) const
|
nsSVGElement::GetIDAttributeName() const
|
||||||
{
|
{
|
||||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::id)) {
|
return 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIAtom *
|
nsIAtom *
|
||||||
|
|
|
@ -71,9 +71,7 @@ public:
|
||||||
|
|
||||||
// nsIContent interface methods
|
// nsIContent interface methods
|
||||||
|
|
||||||
virtual nsIAtom *GetIDAttributeName(PRInt32& aNameSpaceID) const;
|
virtual nsIAtom *GetIDAttributeName() const;
|
||||||
virtual PRBool IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
|
|
||||||
nsIAtom* aAtom) const;
|
|
||||||
virtual nsIAtom *GetClassAttributeName() const;
|
virtual nsIAtom *GetClassAttributeName() const;
|
||||||
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||||
PRBool aNotify);
|
PRBool aNotify);
|
||||||
|
|
|
@ -265,21 +265,10 @@ nsXTFElementWrapper::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIAtom *
|
nsIAtom *
|
||||||
nsXTFElementWrapper::GetIDAttributeName(PRInt32& aNameSpaceID) const
|
nsXTFElementWrapper::GetIDAttributeName() const
|
||||||
{
|
{
|
||||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::id)) {
|
// XXX:
|
||||||
aNameSpaceID = kNameSpaceID_None;
|
return nsGkAtoms::id;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -78,9 +78,7 @@ public:
|
||||||
nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
|
nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
|
||||||
PRBool aNotify);
|
PRBool aNotify);
|
||||||
nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
|
nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
|
||||||
virtual nsIAtom *GetIDAttributeName(PRInt32& aNameSpaceID) const;
|
nsIAtom *GetIDAttributeName() const;
|
||||||
virtual PRBool IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
|
|
||||||
nsIAtom* aAtom) const;
|
|
||||||
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
nsIAtom* aPrefix, const nsAString& aValue,
|
nsIAtom* aPrefix, const nsAString& aValue,
|
||||||
PRBool aNotify);
|
PRBool aNotify);
|
||||||
|
|
|
@ -1633,9 +1633,7 @@ nsXULElement::InsertChildAt(nsIContent* aKid, PRUint32 aIndex, PRBool aNotify)
|
||||||
nsIAtom*
|
nsIAtom*
|
||||||
nsXULElement::GetID() const
|
nsXULElement::GetID() const
|
||||||
{
|
{
|
||||||
PRInt32 namespaceID;
|
const nsAttrValue* attrVal = FindLocalOrProtoAttr(kNameSpaceID_None, nsGkAtoms::id);
|
||||||
nsIAtom* IDName = GetIDAttributeName(namespaceID);
|
|
||||||
const nsAttrValue* attrVal = FindLocalOrProtoAttr(namespaceID, IDName);
|
|
||||||
|
|
||||||
NS_ASSERTION(!attrVal ||
|
NS_ASSERTION(!attrVal ||
|
||||||
attrVal->Type() == nsAttrValue::eAtom ||
|
attrVal->Type() == nsAttrValue::eAtom ||
|
||||||
|
@ -1741,21 +1739,9 @@ nsXULElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIAtom *
|
nsIAtom *
|
||||||
nsXULElement::GetIDAttributeName(PRInt32& aNameSpaceID) const
|
nsXULElement::GetIDAttributeName() const
|
||||||
{
|
{
|
||||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::id)) {
|
|
||||||
aNameSpaceID = kNameSpaceID_None;
|
|
||||||
return nsGkAtoms::id;
|
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 *
|
nsIAtom *
|
||||||
|
|
|
@ -505,9 +505,7 @@ public:
|
||||||
virtual void UnbindFromTree(PRBool aDeep, PRBool aNullParent);
|
virtual void UnbindFromTree(PRBool aDeep, PRBool aNullParent);
|
||||||
virtual void SetNativeAnonymous(PRBool aAnonymous);
|
virtual void SetNativeAnonymous(PRBool aAnonymous);
|
||||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
|
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
|
||||||
virtual nsIAtom *GetIDAttributeName(PRInt32& aNameSpaceID) const;
|
virtual nsIAtom *GetIDAttributeName() const;
|
||||||
virtual PRBool IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
|
|
||||||
nsIAtom* aAtom) const;
|
|
||||||
virtual nsIAtom *GetClassAttributeName() const;
|
virtual nsIAtom *GetClassAttributeName() const;
|
||||||
virtual PRBool GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
virtual PRBool GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
nsAString& aResult) const;
|
nsAString& aResult) const;
|
||||||
|
|
|
@ -929,8 +929,7 @@ nsXULDocument::AttributeChanged(nsIDocument* aDocument,
|
||||||
|
|
||||||
// XXXbz check aNameSpaceID, dammit!
|
// XXXbz check aNameSpaceID, dammit!
|
||||||
// First see if we need to update our element map.
|
// First see if we need to update our element map.
|
||||||
if (aElement->IsPotentialIDAttributeName(aNameSpaceID, aAttribute) ||
|
if ((aAttribute == nsGkAtoms::id) || (aAttribute == nsGkAtoms::ref)) {
|
||||||
(aAttribute == nsGkAtoms::ref && aNameSpaceID == kNameSpaceID_None)) {
|
|
||||||
|
|
||||||
rv = mElementMap.Enumerate(RemoveElementsFromMapByContent, aElement);
|
rv = mElementMap.Enumerate(RemoveElementsFromMapByContent, aElement);
|
||||||
if (NS_FAILED(rv)) return;
|
if (NS_FAILED(rv)) return;
|
||||||
|
@ -1758,27 +1757,29 @@ nsXULDocument::GetTemplateBuilderFor(nsIContent* aContent,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attributes that are used with getElementById() and the
|
||||||
|
// resource-to-element map.
|
||||||
|
nsIAtom** nsXULDocument::kIdentityAttrs[] =
|
||||||
|
{
|
||||||
|
&nsGkAtoms::id,
|
||||||
|
&nsGkAtoms::ref,
|
||||||
|
nsnull
|
||||||
|
};
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsXULDocument::AddElementToMap(nsIContent* aElement)
|
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.
|
// add pointers in the resource-to-element map to the element.
|
||||||
nsresult rv;
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nsAutoString refvalue;
|
for (PRInt32 i = 0; kIdentityAttrs[i] != nsnull; ++i) {
|
||||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::ref, refvalue);
|
nsAutoString value;
|
||||||
if (!refvalue.IsEmpty()) {
|
aElement->GetAttr(kNameSpaceID_None, *kIdentityAttrs[i], value);
|
||||||
rv = mElementMap.Add(refvalue, aElement);
|
if (!value.IsEmpty()) {
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
rv = mElementMap.Add(value, aElement);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -1790,21 +1791,14 @@ nsXULDocument::RemoveElementFromMap(nsIContent* aElement)
|
||||||
{
|
{
|
||||||
// Remove the element from the resource-to-element map.
|
// Remove the element from the resource-to-element map.
|
||||||
nsresult rv;
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nsAutoString refvalue;
|
for (PRInt32 i = 0; kIdentityAttrs[i] != nsnull; ++i) {
|
||||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::ref, refvalue);
|
nsAutoString value;
|
||||||
if (!refvalue.IsEmpty()) {
|
aElement->GetAttr(kNameSpaceID_None, *kIdentityAttrs[i], value);
|
||||||
rv = mElementMap.Remove(refvalue, aElement);
|
if (!value.IsEmpty()) {
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
rv = mElementMap.Remove(value, aElement);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -1962,10 +1962,8 @@ nsXFormsUtils::GetElementById(const nsAString &aId,
|
||||||
if (type == nsIDOMNode::ELEMENT_NODE) {
|
if (type == nsIDOMNode::ELEMENT_NODE) {
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(childNode));
|
nsCOMPtr<nsIContent> content(do_QueryInterface(childNode));
|
||||||
NS_ASSERTION(content, "An ELEMENT_NODE not implementing nsIContent?!");
|
NS_ASSERTION(content, "An ELEMENT_NODE not implementing nsIContent?!");
|
||||||
PRInt32 namespaceID;
|
if (content->AttrValueIs(kNameSpaceID_None, content->GetIDAttributeName(),
|
||||||
nsIAtom* idAtom = content->GetIDAttributeName(namespaceID);
|
aId, eCaseMatters)) {
|
||||||
if (idAtom &&
|
|
||||||
content->AttrValueIs(namespaceID, idAtom, aId, eCaseMatters)) {
|
|
||||||
element = do_QueryInterface(childNode);
|
element = do_QueryInterface(childNode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10128,8 +10128,7 @@ nsCSSFrameConstructor::AttributeChanged(nsIContent* aContent,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// the style tag has its own interpretation based on aHint
|
// the style tag has its own interpretation based on aHint
|
||||||
nsChangeHint hint = (aNameSpaceID == kNameSpaceID_None)
|
nsChangeHint hint = aContent->GetAttributeChangeHint(aAttribute, aModType);
|
||||||
? aContent->GetAttributeChangeHint(aAttribute, aModType) : nsChangeHint(0);
|
|
||||||
|
|
||||||
PRBool reframe = (hint & nsChangeHint_ReconstructFrame) != 0;
|
PRBool reframe = (hint & nsChangeHint_ReconstructFrame) != 0;
|
||||||
|
|
||||||
|
@ -10164,19 +10163,15 @@ nsCSSFrameConstructor::AttributeChanged(nsIContent* aContent,
|
||||||
|
|
||||||
if (primaryFrame) {
|
if (primaryFrame) {
|
||||||
// See if we have appearance information for a theme.
|
// See if we have appearance information for a theme.
|
||||||
if (aNameSpaceID == kNameSpaceID_None) {
|
const nsStyleDisplay* disp = primaryFrame->GetStyleDisplay();
|
||||||
const nsStyleDisplay* disp = primaryFrame->GetStyleDisplay();
|
if (disp->mAppearance) {
|
||||||
if (disp->mAppearance) {
|
nsPresContext* presContext = mPresShell->GetPresContext();
|
||||||
nsPresContext* presContext = mPresShell->GetPresContext();
|
nsITheme *theme = presContext->GetTheme();
|
||||||
nsITheme *theme = presContext->GetTheme();
|
if (theme && theme->ThemeSupportsWidget(presContext, primaryFrame, disp->mAppearance)) {
|
||||||
if (theme && theme->ThemeSupportsWidget(presContext, primaryFrame,
|
PRBool repaint = PR_FALSE;
|
||||||
disp->mAppearance)) {
|
theme->WidgetStateChanged(primaryFrame, disp->mAppearance, aAttribute, &repaint);
|
||||||
PRBool repaint = PR_FALSE;
|
if (repaint)
|
||||||
theme->WidgetStateChanged(primaryFrame, disp->mAppearance, aAttribute,
|
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
|
||||||
&repaint);
|
|
||||||
if (repaint)
|
|
||||||
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10193,7 +10188,6 @@ nsCSSFrameConstructor::AttributeChanged(nsIContent* aContent,
|
||||||
// the frame's AttributeChanged() in case it does something that affects the style
|
// the frame's AttributeChanged() in case it does something that affects the style
|
||||||
nsFrameManager *frameManager = shell->FrameManager();
|
nsFrameManager *frameManager = shell->FrameManager();
|
||||||
nsReStyleHint rshint = frameManager->HasAttributeDependentStyle(aContent,
|
nsReStyleHint rshint = frameManager->HasAttributeDependentStyle(aContent,
|
||||||
aNameSpaceID,
|
|
||||||
aAttribute,
|
aAttribute,
|
||||||
aModType,
|
aModType,
|
||||||
aStateMask);
|
aStateMask);
|
||||||
|
|
|
@ -1445,14 +1445,12 @@ nsFrameManager::ComputeStyleChangeFor(nsIFrame *aFrame,
|
||||||
|
|
||||||
nsReStyleHint
|
nsReStyleHint
|
||||||
nsFrameManager::HasAttributeDependentStyle(nsIContent *aContent,
|
nsFrameManager::HasAttributeDependentStyle(nsIContent *aContent,
|
||||||
PRInt32 aNameSpaceID,
|
|
||||||
nsIAtom *aAttribute,
|
nsIAtom *aAttribute,
|
||||||
PRInt32 aModType,
|
PRInt32 aModType,
|
||||||
PRUint32 aStateMask)
|
PRUint32 aStateMask)
|
||||||
{
|
{
|
||||||
nsReStyleHint hint = mStyleSet->HasAttributeDependentStyle(GetPresContext(),
|
nsReStyleHint hint = mStyleSet->HasAttributeDependentStyle(GetPresContext(),
|
||||||
aContent,
|
aContent,
|
||||||
aNameSpaceID,
|
|
||||||
aAttribute,
|
aAttribute,
|
||||||
aModType,
|
aModType,
|
||||||
aStateMask);
|
aStateMask);
|
||||||
|
|
|
@ -191,7 +191,6 @@ public:
|
||||||
|
|
||||||
// Determine whether an attribute affects style
|
// Determine whether an attribute affects style
|
||||||
NS_HIDDEN_(nsReStyleHint) HasAttributeDependentStyle(nsIContent *aContent,
|
NS_HIDDEN_(nsReStyleHint) HasAttributeDependentStyle(nsIContent *aContent,
|
||||||
PRInt32 aNameSpaceID,
|
|
||||||
nsIAtom *aAttribute,
|
nsIAtom *aAttribute,
|
||||||
PRInt32 aModType,
|
PRInt32 aModType,
|
||||||
PRUint32 aStateMask);
|
PRUint32 aStateMask);
|
||||||
|
|
|
@ -1001,8 +1001,6 @@ static PRBool AttrMatchesValue(const nsAttrSelector* aAttrSelector,
|
||||||
static PRBool SelectorMatches(RuleProcessorData &data,
|
static PRBool SelectorMatches(RuleProcessorData &data,
|
||||||
nsCSSSelector* aSelector,
|
nsCSSSelector* aSelector,
|
||||||
PRInt32 aStateMask, // states NOT to test
|
PRInt32 aStateMask, // states NOT to test
|
||||||
PRInt32 aNameSpaceID, // the namespace of the
|
|
||||||
// attribute NOT to test
|
|
||||||
nsIAtom* aAttribute, // attribute NOT to test
|
nsIAtom* aAttribute, // attribute NOT to test
|
||||||
PRBool* const aDependence = nsnull)
|
PRBool* const aDependence = nsnull)
|
||||||
|
|
||||||
|
@ -1324,9 +1322,9 @@ static PRBool SelectorMatches(RuleProcessorData &data,
|
||||||
result = PR_TRUE;
|
result = PR_TRUE;
|
||||||
nsAttrSelector* attr = aSelector->mAttrList;
|
nsAttrSelector* attr = aSelector->mAttrList;
|
||||||
do {
|
do {
|
||||||
if (attr->mAttr == aAttribute &&
|
if (attr->mAttr == aAttribute) {
|
||||||
(attr->mNameSpace == aNameSpaceID ||
|
// XXX we should really have a namespace, not just an attr
|
||||||
attr->mNameSpace == kNameSpaceID_Unknown)) {
|
// name, in HasAttributeDependentStyle!
|
||||||
result = PR_TRUE;
|
result = PR_TRUE;
|
||||||
if (aDependence)
|
if (aDependence)
|
||||||
*aDependence = PR_TRUE;
|
*aDependence = PR_TRUE;
|
||||||
|
@ -1398,9 +1396,8 @@ static PRBool SelectorMatches(RuleProcessorData &data,
|
||||||
if (result && IDList) {
|
if (result && IDList) {
|
||||||
// test for ID match
|
// test for ID match
|
||||||
result = PR_FALSE;
|
result = PR_FALSE;
|
||||||
PRInt32 namespaceID;
|
|
||||||
if (aAttribute &&
|
if (aAttribute && aAttribute == data.mContent->GetIDAttributeName()) {
|
||||||
data.mContent->IsPotentialIDAttributeName(namespaceID, aAttribute)) {
|
|
||||||
result = PR_TRUE;
|
result = PR_TRUE;
|
||||||
if (aDependence)
|
if (aDependence)
|
||||||
*aDependence = PR_TRUE;
|
*aDependence = PR_TRUE;
|
||||||
|
@ -1438,8 +1435,7 @@ static PRBool SelectorMatches(RuleProcessorData &data,
|
||||||
|
|
||||||
if (result && aSelector->mClassList) {
|
if (result && aSelector->mClassList) {
|
||||||
// test for class match
|
// test for class match
|
||||||
if (aAttribute && aAttribute == data.mContent->GetClassAttributeName() &&
|
if (aAttribute && aAttribute == data.mContent->GetClassAttributeName()) {
|
||||||
aNameSpaceID == kNameSpaceID_None) {
|
|
||||||
result = PR_TRUE;
|
result = PR_TRUE;
|
||||||
if (aDependence)
|
if (aDependence)
|
||||||
*aDependence = PR_TRUE;
|
*aDependence = PR_TRUE;
|
||||||
|
@ -1466,7 +1462,7 @@ static PRBool SelectorMatches(RuleProcessorData &data,
|
||||||
for (nsCSSSelector *negation = aSelector->mNegations;
|
for (nsCSSSelector *negation = aSelector->mNegations;
|
||||||
result && negation; negation = negation->mNegations) {
|
result && negation; negation = negation->mNegations) {
|
||||||
PRBool dependence = PR_FALSE;
|
PRBool dependence = PR_FALSE;
|
||||||
result = !SelectorMatches(data, negation, aStateMask, aNameSpaceID,
|
result = !SelectorMatches(data, negation, aStateMask,
|
||||||
aAttribute, &dependence);
|
aAttribute, &dependence);
|
||||||
// If the selector does match due to the dependence on aStateMask
|
// If the selector does match due to the dependence on aStateMask
|
||||||
// or aAttribute, then we want to keep result true so that the
|
// or aAttribute, then we want to keep result true so that the
|
||||||
|
@ -1540,7 +1536,7 @@ static PRBool SelectorMatchesTree(RuleProcessorData& aPrevData,
|
||||||
if (! data) {
|
if (! data) {
|
||||||
return PR_FALSE;
|
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
|
// to avoid greedy matching, we need to recur if this is a
|
||||||
// descendant combinator and the next combinator is not
|
// descendant combinator and the next combinator is not
|
||||||
if ((NS_IS_GREEDY_OPERATOR(selector->mOperator)) &&
|
if ((NS_IS_GREEDY_OPERATOR(selector->mOperator)) &&
|
||||||
|
@ -1577,7 +1573,7 @@ static void ContentEnumFunc(nsICSSStyleRule* aRule, nsCSSSelector* aSelector,
|
||||||
{
|
{
|
||||||
ElementRuleProcessorData* data = (ElementRuleProcessorData*)aData;
|
ElementRuleProcessorData* data = (ElementRuleProcessorData*)aData;
|
||||||
|
|
||||||
if (SelectorMatches(*data, aSelector, 0, kNameSpaceID_Unknown, nsnull)) {
|
if (SelectorMatches(*data, aSelector, 0, nsnull)) {
|
||||||
nsCSSSelector *next = aSelector->mNext;
|
nsCSSSelector *next = aSelector->mNext;
|
||||||
if (!next || SelectorMatchesTree(*data, next)) {
|
if (!next || SelectorMatchesTree(*data, next)) {
|
||||||
// for performance, require that every implementation of
|
// for performance, require that every implementation of
|
||||||
|
@ -1630,7 +1626,7 @@ static void PseudoEnumFunc(nsICSSStyleRule* aRule, nsCSSSelector* aSelector,
|
||||||
if (PRUnichar('+') == selector->mOperator) {
|
if (PRUnichar('+') == selector->mOperator) {
|
||||||
return; // not valid here, can't match
|
return; // not valid here, can't match
|
||||||
}
|
}
|
||||||
if (SelectorMatches(*data, selector, 0, kNameSpaceID_Unknown, nsnull)) {
|
if (SelectorMatches(*data, selector, 0, nsnull)) {
|
||||||
selector = selector->mNext;
|
selector = selector->mNext;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1701,8 +1697,7 @@ PR_STATIC_CALLBACK(PRBool) StateEnumFunc(void* aSelector, void* aData)
|
||||||
// bother calling SelectorMatches, since even if it returns false
|
// bother calling SelectorMatches, since even if it returns false
|
||||||
// enumData->change won't change.
|
// enumData->change won't change.
|
||||||
if ((possibleChange & ~(enumData->change)) &&
|
if ((possibleChange & ~(enumData->change)) &&
|
||||||
SelectorMatches(*data, selector, data->mStateMask, kNameSpaceID_Unknown,
|
SelectorMatches(*data, selector, data->mStateMask, nsnull) &&
|
||||||
nsnull) &&
|
|
||||||
SelectorMatchesTree(*data, selector->mNext)) {
|
SelectorMatchesTree(*data, selector->mNext)) {
|
||||||
enumData->change = nsReStyleHint(enumData->change | possibleChange);
|
enumData->change = nsReStyleHint(enumData->change | possibleChange);
|
||||||
}
|
}
|
||||||
|
@ -1756,8 +1751,7 @@ PR_STATIC_CALLBACK(PRBool) AttributeEnumFunc(void* aSelector, void* aData)
|
||||||
// bother calling SelectorMatches, since even if it returns false
|
// bother calling SelectorMatches, since even if it returns false
|
||||||
// enumData->change won't change.
|
// enumData->change won't change.
|
||||||
if ((possibleChange & ~(enumData->change)) &&
|
if ((possibleChange & ~(enumData->change)) &&
|
||||||
SelectorMatches(*data, selector, data->mStateMask, data->mNameSpaceID,
|
SelectorMatches(*data, selector, data->mStateMask, data->mAttribute) &&
|
||||||
data->mAttribute) &&
|
|
||||||
SelectorMatchesTree(*data, selector->mNext)) {
|
SelectorMatchesTree(*data, selector->mNext)) {
|
||||||
enumData->change = nsReStyleHint(enumData->change | possibleChange);
|
enumData->change = nsReStyleHint(enumData->change | possibleChange);
|
||||||
}
|
}
|
||||||
|
@ -1778,7 +1772,6 @@ nsCSSRuleProcessor::HasAttributeDependentStyle(AttributeRuleProcessorData* aData
|
||||||
// and :visited rules from prefs), rather than hacking AddRule below
|
// and :visited rules from prefs), rather than hacking AddRule below
|
||||||
// to add |href| to the hash, we'll just handle it here.
|
// to add |href| to the hash, we'll just handle it here.
|
||||||
if (aData->mAttribute == nsGkAtoms::href &&
|
if (aData->mAttribute == nsGkAtoms::href &&
|
||||||
aData->mNameSpaceID == kNameSpaceID_None &&
|
|
||||||
aData->mIsHTMLContent &&
|
aData->mIsHTMLContent &&
|
||||||
(aData->mContentTag == nsGkAtoms::a ||
|
(aData->mContentTag == nsGkAtoms::a ||
|
||||||
aData->mContentTag == nsGkAtoms::area ||
|
aData->mContentTag == nsGkAtoms::area ||
|
||||||
|
@ -1796,13 +1789,11 @@ nsCSSRuleProcessor::HasAttributeDependentStyle(AttributeRuleProcessorData* aData
|
||||||
// we have a hashtable with a per-attribute list.
|
// we have a hashtable with a per-attribute list.
|
||||||
|
|
||||||
if (cascade) {
|
if (cascade) {
|
||||||
if (aData->mContent->IsPotentialIDAttributeName(aData->mNameSpaceID,
|
if (aData->mAttribute == aData->mContent->GetIDAttributeName()) {
|
||||||
aData->mAttribute)) {
|
|
||||||
cascade->mIDSelectors.EnumerateForwards(AttributeEnumFunc, &data);
|
cascade->mIDSelectors.EnumerateForwards(AttributeEnumFunc, &data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aData->mNameSpaceID == kNameSpaceID_None &&
|
if (aData->mAttribute == aData->mContent->GetClassAttributeName()) {
|
||||||
aData->mAttribute == aData->mContent->GetClassAttributeName()) {
|
|
||||||
cascade->mClassSelectors.EnumerateForwards(AttributeEnumFunc, &data);
|
cascade->mClassSelectors.EnumerateForwards(AttributeEnumFunc, &data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,24 +153,19 @@ struct StateRuleProcessorData : public RuleProcessorData {
|
||||||
struct AttributeRuleProcessorData : public RuleProcessorData {
|
struct AttributeRuleProcessorData : public RuleProcessorData {
|
||||||
AttributeRuleProcessorData(nsPresContext* aPresContext,
|
AttributeRuleProcessorData(nsPresContext* aPresContext,
|
||||||
nsIContent* aContent,
|
nsIContent* aContent,
|
||||||
PRInt32 aNameSpaceID,
|
|
||||||
nsIAtom* aAttribute,
|
nsIAtom* aAttribute,
|
||||||
PRInt32 aModType,
|
PRInt32 aModType,
|
||||||
PRUint32 aStateMask)
|
PRUint32 aStateMask)
|
||||||
: RuleProcessorData(aPresContext, aContent, nsnull),
|
: RuleProcessorData(aPresContext, aContent, nsnull),
|
||||||
mNameSpaceID(aNameSpaceID),
|
|
||||||
mAttribute(aAttribute),
|
mAttribute(aAttribute),
|
||||||
mModType(aModType),
|
mModType(aModType),
|
||||||
mStateMask(aStateMask)
|
mStateMask(aStateMask)
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aContent, "null pointer");
|
NS_PRECONDITION(aContent, "null pointer");
|
||||||
}
|
}
|
||||||
// |HasAttributeDependentStyle| for which attribute?
|
nsIAtom* mAttribute; // |HasAttributeDependentStyle| for which attribute?
|
||||||
PRInt32 mNameSpaceID;
|
PRInt32 mModType; // The type of modification (see nsIDOMMutationEvent).
|
||||||
nsIAtom* mAttribute;
|
PRUint32 mStateMask; // The states that changed with the attr change.
|
||||||
|
|
||||||
PRInt32 mModType; // The type of modification (see nsIDOMMutationEvent).
|
|
||||||
PRUint32 mStateMask; // The states that changed with the attr change.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -959,10 +959,10 @@ nsStyleSet::HasStateDependentStyle(nsPresContext* aPresContext,
|
||||||
|
|
||||||
struct AttributeData : public AttributeRuleProcessorData {
|
struct AttributeData : public AttributeRuleProcessorData {
|
||||||
AttributeData(nsPresContext* aPresContext,
|
AttributeData(nsPresContext* aPresContext,
|
||||||
nsIContent* aContent, PRInt32 aNameSpaceID,
|
nsIContent* aContent, nsIAtom* aAttribute, PRInt32 aModType,
|
||||||
nsIAtom* aAttribute, PRInt32 aModType, PRUint32 aStateMask)
|
PRUint32 aStateMask)
|
||||||
: AttributeRuleProcessorData(aPresContext, aContent, aNameSpaceID,
|
: AttributeRuleProcessorData(aPresContext, aContent, aAttribute, aModType,
|
||||||
aAttribute, aModType, aStateMask),
|
aStateMask),
|
||||||
mHint(nsReStyleHint(0))
|
mHint(nsReStyleHint(0))
|
||||||
{}
|
{}
|
||||||
nsReStyleHint mHint;
|
nsReStyleHint mHint;
|
||||||
|
@ -982,7 +982,6 @@ SheetHasAttributeStyle(nsIStyleRuleProcessor* aProcessor, void *aData)
|
||||||
nsReStyleHint
|
nsReStyleHint
|
||||||
nsStyleSet::HasAttributeDependentStyle(nsPresContext* aPresContext,
|
nsStyleSet::HasAttributeDependentStyle(nsPresContext* aPresContext,
|
||||||
nsIContent* aContent,
|
nsIContent* aContent,
|
||||||
PRInt32 aNameSpaceID,
|
|
||||||
nsIAtom* aAttribute,
|
nsIAtom* aAttribute,
|
||||||
PRInt32 aModType,
|
PRInt32 aModType,
|
||||||
PRUint32 aStateMask)
|
PRUint32 aStateMask)
|
||||||
|
@ -997,8 +996,8 @@ nsStyleSet::HasAttributeDependentStyle(nsPresContext* aPresContext,
|
||||||
mRuleProcessors[eDocSheet] ||
|
mRuleProcessors[eDocSheet] ||
|
||||||
mRuleProcessors[eStyleAttrSheet] ||
|
mRuleProcessors[eStyleAttrSheet] ||
|
||||||
mRuleProcessors[eOverrideSheet])) {
|
mRuleProcessors[eOverrideSheet])) {
|
||||||
AttributeData data(aPresContext, aContent, aNameSpaceID, aAttribute,
|
AttributeData data(aPresContext, aContent, aAttribute, aModType,
|
||||||
aModType, aStateMask);
|
aStateMask);
|
||||||
WalkRuleProcessors(SheetHasAttributeStyle, &data);
|
WalkRuleProcessors(SheetHasAttributeStyle, &data);
|
||||||
result = data.mHint;
|
result = data.mHint;
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,6 @@ class nsStyleSet
|
||||||
// Test if style is dependent on the presence of an attribute.
|
// Test if style is dependent on the presence of an attribute.
|
||||||
nsReStyleHint HasAttributeDependentStyle(nsPresContext* aPresContext,
|
nsReStyleHint HasAttributeDependentStyle(nsPresContext* aPresContext,
|
||||||
nsIContent* aContent,
|
nsIContent* aContent,
|
||||||
PRInt32 aNameSpaceID,
|
|
||||||
nsIAtom* aAttribute,
|
nsIAtom* aAttribute,
|
||||||
PRInt32 aModType,
|
PRInt32 aModType,
|
||||||
PRUint32 aStateMask);
|
PRUint32 aStateMask);
|
||||||
|
|
|
@ -68,7 +68,6 @@ css_properties.js: host_ListCSSProperties$(HOST_BIN_SUFFIX) css_properties_like_
|
||||||
|
|
||||||
_TEST_FILES = test_bug74880.html \
|
_TEST_FILES = test_bug74880.html \
|
||||||
test_bug221428.html \
|
test_bug221428.html \
|
||||||
test_bug275196.xhtml \
|
|
||||||
test_bug302186.html \
|
test_bug302186.html \
|
||||||
test_bug319381.html \
|
test_bug319381.html \
|
||||||
test_bug357614.html \
|
test_bug357614.html \
|
||||||
|
|
Загрузка…
Ссылка в новой задаче