From d83baf352929c23a48739ae88ab4e84692b4a0c3 Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Wed, 10 May 2000 02:15:47 +0000 Subject: [PATCH] Making XML, MathML, SVG, and HTML elements support passing attribute changes into XBL bindings. --- content/base/src/nsGenericElement.cpp | 28 +++++++++++++++++++++------ layout/base/src/nsGenericElement.cpp | 28 +++++++++++++++++++++------ 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index 00b454525e63..63413c4b54c2 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -2254,11 +2254,18 @@ nsGenericContainerElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, } } - if (aNotify && (nsnull != mDocument)) { - if (NS_SUCCEEDED(rv)) { + if (mDocument && NS_SUCCEEDED(rv)) { + nsCOMPtr bindingManager; + mDocument->GetBindingManager(getter_AddRefs(bindingManager)); + nsCOMPtr binding; + bindingManager->GetBinding(mContent, getter_AddRefs(binding)); + if (binding) + binding->AttributeChanged(aName, aNameSpaceID, PR_FALSE); + + if (aNotify) { mDocument->AttributeChanged(mContent, aNameSpaceID, aName, NS_STYLE_HINT_UNKNOWN); + mDocument->EndUpdate(); } - mDocument->EndUpdate(); } return rv; @@ -2334,9 +2341,18 @@ nsGenericContainerElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, } } - if (NS_SUCCEEDED(rv) && found && aNotify && (nsnull != mDocument)) { - mDocument->AttributeChanged(mContent, aNameSpaceID, aName, NS_STYLE_HINT_UNKNOWN); - mDocument->EndUpdate(); + if (NS_SUCCEEDED(rv) && found && mDocument) { + nsCOMPtr bindingManager; + mDocument->GetBindingManager(getter_AddRefs(bindingManager)); + nsCOMPtr binding; + bindingManager->GetBinding(mContent, getter_AddRefs(binding)); + if (binding) + binding->AttributeChanged(aName, aNameSpaceID, PR_TRUE); + + if (aNotify) { + mDocument->AttributeChanged(mContent, aNameSpaceID, aName, NS_STYLE_HINT_UNKNOWN); + mDocument->EndUpdate(); + } } } diff --git a/layout/base/src/nsGenericElement.cpp b/layout/base/src/nsGenericElement.cpp index 00b454525e63..63413c4b54c2 100644 --- a/layout/base/src/nsGenericElement.cpp +++ b/layout/base/src/nsGenericElement.cpp @@ -2254,11 +2254,18 @@ nsGenericContainerElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, } } - if (aNotify && (nsnull != mDocument)) { - if (NS_SUCCEEDED(rv)) { + if (mDocument && NS_SUCCEEDED(rv)) { + nsCOMPtr bindingManager; + mDocument->GetBindingManager(getter_AddRefs(bindingManager)); + nsCOMPtr binding; + bindingManager->GetBinding(mContent, getter_AddRefs(binding)); + if (binding) + binding->AttributeChanged(aName, aNameSpaceID, PR_FALSE); + + if (aNotify) { mDocument->AttributeChanged(mContent, aNameSpaceID, aName, NS_STYLE_HINT_UNKNOWN); + mDocument->EndUpdate(); } - mDocument->EndUpdate(); } return rv; @@ -2334,9 +2341,18 @@ nsGenericContainerElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, } } - if (NS_SUCCEEDED(rv) && found && aNotify && (nsnull != mDocument)) { - mDocument->AttributeChanged(mContent, aNameSpaceID, aName, NS_STYLE_HINT_UNKNOWN); - mDocument->EndUpdate(); + if (NS_SUCCEEDED(rv) && found && mDocument) { + nsCOMPtr bindingManager; + mDocument->GetBindingManager(getter_AddRefs(bindingManager)); + nsCOMPtr binding; + bindingManager->GetBinding(mContent, getter_AddRefs(binding)); + if (binding) + binding->AttributeChanged(aName, aNameSpaceID, PR_TRUE); + + if (aNotify) { + mDocument->AttributeChanged(mContent, aNameSpaceID, aName, NS_STYLE_HINT_UNKNOWN); + mDocument->EndUpdate(); + } } }