Move nsIContent::GetClassAttributeName() onto nsIStyledContent (bug 274402). r+sr=jst.

This commit is contained in:
bryner%brianryner.com 2004-12-14 03:54:01 +00:00
parent e61a9e0702
commit 6d1dd410b1
9 changed files with 21 additions and 25 deletions

View File

@ -60,8 +60,8 @@ class nsIURI;
// IID for the nsIContent interface
#define NS_ICONTENT_IID \
{ 0x84840657, 0x2f0b, 0x4b11, \
{ 0xa8, 0xba, 0xbc, 0x0e, 0xe3, 0xcd, 0xef, 0x08 } }
{ 0x38824dfc, 0x5a2d, 0x4b86, \
{ 0x8c, 0x49, 0xcc, 0xbb, 0x70, 0x03, 0x47, 0x51 } }
/**
* A node of content in a document's content model. This interface
@ -229,13 +229,6 @@ public:
*/
virtual nsIAtom *GetIDAttributeName() const = 0;
/**
* Returns an atom holding the name of the "class" attribute on this
* content node (if applicable). Returns null for non-element
* content nodes.
*/
virtual nsIAtom *GetClassAttributeName() 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

View File

@ -48,7 +48,7 @@ class nsAttrValue;
// IID for the nsIStyledContent class
#define NS_ISTYLEDCONTENT_IID \
{ 0x13cc12f1, 0x2892, 0x47e4, { 0xaa, 0x77, 0x24, 0xc, 0xa7, 0x49, 0x82, 0xde } };
{ 0xa7b53093, 0x3516, 0x4392, { 0xb3, 0x3e, 0x12, 0xc0, 0x0d, 0xe7, 0x85, 0xaa } };
// Abstract interface for all styled content (that supports ID, CLASS, STYLE, and
// the ability to specify style hints on an attribute change).
@ -86,6 +86,14 @@ public:
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const = 0;
/**
* Returns an atom holding the name of the "class" attribute on this
* content node (if applicable). Returns null for non-element
* content nodes.
*/
virtual nsIAtom *GetClassAttributeName() const = 0;
};
#endif /* nsIStyledContent_h___ */

View File

@ -43,7 +43,7 @@ class nsTextFragment;
// IID for the nsITextContent interface
#define NS_ITEXT_CONTENT_IID \
{0xa6cf9065, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
{0x3c4cfec2, 0x4438, 0x48df, {0xa2, 0x12, 0x30, 0x5e, 0x5a, 0xd8, 0xbb, 0xa0}}
/**
* Interface for textual content. This interface is used to provide

View File

@ -634,12 +634,6 @@ nsGenericDOMDataNode::GetIDAttributeName() const
return nsnull;
}
nsIAtom *
nsGenericDOMDataNode::GetClassAttributeName() const
{
return nsnull;
}
already_AddRefed<nsINodeInfo>
nsGenericDOMDataNode::GetExistingAttrNameFromQName(const nsAString& aStr) const
{

View File

@ -195,7 +195,6 @@ public:
virtual void SetNativeAnonymous(PRBool aAnonymous);
virtual PRInt32 GetNameSpaceID() 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)

View File

@ -49,8 +49,8 @@ struct nsRuleData;
// IID for the nsIHTMLContent class
#define NS_IHTMLCONTENT_IID \
{ 0xb9e110b0, 0x94d6, 0x11d1, \
{0x89, 0x5c, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
{ 0x02753dd8, 0x51fe, 0x4dee, \
{0xa0, 0xe9, 0x1e, 0x61, 0xf8, 0x83, 0x8c, 0x71} }
typedef void (*nsMapRuleToAttributesFunc)(const nsMappedAttributes* aAttributes,
nsRuleData* aData);

View File

@ -48,8 +48,8 @@ class nsIDocShell;
class nsIURI;
#define NS_IXMLCONTENT_IID \
{ 0xa6cf90cb, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
{ 0xb9df7adc, 0x3262, 0x4692, \
{ 0xbb, 0x97, 0xb7, 0xd5, 0xab, 0xdf, 0x85, 0x9c } }
/**
* XML content extensions to nsIContent

View File

@ -53,7 +53,7 @@ class nsString;
// {39C5ECC0-5C47-11d3-BE36-00104BDE6048}
#define NS_IXULCONTENT_IID \
{ 0x39c5ecc0, 0x5c47, 0x11d3, { 0xbe, 0x36, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } }
{ 0x316f8e9d, 0x8d1e, 0x433d, { 0xa2, 0xdd, 0xb5, 0xc0, 0x83, 0xb3, 0x56, 0x13 } }
class nsIXULContent : public nsIXMLContent

View File

@ -3439,7 +3439,7 @@ static PRBool SelectorMatches(RuleProcessorData &data,
}
if (result &&
(!aAttribute || aAttribute != data.mContent->GetClassAttributeName())) {
(!aAttribute || aAttribute != data.mStyledContent->GetClassAttributeName())) {
nsAtomList* classList = aSelector->mClassList;
while (nsnull != classList) {
if (localTrue == (!data.mStyledContent->HasClass(classList->mAtom, isCaseSensitive))) {
@ -3745,6 +3745,8 @@ nsCSSRuleProcessor::HasAttributeDependentStyle(AttributeRuleProcessorData* aData
{
NS_PRECONDITION(aData->mContent->IsContentOfType(nsIContent::eELEMENT),
"content must be element");
NS_ASSERTION(aData->mStyledContent,
"elements must implement nsIStyledContent");
AttributeEnumData data(aData);
@ -3771,7 +3773,7 @@ nsCSSRuleProcessor::HasAttributeDependentStyle(AttributeRuleProcessorData* aData
cascade->mIDSelectors.EnumerateForwards(AttributeEnumFunc, &data);
}
if (aData->mAttribute == aData->mContent->GetClassAttributeName()) {
if (aData->mAttribute == aData->mStyledContent->GetClassAttributeName()) {
cascade->mClassSelectors.EnumerateForwards(AttributeEnumFunc, &data);
}