From ea43ea6030be6a9ae96915b374c18ccecf3435c1 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sat, 29 Oct 2011 22:19:27 +0200 Subject: [PATCH] Bug 690120 - Make nsEditor::GetAttributeValue not use attribute nodes; r=ehsan --- editor/libeditor/base/nsEditor.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index 45ee281bb2e7..b7cc72a8a671 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -84,6 +84,7 @@ #include "nsCSSStyleSheet.h" #include "nsIContent.h" +#include "nsDOMString.h" #include "nsServiceManagerUtils.h" // transactions the editor knows how to build @@ -1252,19 +1253,18 @@ nsEditor::GetAttributeValue(nsIDOMElement *aElement, bool *aResultIsSet) { NS_ENSURE_TRUE(aResultIsSet, NS_ERROR_NULL_POINTER); - *aResultIsSet=false; - nsresult result=NS_OK; - if (aElement) - { - nsCOMPtr attNode; - result = aElement->GetAttributeNode(aAttribute, getter_AddRefs(attNode)); - if ((NS_SUCCEEDED(result)) && attNode) - { - attNode->GetSpecified(aResultIsSet); - attNode->GetValue(aResultValue); - } + *aResultIsSet = false; + if (!aElement) { + return NS_OK; } - 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