fix for 113310: Adding/Removing href attribute on <a> node does not update appearance; r=peterv; sr=jst; a=roc+moz; checked in by jfrancis on behalf of dglazman

This commit is contained in:
jfrancis%netscape.com 2002-02-21 23:21:17 +00:00
Родитель 04777cefcf
Коммит 0fcc29a69c
1 изменённых файлов: 44 добавлений и 0 удалений

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

@ -21,6 +21,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Daniel Glazman <glazman@netscape.com>
*
*
* Alternatively, the contents of this file may be used under the terms of
@ -117,6 +118,15 @@ public:
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent,
nsIDOMEvent** aDOMEvent, PRUint32 aFlags,
nsEventStatus* aEventStatus);
NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAReadableString& aValue,
PRBool aNotify);
NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo,
const nsAReadableString& aValue,
PRBool aNotify);
NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify);
#ifdef DEBUG
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
#endif
@ -781,3 +791,37 @@ nsHTMLAnchorElement::GetHrefCString(char* &aBuf)
return NS_OK;
}
NS_IMETHODIMP
nsHTMLAnchorElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAReadableString& aValue,
PRBool aNotify)
{
if (aName == nsHTMLAtoms::href && kNameSpaceID_None == aNameSpaceID) {
nsAutoString val;
GetHref(val);
if (!val.Equals(aValue)) {
SetLinkState(eLinkState_Unknown);
}
}
return nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aValue, aNotify);
}
NS_IMETHODIMP
nsHTMLAnchorElement::SetAttr(nsINodeInfo* aNodeInfo,
const nsAReadableString& aValue,
PRBool aNotify)
{
return nsGenericHTMLElement::SetAttr(aNodeInfo, aValue, aNotify);
}
nsresult
nsHTMLAnchorElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify)
{
if (aAttribute == nsHTMLAtoms::href && kNameSpaceID_None == aNameSpaceID) {
SetLinkState(eLinkState_Unknown);
}
// We still rely on the old way of setting the attribute.
return nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute, aNotify);
}