Bug 690120 - Make nsEditor::GetAttributeValue not use attribute nodes; r=ehsan

This commit is contained in:
Ms2ger 2011-10-29 22:19:27 +02:00
parent 7852c8dc13
commit ea43ea6030

View File

@ -84,6 +84,7 @@
#include "nsCSSStyleSheet.h" #include "nsCSSStyleSheet.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsDOMString.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
// transactions the editor knows how to build // transactions the editor knows how to build
@ -1252,19 +1253,18 @@ nsEditor::GetAttributeValue(nsIDOMElement *aElement,
bool *aResultIsSet) bool *aResultIsSet)
{ {
NS_ENSURE_TRUE(aResultIsSet, NS_ERROR_NULL_POINTER); NS_ENSURE_TRUE(aResultIsSet, NS_ERROR_NULL_POINTER);
*aResultIsSet=false; *aResultIsSet = false;
nsresult result=NS_OK; if (!aElement) {
if (aElement) return NS_OK;
{
nsCOMPtr<nsIDOMAttr> attNode;
result = aElement->GetAttributeNode(aAttribute, getter_AddRefs(attNode));
if ((NS_SUCCEEDED(result)) && attNode)
{
attNode->GetSpecified(aResultIsSet);
attNode->GetValue(aResultValue);
}
} }
return result; nsAutoString value;
nsresult rv = aElement->GetAttribute(aAttribute, value);
NS_ENSURE_SUCCESS(rv, rv);
if (!DOMStringIsNull(value)) {
*aResultIsSet = true;
aResultValue = value;
}
return rv;
} }
NS_IMETHODIMP NS_IMETHODIMP